Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UsbHostMAX3421E_Hello
BTHID Class Reference
This BluetoothService class implements support for Bluetooth HID devices. More...
#include <BTHID.h>
Inherits BluetoothService.
Inherited by PS4BT.
Public Member Functions | |
| BTHID (BTD *p, bool pair=false, const char *pin="0000") | |
| Constructor for the BTHID class. | |
| HIDReportParser * | GetReportParser (uint8_t id) |
| Get HIDReportParser. | |
| bool | SetReportParser (uint8_t id, HIDReportParser *prs) |
| Set HIDReportParser to be used. | |
| void | setProtocolMode (uint8_t mode) |
| Set HID protocol mode. | |
| void | pair (void) |
| Call this to start the pairing sequence with a device. | |
| void | attachOnInit (void(*funcOnInit)(void)) |
| Used to call your own function when the device is successfully initialized. | |
| void | setLeds (struct KBDLEDS data) |
| Used to set the leds on a keyboard. | |
Data Fields | |
| bool | connected |
| True if a device is connected. | |
Protected Member Functions | |
| bool | checkHciHandle (uint8_t *buf, uint16_t handle) |
| Used to check if the incoming L2CAP data matches the HCI Handle. | |
Overridable functions | |
| virtual void | ParseBTHIDData (uint8_t len __attribute__((unused)), uint8_t *buf __attribute__((unused))) |
| Used to parse Bluetooth HID data to any class that inherits this class. | |
| virtual void | OnInitBTHID () |
| Called when a device is connected. | |
| virtual void | ResetBTHID () |
| Used to reset any buffers in the class that inherits this. | |
Protected Attributes | |
| uint8_t | control_scid [2] |
| L2CAP source CID for HID_Control. | |
| uint8_t | interrupt_scid [2] |
| L2CAP source CID for HID_Interrupt. | |
| void(* | pFuncOnInit )(void) |
| Pointer to function called in onInit(). | |
| BTD * | pBtd |
| Pointer to BTD instance. | |
| uint16_t | hci_handle |
| The HCI Handle for the connection. | |
| uint32_t | l2cap_event_flag |
| L2CAP flags of received Bluetooth events. | |
| uint8_t | identifier |
| Identifier for L2CAP commands. | |
BluetoothService implementation | |
| void | disconnect () |
| Used this to disconnect the devices. | |
| void | ACLData (uint8_t *ACLData) |
| Used to pass acldata to the services. | |
| void | Run () |
| Used to run part of the state machine. | |
| void | Reset () |
| Use this to reset the service. | |
| void | onInit () |
| Called when a device is successfully initialized. | |
Detailed Description
This BluetoothService class implements support for Bluetooth HID devices.
Definition at line 29 of file BTHID.h.
Constructor & Destructor Documentation
Constructor for the BTHID class.
- Parameters:
-
p Pointer to the BTD class instance. pair Set this to true in order to pair with the device. If the argument is omitted then it will not pair with it. One can use PAIR to set it to true. pin Write the pin to BTD::btdPin. If argument is omitted, then "0000" will be used.
Member Function Documentation
| void ACLData | ( | uint8_t * | ACLData ) | [protected, virtual] |
Used to pass acldata to the services.
- Parameters:
-
ACLData Incoming acldata.
Implements BluetoothService.
| void attachOnInit | ( | void(*)(void) | funcOnInit ) | [inherited] |
| bool checkHciHandle | ( | uint8_t * | buf, |
| uint16_t | handle | ||
| ) | [protected, inherited] |
| void disconnect | ( | ) | [virtual] |
Used this to disconnect the devices.
Implements BluetoothService.
| HIDReportParser* GetReportParser | ( | uint8_t | id ) |
| void onInit | ( | ) | [protected, virtual] |
Called when a device is successfully initialized.
Use attachOnInit(void (*funcOnInit)(void)) to call your own function. This is useful for instance if you want to set the LEDs in a specific way.
Implements BluetoothService.
| virtual void OnInitBTHID | ( | ) | [protected, virtual] |
| void pair | ( | void | ) |
| virtual void ParseBTHIDData | ( | uint8_t len | __attribute__(unused), |
| uint8_t *buf | __attribute__(unused) | ||
| ) | [protected, virtual] |
| void Reset | ( | ) | [protected, virtual] |
Use this to reset the service.
Implements BluetoothService.
| virtual void ResetBTHID | ( | ) | [protected, virtual] |
| void Run | ( | ) | [protected, virtual] |
Used to run part of the state machine.
Implements BluetoothService.
| void setLeds | ( | struct KBDLEDS | data ) |
| void setProtocolMode | ( | uint8_t | mode ) |
| bool SetReportParser | ( | uint8_t | id, |
| HIDReportParser * | prs | ||
| ) |
Field Documentation
uint8_t control_scid[2] [protected] |
uint16_t hci_handle [protected, inherited] |
uint8_t identifier [protected, inherited] |
uint8_t interrupt_scid[2] [protected] |
uint32_t l2cap_event_flag [protected, inherited] |
void(* pFuncOnInit)(void) [protected, inherited] |
Generated on Tue Jul 12 2022 18:12:05 by
1.7.2