ble nano hid over gatt
Dependencies: BLE_API mbed-dev nRF51822
Diff: HIDServiceBase.cpp
- Revision:
- 85:e526a89a0674
- Parent:
- 83:2e940d154f8b
- Child:
- 86:e0fab77e669d
--- a/HIDServiceBase.cpp Sun Sep 04 17:22:20 2016 +0900 +++ b/HIDServiceBase.cpp Thu Sep 15 08:48:57 2016 +0900 @@ -37,7 +37,21 @@ &featureReportReferenceDescriptor, }; -static const HID_information_t HID_information = {HID_VERSION_1_11, 0x00, 0x03}; +// static const uint16_t reportMapExternalReportReferenceData = GattCharacteristic::UUID_BATTERY_LEVEL_CHAR; +static const uint8_t reportMapExternalReportReferenceData[] = { 0x2A, 0x19 }; +static const GattAttribute reportMapExternalReportReferenceDescriptor(BLE_UUID_DESCRIPTOR_EXTERNAL_REPORT_REFERENCE, (uint8_t *)&reportMapExternalReportReferenceData, 2, 2, false); +static const GattAttribute * reportMapDescriptors[] = { + &reportMapExternalReportReferenceDescriptor, +}; + +#define HID_REMOTE_WAKE_Pos 0 +#define HID_NORMALLY_CONNECTABLE_Pos 1 +static const HID_information_t HID_information = { + HID_VERSION_1_11, + 0x00, + (1<<HID_REMOTE_WAKE_Pos) | + (0<<HID_NORMALLY_CONNECTABLE_Pos) +}; HIDServiceBase::HIDServiceBase( BLE &_ble, @@ -106,7 +120,7 @@ GattCharacteristic::UUID_REPORT_MAP_CHAR, const_cast<uint8_t*>(reportMap), reportMapLength, reportMapLength, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ, - NULL, 0 + const_cast<GattAttribute**>(reportMapDescriptors), 1 ), HIDInformationCharacteristic( @@ -124,10 +138,10 @@ void HIDServiceBase::init(void) { static GattCharacteristic *characteristics[] = { - &HIDInformationCharacteristic, &reportMapCharacteristic, &protocolModeCharacteristic, &HIDControlPointCharacteristic, + &HIDInformationCharacteristic, NULL, NULL, NULL,