USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Public Attributes | Protected Attributes | List of all members
BTHID Class Reference

#include <BTHID.h>

Inheritance diagram for BTHID:
Inheritance graph
[legend]
Collaboration diagram for BTHID:
Collaboration graph
[legend]

Public Member Functions

 BTHID (BTD *p, bool pair=false, const char *pin="0000")
 
HIDReportParserGetReportParser (uint8_t id)
 
bool SetReportParser (uint8_t id, HIDReportParser *prs)
 
void setProtocolMode (uint8_t mode)
 
void setLeds (uint8_t data)
 
void pair (void)
 
void attachOnInit (void(*funcOnInit)(void))
 
BluetoothService implementation
virtual void ACLData (uint8_t *ACLData)
 
virtual void Run ()
 
virtual void Reset ()
 
virtual void disconnect ()
 

Public Attributes

bool connected
 

Protected Member Functions

Overridable functions
virtual void ParseBTHIDData (uint8_t len, uint8_t *buf)
 
virtual void OnInitBTHID ()
 
virtual void ResetBTHID ()
 

Protected Attributes

BTDpBtd
 
uint16_t hci_handle
 
uint8_t control_scid [2]
 
uint8_t interrupt_scid [2]
 

Detailed Description

This BluetoothService class implements support for Bluetooth HID devices.

Definition at line 29 of file BTHID.h.

Constructor & Destructor Documentation

BTHID::BTHID ( BTD p,
bool  pair = false,
const char *  pin = "0000" 
)

Constructor for the BTHID class.

Parameters
pPointer to the BTD class instance.
pairSet 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.
pinWrite the pin to BTD::btdPin. If argument is omitted, then "0000" will be used.

Definition at line 23 of file BTHID.cpp.

Member Function Documentation

void BTHID::ACLData ( uint8_t *  ACLData)
virtual

Used to pass acldata to the services.

Parameters
ACLDataIncoming acldata.

Reimplemented from BluetoothService.

Definition at line 59 of file BTHID.cpp.

void BTHID::Run ( )
virtual

Used to run part of the state machine.

Reimplemented from BluetoothService.

Definition at line 347 of file BTHID.cpp.

void BTHID::Reset ( )
virtual

Use this to reset the service.

Reimplemented from BluetoothService.

Definition at line 44 of file BTHID.cpp.

void BTHID::disconnect ( )
virtual

Used this to disconnect the devices.

Reimplemented from BluetoothService.

Definition at line 52 of file BTHID.cpp.

HIDReportParser* BTHID::GetReportParser ( uint8_t  id)
inline

Get HIDReportParser.

Parameters
idID of parser.
Returns
Returns the corresponding HIDReportParser. Returns NULL if id is not valid.

Definition at line 58 of file BTHID.h.

bool BTHID::SetReportParser ( uint8_t  id,
HIDReportParser prs 
)
inline

Set HIDReportParser to be used.

Parameters
idId of parser.
prsPointer to HIDReportParser.
Returns
Returns true if the HIDReportParser is set. False otherwise.

Definition at line 70 of file BTHID.h.

void BTHID::setProtocolMode ( uint8_t  mode)
inline

Set HID protocol mode.

Parameters
modeHID protocol to use. Either HID_BOOT_PROTOCOL or HID_RPT_PROTOCOL.

Definition at line 81 of file BTHID.h.

void BTHID::setLeds ( uint8_t  data)

Used to set the leds on a keyboard.

Parameters
dataSee KBDLEDS in hidboot.h

Definition at line 396 of file BTHID.cpp.

void BTHID::pair ( void  )
inline

Call this to start the paring sequence with a device

Definition at line 95 of file BTHID.h.

void BTHID::attachOnInit ( void(*)(void)  funcOnInit)
inline

Used to call your own function when the device is successfully initialized.

Parameters
funcOnInitFunction to call.

Definition at line 104 of file BTHID.h.

virtual void BTHID::ParseBTHIDData ( uint8_t  len,
uint8_t *  buf 
)
inlineprotectedvirtual

Used to parse Bluetooth HID data to any class that inherits this class.

Parameters
lenThe length of the incoming data.
bufPointer to the data buffer.

Reimplemented in PS4BT.

Definition at line 115 of file BTHID.h.

virtual void BTHID::OnInitBTHID ( )
inlineprotectedvirtual

Called when a device is connected

Reimplemented in PS4BT.

Definition at line 119 of file BTHID.h.

virtual void BTHID::ResetBTHID ( )
inlineprotectedvirtual

Used to reset any buffers in the class that inherits this

Reimplemented in PS4BT.

Definition at line 123 of file BTHID.h.

Member Data Documentation

bool BTHID::connected

True if a device is connected

Definition at line 92 of file BTHID.h.

BTD* BTHID::pBtd
protected

Pointer to BTD instance

Definition at line 129 of file BTHID.h.

uint16_t BTHID::hci_handle
protected

HCI Handle for connection

Definition at line 132 of file BTHID.h.

uint8_t BTHID::control_scid[2]
protected

L2CAP source CID for HID_Control

Definition at line 136 of file BTHID.h.

uint8_t BTHID::interrupt_scid[2]
protected

L2CAP source CID for HID_Interrupt

Definition at line 139 of file BTHID.h.


The documentation for this class was generated from the following files: