amiro-os / include / amiro / bluetooth / bluetooth-serial.hpp @ 05d54823
History | View | Annotate | Download (1.025 KB)
1 |
#ifndef _BLUETOOTH_SERIAL_H_
|
---|---|
2 |
#define _BLUETOOTH_SERIAL_H_
|
3 |
|
4 |
#include <amiro/bluetooth/bluetooth-connector.hpp> |
5 |
|
6 |
#define BLUETOOTH_SERIAL_MAILBOX_SIZE 5 |
7 |
|
8 |
#define SERIAL_START_EVENT 1 |
9 |
#define SERIAL_STOP_EVENT 2 |
10 |
|
11 |
namespace amiro {
|
12 |
class BluetoothSerial : public chibios_rt::BaseStaticThread<128> { |
13 |
public:
|
14 |
BluetoothSerial(BLUETOOTH *bluetooth, uint8_t rxtx); |
15 |
|
16 |
void bluetoothSerialStart(uint8_t linkid);
|
17 |
void bluetoothSerialStop();
|
18 |
bool bluetoothSerialIsConnected();
|
19 |
|
20 |
void bluetoothSerialListen(const char *addr); |
21 |
void bluetoothSerialConnect(const char *addr); |
22 |
void bluetoothSerialDisconnect(const char *addr); |
23 |
|
24 |
msg_t serialTransmit(const uint8_t* serialdata, size_t length);
|
25 |
|
26 |
protected:
|
27 |
virtual msg_t main(void); |
28 |
|
29 |
private:
|
30 |
msg_t serialReceive(); |
31 |
|
32 |
BluetoothConnector serialConn; |
33 |
uint8_t rx_tx; |
34 |
|
35 |
chibios_rt::Mailbox mailbox; |
36 |
msg_t mailboxBuffer[BLUETOOTH_SERIAL_MAILBOX_SIZE]; |
37 |
|
38 |
BluetoothIwrap *iwrap; |
39 |
uint8_t linkId; |
40 |
uint8_t stopflag; |
41 |
}; |
42 |
} |
43 |
#endif /* _BLUETOOTH_SERIAL_H_ */ |