1 /* 2 * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef _BTHCI_H_ 6 #define _BTHCI_H_ 7 8 /* typedefs */ 9 typedef int32 hci_id; 10 #define HCI_DEVICE_INDEX_OFFSET 0x7c 11 12 typedef enum { H2 = 2, H3, H4, H5 } transport_type; 13 14 typedef enum { BT_COMMAND = 0, 15 BT_EVENT, 16 BT_ACL, 17 BT_SCO, 18 BT_ESCO, 19 // more packets here 20 HCI_NUM_PACKET_TYPES 21 } bt_packet_t; 22 23 const char* BluetoothCommandOpcode(uint16 opcode); 24 const char* BluetoothEvent(uint8 event); 25 const char* BluetoothManufacturer(uint16 manufacturer); 26 const char* BluetoothHciVersion(uint16 ver); 27 const char* BluetoothLmpVersion(uint16 ver); 28 const char* BluetoothError(uint8 error); 29 30 /* packets sizes */ 31 #define HCI_MAX_ACL_SIZE 1024 32 #define HCI_MAX_SCO_SIZE 255 33 #define HCI_MAX_EVENT_SIZE 260 34 #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) 35 36 /* fields sizes */ 37 #define HCI_LAP_SIZE 3 /* LAP */ 38 #define HCI_LINK_KEY_SIZE 16 /* link key */ 39 #define HCI_PIN_SIZE 16 /* PIN */ 40 #define HCI_EVENT_MASK_SIZE 8 /* event mask */ 41 #define HCI_CLASS_SIZE 3 /* class */ 42 #define HCI_FEATURES_SIZE 8 /* LMP features */ 43 #define HCI_DEVICE_NAME_SIZE 248 /* unit name size */ 44 45 /* Device drivers need to take this into account 46 * when receiving ioctls. Only applies to R5 builds 47 * in deprecation process 48 */ 49 #define BT_IOCTLS_PASS_SIZE 50 51 #endif // _BTHCI_H_ 52