btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / bluetooth / CodeHandler.h
blob033e57829dd6f02185481a16ec31a1ba08ac8705
1 #ifndef _CODEHANDLER_H_
2 #define _CODEHANDLER_H_
4 #include <bluetooth/HCI/btHCI.h>
6 namespace Bluetooth
9 class CodeHandler {
11 public:
13 * TODO: Handler and protocol could be fit in 16 bits 12
14 * for handler and 4 for the protocol
18 * Used:
19 * - From HCI layer to send events to bluetooth server.
20 * - L2cap lower to dispatch TX packets to HCI Layer
21 * - informing about connection handle
22 * - Transport drivers dispatch its data to HCI layer
25 static hci_id Device(uint32 code)
27 return ((code & 0xFF000000) >> 24);
31 static void SetDevice(uint32* code, hci_id device)
33 *code = *code | ((device & 0xFF) << 24);
37 static uint16 Handler(uint32 code)
39 return ((code & 0xFFFF) >> 0);
43 static void SetHandler(uint32* code, uint16 handler)
45 *code = *code | ((handler & 0xFFFF) << 0);
49 static bt_packet_t Protocol(uint32 code)
51 return (bt_packet_t)((code & 0xFF0000) >> 16);
55 static void SetProtocol(uint32* code, bt_packet_t protocol)
57 *code = *code | ((protocol & 0xFF) << 16);
64 } // namespace
67 #endif