amiro-os / include / amiro / bluetooth / bluetooth-iwrap.hpp @ a47d64ad
History | View | Annotate | Download (959 Bytes)
1 |
#ifndef _BLUETOOTH_IWRAP_H_
|
---|---|
2 |
#define _BLUETOOTH_IWRAP_H_
|
3 |
|
4 |
#include <amiro/bluetooth/bluetooth-transport.hpp> |
5 |
#include <amiro/bluetooth/bluetooth-profile.hpp> |
6 |
|
7 |
#if !CH_USE_QUEUES || !CH_USE_EVENTS
|
8 |
#error "Bluetooth Serial Port Profile requires CH_USE_QUEUES, CH_USE_EVENTS" |
9 |
#endif
|
10 |
|
11 |
#define BLUETOOTH_IWRAP_MAILBOX_SIZE 5 |
12 |
|
13 |
#define HOST_IWRAP_PLAIN_LINKID 0xFF |
14 |
|
15 |
namespace amiro {
|
16 |
|
17 |
class BluetoothIwrap : public chibios_rt::BaseStaticThread<128> { |
18 |
public:
|
19 |
BluetoothIwrap(UARTDriver* uart); |
20 |
|
21 |
void bluetoothIwrapSendCommand(const char* cmd); |
22 |
msg_t iwrapTransmit(uint8_t linkid, const uint8_t* txdata, size_t length);
|
23 |
|
24 |
BluetoothTransport transport; |
25 |
|
26 |
BluetoothProfile profiles[8];
|
27 |
|
28 |
protected:
|
29 |
virtual msg_t main(void); |
30 |
|
31 |
private:
|
32 |
msg_t iwrapReceive(); |
33 |
|
34 |
chibios_rt::Mailbox mailbox; |
35 |
msg_t mailboxBuffer[BLUETOOTH_IWRAP_MAILBOX_SIZE]; |
36 |
|
37 |
char connAddr[17]; |
38 |
int iwrapblock;
|
39 |
}; |
40 |
} |
41 |
|
42 |
#endif /* _BLUETOOTH_IWRAP_H_ */ |