USB Host Shield 2.0
BTD.h
Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
2 
3  This software may be distributed and modified under the terms of the GNU
4  General Public License version 2 (GPL2) as published by the Free Software
5  Foundation and appearing in the file GPL2.TXT included in the packaging of
6  this file. Please note that GPL2 Section 2[b] requires that all works based
7  on this software must also be made publicly available under the terms of
8  the GPL2 ("Copyleft").
9 
10  Contact information
11  -------------------
12 
13  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _btd_h_
19 #define _btd_h_
20 
21 #include "Usb.h"
22 #include "usbhid.h"
23 
24 //PID and VID of the Sony PS3 devices
25 #define PS3_VID 0x054C // Sony Corporation
26 #define PS3_PID 0x0268 // PS3 Controller DualShock 3
27 #define PS3NAVIGATION_PID 0x042F // Navigation controller
28 #define PS3MOVE_PID 0x03D5 // Motion controller
29 
30 // These dongles do not present themselves correctly, so we have to check for them manually
31 #define IOGEAR_GBU521_VID 0x0A5C
32 #define IOGEAR_GBU521_PID 0x21E8
33 #define BELKIN_F8T065BF_VID 0x050D
34 #define BELKIN_F8T065BF_PID 0x065A
35 
36 /* Bluetooth dongle data taken from descriptors */
37 #define BULK_MAXPKTSIZE 64 // Max size for ACL data
38 
39 // Used in control endpoint header for HCI Commands
40 #define bmREQ_HCI_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
41 
42 /* Bluetooth HCI states for hci_task() */
43 #define HCI_INIT_STATE 0
44 #define HCI_RESET_STATE 1
45 #define HCI_CLASS_STATE 2
46 #define HCI_BDADDR_STATE 3
47 #define HCI_LOCAL_VERSION_STATE 4
48 #define HCI_WRITE_NAME_STATE 5
49 #define HCI_CHECK_DEVICE_SERVICE 6
50 
51 #define HCI_INQUIRY_STATE 7 // These three states are only used if it should pair and connect to a device
52 #define HCI_CONNECT_DEVICE_STATE 8
53 #define HCI_CONNECTED_DEVICE_STATE 9
54 
55 #define HCI_SCANNING_STATE 10
56 #define HCI_CONNECT_IN_STATE 11
57 #define HCI_REMOTE_NAME_STATE 12
58 #define HCI_CONNECTED_STATE 13
59 #define HCI_DISABLE_SCAN_STATE 14
60 #define HCI_DONE_STATE 15
61 #define HCI_DISCONNECT_STATE 16
62 #define HCI_LOCAL_EXTENDED_FEATURES_STATE 17
63 #define HCI_WRITE_SIMPLE_PAIRING_STATE 18
64 #define HCI_SET_EVENT_MASK_STATE 19
65 
66 /* HCI event flags*/
67 #define HCI_FLAG_CMD_COMPLETE (1UL << 0)
68 #define HCI_FLAG_CONNECT_COMPLETE (1UL << 1)
69 #define HCI_FLAG_DISCONNECT_COMPLETE (1UL << 2)
70 #define HCI_FLAG_REMOTE_NAME_COMPLETE (1UL << 3)
71 #define HCI_FLAG_INCOMING_REQUEST (1UL << 4)
72 #define HCI_FLAG_READ_BDADDR (1UL << 5)
73 #define HCI_FLAG_READ_VERSION (1UL << 6)
74 #define HCI_FLAG_DEVICE_FOUND (1UL << 7)
75 #define HCI_FLAG_CONNECT_EVENT (1UL << 8)
76 #define HCI_FLAG_LOCAL_EXTENDED_FEATURES (1UL << 9)
77 
78 /* Macros for HCI event flag tests */
79 #define hci_check_flag(flag) (hci_event_flag & (flag))
80 #define hci_set_flag(flag) (hci_event_flag |= (flag))
81 #define hci_clear_flag(flag) (hci_event_flag &= ~(flag))
82 
83 /* HCI Events managed */
84 #define EV_INQUIRY_COMPLETE 0x01
85 #define EV_INQUIRY_RESULT 0x02
86 #define EV_CONNECT_COMPLETE 0x03
87 #define EV_INCOMING_CONNECT 0x04
88 #define EV_DISCONNECT_COMPLETE 0x05
89 #define EV_AUTHENTICATION_COMPLETE 0x06
90 #define EV_REMOTE_NAME_COMPLETE 0x07
91 #define EV_ENCRYPTION_CHANGE 0x08
92 #define EV_CHANGE_CONNECTION_LINK 0x09
93 #define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE 0x0C
94 #define EV_QOS_SETUP_COMPLETE 0x0D
95 #define EV_COMMAND_COMPLETE 0x0E
96 #define EV_COMMAND_STATUS 0x0F
97 #define EV_ROLE_CHANGED 0x12
98 #define EV_NUM_COMPLETE_PKT 0x13
99 #define EV_PIN_CODE_REQUEST 0x16
100 #define EV_LINK_KEY_REQUEST 0x17
101 #define EV_LINK_KEY_NOTIFICATION 0x18
102 #define EV_DATA_BUFFER_OVERFLOW 0x1A
103 #define EV_MAX_SLOTS_CHANGE 0x1B
104 #define EV_LOOPBACK_COMMAND 0x19
105 #define EV_PAGE_SCAN_REP_MODE 0x20
106 #define EV_READ_REMOTE_EXTENDED_FEATURES_COMPLETE 0x23
107 #define EV_EXTENDED_INQUIRY_RESULT 0x2F
108 #define EV_IO_CAPABILITY_REQUEST 0x31
109 #define EV_IO_CAPABILITY_RESPONSE 0x32
110 #define EV_USER_CONFIRMATION_REQUEST 0x33
111 #define EV_SIMPLE_PAIRING_COMPLETE 0x36
112 
113 /* Bluetooth states for the different Bluetooth drivers */
114 #define L2CAP_WAIT 0
115 #define L2CAP_DONE 1
116 
117 /* Used for HID Control channel */
118 #define L2CAP_CONTROL_CONNECT_REQUEST 2
119 #define L2CAP_CONTROL_CONFIG_REQUEST 3
120 #define L2CAP_CONTROL_SUCCESS 4
121 #define L2CAP_CONTROL_DISCONNECT 5
122 
123 /* Used for HID Interrupt channel */
124 #define L2CAP_INTERRUPT_SETUP 6
125 #define L2CAP_INTERRUPT_CONNECT_REQUEST 7
126 #define L2CAP_INTERRUPT_CONFIG_REQUEST 8
127 #define L2CAP_INTERRUPT_DISCONNECT 9
128 
129 /* Used for SDP channel */
130 #define L2CAP_SDP_WAIT 10
131 #define L2CAP_SDP_SUCCESS 11
132 
133 /* Used for RFCOMM channel */
134 #define L2CAP_RFCOMM_WAIT 12
135 #define L2CAP_RFCOMM_SUCCESS 13
136 
137 #define L2CAP_DISCONNECT_RESPONSE 14 // Used for both SDP and RFCOMM channel
138 
139 /* Bluetooth states used by some drivers */
140 #define TURN_ON_LED 17
141 #define PS3_ENABLE_SIXAXIS 18
142 #define WII_CHECK_MOTION_PLUS_STATE 19
143 #define WII_CHECK_EXTENSION_STATE 20
144 #define WII_INIT_MOTION_PLUS_STATE 21
145 
146 /* L2CAP event flags for HID Control channel */
147 #define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST (1UL << 0)
148 #define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS (1UL << 1)
149 #define L2CAP_FLAG_CONTROL_CONNECTED (1UL << 2)
150 #define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE (1UL << 3)
151 
152 /* L2CAP event flags for HID Interrupt channel */
153 #define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST (1UL << 4)
154 #define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS (1UL << 5)
155 #define L2CAP_FLAG_INTERRUPT_CONNECTED (1UL << 6)
156 #define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE (1UL << 7)
157 
158 /* L2CAP event flags for SDP channel */
159 #define L2CAP_FLAG_CONNECTION_SDP_REQUEST (1UL << 8)
160 #define L2CAP_FLAG_CONFIG_SDP_SUCCESS (1UL << 9)
161 #define L2CAP_FLAG_DISCONNECT_SDP_REQUEST (1UL << 10)
162 
163 /* L2CAP event flags for RFCOMM channel */
164 #define L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST (1UL << 11)
165 #define L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS (1UL << 12)
166 #define L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST (1UL << 13)
167 
168 #define L2CAP_FLAG_DISCONNECT_RESPONSE (1UL << 14)
169 
170 /* Macros for L2CAP event flag tests */
171 #define l2cap_check_flag(flag) (l2cap_event_flag & (flag))
172 #define l2cap_set_flag(flag) (l2cap_event_flag |= (flag))
173 #define l2cap_clear_flag(flag) (l2cap_event_flag &= ~(flag))
174 
175 /* L2CAP signaling commands */
176 #define L2CAP_CMD_COMMAND_REJECT 0x01
177 #define L2CAP_CMD_CONNECTION_REQUEST 0x02
178 #define L2CAP_CMD_CONNECTION_RESPONSE 0x03
179 #define L2CAP_CMD_CONFIG_REQUEST 0x04
180 #define L2CAP_CMD_CONFIG_RESPONSE 0x05
181 #define L2CAP_CMD_DISCONNECT_REQUEST 0x06
182 #define L2CAP_CMD_DISCONNECT_RESPONSE 0x07
183 #define L2CAP_CMD_INFORMATION_REQUEST 0x0A
184 #define L2CAP_CMD_INFORMATION_RESPONSE 0x0B
185 
186 // Used For Connection Response - Remember to Include High Byte
187 #define PENDING 0x01
188 #define SUCCESSFUL 0x00
189 
190 /* Bluetooth L2CAP PSM - see http://www.bluetooth.org/Technical/AssignedNumbers/logical_link.htm */
191 #define SDP_PSM 0x01 // Service Discovery Protocol PSM Value
192 #define RFCOMM_PSM 0x03 // RFCOMM PSM Value
193 #define HID_CTRL_PSM 0x11 // HID_Control PSM Value
194 #define HID_INTR_PSM 0x13 // HID_Interrupt PSM Value
195 
196 /* Used for SDP */
197 #define SDP_SERVICE_SEARCH_REQUEST 0x02
198 #define SDP_SERVICE_SEARCH_RESPONSE 0x03
199 #define SDP_SERVICE_ATTRIBUTE_REQUEST 0x04
200 #define SDP_SERVICE_ATTRIBUTE_RESPONSE 0x05
201 #define SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST 0x06 // See the RFCOMM specs
202 #define SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE 0x07 // See the RFCOMM specs
203 #define PNP_INFORMATION_UUID 0x1200
204 #define SERIALPORT_UUID 0x1101 // See http://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm
205 #define L2CAP_UUID 0x0100
206 
207 // Used to determine if it is a Bluetooth dongle
208 #define WI_SUBCLASS_RF 0x01 // RF Controller
209 #define WI_PROTOCOL_BT 0x01 // Bluetooth Programming Interface
210 
211 #define BTD_MAX_ENDPOINTS 4
212 #define BTD_NUM_SERVICES 4 // Max number of Bluetooth services - if you need more than 4 simply increase this number
213 
214 #define PAIR 1
215 
216 class BluetoothService;
217 
222 class BTD : public USBDeviceConfig, public UsbConfigXtracter {
223 public:
228  BTD(USB *p);
229 
238  uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed);
246  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
251  uint8_t Release();
256  uint8_t Poll();
257 
262  virtual uint8_t GetAddress() {
263  return bAddress;
264  };
265 
270  virtual bool isReady() {
271  return bPollEnable;
272  };
273 
279  virtual bool DEVCLASSOK(uint8_t klass) {
280  return (klass == USB_CLASS_WIRELESS_CTRL);
281  };
282 
290  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
291  if((vid == IOGEAR_GBU521_VID && pid == IOGEAR_GBU521_PID) || (vid == BELKIN_F8T065BF_VID && pid == BELKIN_F8T065BF_PID))
292  return true;
293  if(my_bdaddr[0] != 0x00 || my_bdaddr[1] != 0x00 || my_bdaddr[2] != 0x00 || my_bdaddr[3] != 0x00 || my_bdaddr[4] != 0x00 || my_bdaddr[5] != 0x00) { // Check if Bluetooth address is set
294  if(vid == PS3_VID && (pid == PS3_PID || pid == PS3NAVIGATION_PID || pid == PS3MOVE_PID))
295  return true;
296  }
297  return false;
298  };
310  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
314  void disconnect();
315 
322  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++) {
323  if(!btService[i]) {
324  btService[i] = pService;
325  return i; // Return ID
326  }
327  }
328  return -1; // Error registering BluetoothService
329  };
330 
337  void HCI_Command(uint8_t* data, uint16_t nbytes);
339  void hci_reset();
341  void hci_read_bdaddr();
345  void hci_read_local_extended_features(uint8_t page_number);
350  void hci_write_local_name(const char* name);
352  void hci_write_simple_pairing_mode(bool enable);
354  void hci_set_event_mask();
356  void hci_write_scan_enable();
358  void hci_write_scan_disable();
360  void hci_remote_name();
362  void hci_accept_connection();
367  void hci_disconnect(uint16_t handle);
386  void hci_inquiry();
388  void hci_inquiry_cancel();
390  void hci_connect();
397  void hci_connect(uint8_t *bdaddr);
411  void L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow = 0x01, uint8_t channelHigh = 0x00);
419  void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t* scid, uint16_t psm);
428  void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid, uint8_t result);
435  void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t* dcid);
442  void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t* scid);
450  void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);
458  void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);
465  void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh);
476 
478  const char* btdName;
480  const char* btdPin;
481 
483  uint8_t my_bdaddr[6];
485  uint16_t hci_handle;
487  uint8_t disc_bdaddr[6];
489  char remote_name[30];
495  uint8_t hci_version;
496 
499  pairWithWii = true;
500  hci_state = HCI_CHECK_DEVICE_SERVICE;
501  };
503  bool connectToWii;
512 
514  void pairWithHID() {
515  waitingForConnection = false;
516  pairWithHIDDevice = true;
517  hci_state = HCI_CHECK_DEVICE_SERVICE;
518  };
520  bool connectToHIDDevice;
525 
530  uint8_t readPollInterval() {
531  return pollInterval;
532  };
533 
535  bool useSimplePairing;
536 
537 protected:
541  uint8_t bAddress;
544 
546  uint8_t bConfNum;
548  uint8_t bNumEP;
550  uint32_t qNextPollTime;
551 
553  static const uint8_t BTD_CONTROL_PIPE;
555  static const uint8_t BTD_EVENT_PIPE;
557  static const uint8_t BTD_DATAIN_PIPE;
559  static const uint8_t BTD_DATAOUT_PIPE;
560 
566 
567 private:
568  void Initialize(); // Set all variables, endpoint structs etc. to default values
570 
571  uint16_t PID, VID; // PID and VID of device connected
572 
573  uint8_t pollInterval;
574  bool simple_pairing_supported;
575  bool bPollEnable;
576 
577  bool pairWiiUsingSync; // True if pairing was done using the Wii SYNC button.
578  bool checkRemoteName; // Used to check remote device's name before connecting.
579  bool incomingPSController; // True if a PS4/PS5 controller is connecting
580  uint8_t classOfDevice[3]; // Class of device of last device
581 
582  /* Variables used by high level HCI task */
583  uint8_t hci_state; // Current state of Bluetooth HCI connection
584  uint16_t hci_counter; // Counter used for Bluetooth HCI reset loops
585  uint16_t hci_num_reset_loops; // This value indicate how many times it should read before trying to reset
586  uint16_t hci_event_flag; // HCI flags of received Bluetooth events
587  uint8_t inquiry_counter;
588 
589  uint8_t hcibuf[BULK_MAXPKTSIZE]; // General purpose buffer for HCI data
590  uint8_t l2capinbuf[BULK_MAXPKTSIZE]; // General purpose buffer for L2CAP in data
591  uint8_t l2capoutbuf[14]; // General purpose buffer for L2CAP out data
592 
593  /* State machines */
594  void HCI_event_task(); // Poll the HCI event pipe
595  void HCI_task(); // HCI state machine
596  void ACL_event_task(); // ACL input pipe
597 
598  /* Used to set the Bluetooth Address internally to the PS3 Controllers */
599  void setBdaddr(uint8_t* BDADDR);
600  void setMoveBdaddr(uint8_t* BDADDR);
601 };
602 
605 public:
607  if(pBtd)
608  pBtd->registerBluetoothService(this); // Register it as a Bluetooth service
609  };
614  virtual void ACLData(uint8_t* ACLData) = 0;
616  virtual void Run() = 0;
618  virtual void Reset() = 0;
620  virtual void disconnect() = 0;
621 
626  void attachOnInit(void (*funcOnInit)(void)) {
627  pFuncOnInit = funcOnInit; // TODO: This really belong in a class of it's own as it is repeated several times
628  };
629 
630 protected:
636  virtual void onInit() = 0;
637 
639  bool checkHciHandle(uint8_t *buf, uint16_t handle) {
640  return (buf[0] == (handle & 0xFF)) && (buf[1] == ((handle >> 8) | 0x20));
641  }
642 
644  void (*pFuncOnInit)(void);
645 
648 
650  uint16_t hci_handle;
651 
654 
656  uint8_t identifier;
657 };
658 
659 #endif
BTD::hci_disconnect
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1404
BTD::bConfNum
uint8_t bConfNum
Definition: BTD.h:546
BTD::hci_read_bdaddr
void hci_read_bdaddr()
Definition: BTD.cpp:1149
BTD::hci_write_scan_disable
void hci_write_scan_disable()
Definition: BTD.cpp:1140
USBDeviceConfig
Definition: UsbCore.h:136
BTD::BTD_CONTROL_PIPE
static const uint8_t BTD_CONTROL_PIPE
Definition: BTD.h:553
BTD::hci_write_local_name
void hci_write_local_name(const char *name)
Definition: BTD.cpp:1212
BTD::L2CAP_Command
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1452
BTD::hci_accept_connection
void hci_accept_connection()
Definition: BTD.cpp:1177
BTD::l2cap_config_request
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1510
HCI_CHECK_DEVICE_SERVICE
#define HCI_CHECK_DEVICE_SERVICE
Definition: BTD.h:49
BTD::hci_read_local_version_information
void hci_read_local_version_information()
Definition: BTD.cpp:1158
BluetoothService::Reset
virtual void Reset()=0
BTD::incomingWii
bool incomingWii
Definition: BTD.h:505
PS3MOVE_PID
#define PS3MOVE_PID
Definition: BTD.h:28
BTD::epInfo
EpInfo epInfo[BTD_MAX_ENDPOINTS]
Definition: BTD.h:543
USB_ENDPOINT_DESCRIPTOR
Definition: usb_ch9.h:148
UsbConfigXtracter
Definition: confdescparser.h:30
BTD_NUM_SERVICES
#define BTD_NUM_SERVICES
Definition: BTD.h:212
BTD::bNumEP
uint8_t bNumEP
Definition: BTD.h:548
BTD::DEVCLASSOK
virtual bool DEVCLASSOK(uint8_t klass)
Definition: BTD.h:279
BluetoothService::ACLData
virtual void ACLData(uint8_t *ACLData)=0
usbhid.h
BTD::connectToWii
bool connectToWii
Definition: BTD.h:501
BTD::registerBluetoothService
int8_t registerBluetoothService(BluetoothService *pService)
Definition: BTD.h:321
IOGEAR_GBU521_PID
#define IOGEAR_GBU521_PID
Definition: BTD.h:32
BTD::hci_write_class_of_device
void hci_write_class_of_device()
Definition: BTD.cpp:1416
BTD::pairWithWiimote
void pairWithWiimote()
Definition: BTD.h:498
BTD
Definition: BTD.h:222
BluetoothService::disconnect
virtual void disconnect()=0
BTD::hci_read_local_extended_features
void hci_read_local_extended_features(uint8_t page_number)
Definition: BTD.cpp:1167
BTD::btdPin
const char * btdPin
Definition: BTD.h:480
BTD::GetAddress
virtual uint8_t GetAddress()
Definition: BTD.h:262
BTD::hci_remote_name
void hci_remote_name()
Definition: BTD.cpp:1193
PS3_VID
#define PS3_VID
Definition: BTD.h:25
USB_CLASS_WIRELESS_CTRL
#define USB_CLASS_WIRELESS_CTRL
Definition: UsbCore.h:86
BTD::hci_user_confirmation_request_reply
void hci_user_confirmation_request_reply()
Definition: BTD.cpp:1380
BTD::HCI_Command
void HCI_Command(uint8_t *data, uint16_t nbytes)
Definition: BTD.cpp:1113
BTD::isReady
virtual bool isReady()
Definition: BTD.h:270
BELKIN_F8T065BF_PID
#define BELKIN_F8T065BF_PID
Definition: BTD.h:34
BTD::motionPlusInside
bool motionPlusInside
Definition: BTD.h:509
BTD::l2cap_config_response
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1527
BTD::BTD
BTD(USB *p)
Definition: BTD.cpp:27
BTD::hci_pin_code_request_reply
void hci_pin_code_request_reply()
Definition: BTD.cpp:1299
BTD::pUsb
USB * pUsb
Definition: BTD.h:539
BluetoothService::l2cap_event_flag
uint32_t l2cap_event_flag
Definition: BTD.h:653
BTD::BTD_DATAIN_PIPE
static const uint8_t BTD_DATAIN_PIPE
Definition: BTD.h:557
BluetoothService::pBtd
BTD * pBtd
Definition: BTD.h:647
BTD::hci_write_scan_enable
void hci_write_scan_enable()
Definition: BTD.cpp:1127
BTD::useSimplePairing
bool useSimplePairing
Definition: BTD.h:532
BTD::remote_name
char remote_name[30]
Definition: BTD.h:489
BTD::disconnect
void disconnect()
Definition: BTD.cpp:397
BTD::BTD_DATAOUT_PIPE
static const uint8_t BTD_DATAOUT_PIPE
Definition: BTD.h:559
BTD::readPollInterval
uint8_t readPollInterval()
Definition: BTD.h:530
EpInfo
Definition: address.h:39
BTD::l2cap_information_response
void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)
Definition: BTD.cpp:1572
BTD::hci_reset
void hci_reset()
Definition: BTD.cpp:1118
BTD::connectToHIDDevice
bool connectToHIDDevice
Definition: BTD.h:518
BTD::hci_connect
void hci_connect()
Definition: BTD.cpp:1273
BTD::sdpConnectionClaimed
bool sdpConnectionClaimed
Definition: BTD.h:473
BTD::l2cap_disconnection_response
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1559
BTD::hci_version
uint8_t hci_version
Definition: BTD.h:495
BTD::incomingHIDDevice
bool incomingHIDDevice
Definition: BTD.h:522
BTD::l2cap_connection_request
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
Definition: BTD.cpp:1480
BTD::qNextPollTime
uint32_t qNextPollTime
Definition: BTD.h:550
BluetoothService::identifier
uint8_t identifier
Definition: BTD.h:656
USB
Definition: UsbCore.h:212
BTD::bAddress
uint8_t bAddress
Definition: BTD.h:541
BTD::rfcommConnectionClaimed
bool rfcommConnectionClaimed
Definition: BTD.h:475
BTD::btdName
const char * btdName
Definition: BTD.h:478
BTD::hci_pin_code_negative_request_reply
void hci_pin_code_negative_request_reply()
Definition: BTD.cpp:1335
BTD::pairWithHID
void pairWithHID()
Definition: BTD.h:514
BTD::PrintEndpointDescriptor
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: BTD.cpp:360
BTD::l2cap_disconnection_request
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1546
PS3NAVIGATION_PID
#define PS3NAVIGATION_PID
Definition: BTD.h:27
BTD::pairWithWii
bool pairWithWii
Definition: BTD.h:507
BTD::VIDPIDOK
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: BTD.h:290
BTD::Init
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: BTD.cpp:136
BTD_MAX_ENDPOINTS
#define BTD_MAX_ENDPOINTS
Definition: BTD.h:211
BluetoothService::attachOnInit
void attachOnInit(void(*funcOnInit)(void))
Definition: BTD.h:626
BTD::waitingForConnection
bool waitingForConnection
Definition: BTD.h:469
BTD::hci_link_key_request_negative_reply
void hci_link_key_request_negative_reply()
Definition: BTD.cpp:1349
BTD::hci_inquiry_cancel
void hci_inquiry_cancel()
Definition: BTD.cpp:1265
BluetoothService::pFuncOnInit
void(* pFuncOnInit)(void)
Definition: BTD.h:644
BTD::EndpointXtract
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: BTD.cpp:330
BluetoothService::hci_handle
uint16_t hci_handle
Definition: BTD.h:650
BluetoothService::checkHciHandle
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:639
BTD::BTD_EVENT_PIPE
static const uint8_t BTD_EVENT_PIPE
Definition: BTD.h:555
IOGEAR_GBU521_VID
#define IOGEAR_GBU521_VID
Definition: BTD.h:31
BluetoothService::Run
virtual void Run()=0
BTD::my_bdaddr
uint8_t my_bdaddr[6]
Definition: BTD.h:483
BTD::hci_set_event_mask
void hci_set_event_mask()
Definition: BTD.cpp:1224
BTD::hci_authentication_request
void hci_authentication_request()
Definition: BTD.cpp:1394
BluetoothService
Definition: BTD.h:604
BTD::Poll
uint8_t Poll()
Definition: BTD.cpp:385
BTD::hci_write_simple_pairing_mode
void hci_write_simple_pairing_mode(bool enable)
Definition: BTD.cpp:1242
BTD::Release
uint8_t Release()
Definition: BTD.cpp:379
BTD::hci_io_capability_request_reply
void hci_io_capability_request_reply()
Definition: BTD.cpp:1363
PS3_PID
#define PS3_PID
Definition: BTD.h:26
Usb.h
BTD::disc_bdaddr
uint8_t disc_bdaddr[6]
Definition: BTD.h:487
BTD::l2capConnectionClaimed
bool l2capConnectionClaimed
Definition: BTD.h:471
BTD::l2cap_connection_response
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1493
BTD::pairWithHIDDevice
bool pairWithHIDDevice
Definition: BTD.h:524
BluetoothService::BluetoothService
BluetoothService(BTD *p)
Definition: BTD.h:606
BTD::hci_handle
uint16_t hci_handle
Definition: BTD.h:485
BELKIN_F8T065BF_VID
#define BELKIN_F8T065BF_VID
Definition: BTD.h:33
BULK_MAXPKTSIZE
#define BULK_MAXPKTSIZE
Definition: BTD.h:37
BluetoothService::onInit
virtual void onInit()=0
BTD::ConfigureDevice
uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: BTD.cpp:50
BTD::wiiUProController
bool wiiUProController
Definition: BTD.h:511
BTD::hci_inquiry
void hci_inquiry()
Definition: BTD.cpp:1251