esp-nimble-cpp  1.4.1
NimBLEHIDDevice Class Reference

A model of a BLE Human Interface Device. More...

Public Member Functions

 NimBLEHIDDevice (NimBLEServer *)
 Construct a default NimBLEHIDDevice object. More...
 
void reportMap (uint8_t *map, uint16_t)
 Set the report map data formatting information. More...
 
void startServices ()
 Start the HID device services.
This function called when all the services have been created.
 
NimBLEServicedeviceInfo ()
 Returns a pointer to the device information service.
 
NimBLEServicehidService ()
 Returns a pointer to the HID service.
 
NimBLEServicebatteryService ()
 Returns a pointer to the battery service.
 
NimBLECharacteristicmanufacturer ()
 Create a manufacturer characteristic (this characteristic is optional).
 
void manufacturer (std::string name)
 Set manufacturer name. More...
 
void pnp (uint8_t sig, uint16_t vid, uint16_t pid, uint16_t version)
 Sets the Plug n Play characteristic value. More...
 
void hidInfo (uint8_t country, uint8_t flags)
 Sets the HID Information characteristic value. More...
 
void setBatteryLevel (uint8_t level)
 Set the battery level characteristic value. More...
 
NimBLECharacteristichidControl ()
 Returns a pointer to the HID control point characteristic.
 
NimBLECharacteristicinputReport (uint8_t reportID)
 Create input report characteristic. More...
 
NimBLECharacteristicoutputReport (uint8_t reportID)
 Create output report characteristic. More...
 
NimBLECharacteristicfeatureReport (uint8_t reportID)
 Create feature report characteristic. More...
 
NimBLECharacteristicprotocolMode ()
 Returns a pointer to the protocol mode characteristic.
 
NimBLECharacteristicbootInput ()
 Creates a keyboard boot input report characteristic.
 
NimBLECharacteristicbootOutput ()
 Create a keyboard boot output report characteristic.
 

Detailed Description

A model of a BLE Human Interface Device.

Constructor & Destructor Documentation

◆ NimBLEHIDDevice()

NimBLEHIDDevice::NimBLEHIDDevice ( NimBLEServer server)

Construct a default NimBLEHIDDevice object.

Parameters
[in]serverA pointer to the server instance this HID Device will use.

Member Function Documentation

◆ featureReport()

NimBLECharacteristic * NimBLEHIDDevice::featureReport ( uint8_t  reportID)

Create feature report characteristic.

Parameters
[in]reportIDFeature report ID, the same as in report map for feature object related to the characteristic
Returns
Pointer to new feature report characteristic

◆ hidInfo()

void NimBLEHIDDevice::hidInfo ( uint8_t  country,
uint8_t  flags 
)

Sets the HID Information characteristic value.

Parameters
[in]countryThe country code for the device.
[in]flagsThe HID Class Specification release number to use.

◆ inputReport()

NimBLECharacteristic * NimBLEHIDDevice::inputReport ( uint8_t  reportID)

Create input report characteristic.

Parameters
[in]reportIDinput report ID, the same as in report map for input object related to the characteristic
Returns
pointer to new input report characteristic

◆ manufacturer()

void NimBLEHIDDevice::manufacturer ( std::string  name)

Set manufacturer name.

Parameters
[in]nameThe manufacturer name of this HID device.

◆ outputReport()

NimBLECharacteristic * NimBLEHIDDevice::outputReport ( uint8_t  reportID)

Create output report characteristic.

Parameters
[in]reportIDOutput report ID, the same as in report map for output object related to the characteristic
Returns
Pointer to new output report characteristic

◆ pnp()

void NimBLEHIDDevice::pnp ( uint8_t  sig,
uint16_t  vid,
uint16_t  pid,
uint16_t  version 
)

Sets the Plug n Play characteristic value.

Parameters
[in]sigThe vendor ID source number.
[in]vidThe vendor ID number.
[in]pidThe product ID number.
[in]versionThe produce version number.

◆ reportMap()

void NimBLEHIDDevice::reportMap ( uint8_t *  map,
uint16_t  size 
)

Set the report map data formatting information.

Parameters
[in]mapA pointer to an array with the values to set.
[in]sizeThe number of values in the array.

◆ setBatteryLevel()

void NimBLEHIDDevice::setBatteryLevel ( uint8_t  level)

Set the battery level characteristic value.

Parameters
[in]levelThe battery level value.