|
|
@@ -168,7 +168,9 @@ static const uint8_t hidReportMap[] = {
|
|
|
0x81, 0x00, // Input (Data, Ary, Abs)
|
|
|
0xC0, // End Collection
|
|
|
0x81, 0x03, // Input (Const, Var, Abs)
|
|
|
- 0xC0, // End Collection
|
|
|
+ 0xC0, // End Collectionq
|
|
|
+
|
|
|
+#if (SUPPORT_REPORT_VENDOR == true)
|
|
|
0x06, 0xFF, 0xFF, // Usage Page(Vendor defined)
|
|
|
0x09, 0xA5, // Usage(Vendor Defined)
|
|
|
0xA1, 0x01, // Collection(Application)
|
|
|
@@ -179,6 +181,8 @@ static const uint8_t hidReportMap[] = {
|
|
|
0x95, 0x7F, // Report Count = 127 Btyes
|
|
|
0x91, 0x02, // Output(Data, Variable, Absolute)
|
|
|
0xC0, // End Collection
|
|
|
+#endif
|
|
|
+
|
|
|
};
|
|
|
|
|
|
/// Battery Service Attributes Indexes
|
|
|
@@ -239,8 +243,11 @@ static uint8_t hidReportRefKeyIn[HID_REPORT_REF_LEN] =
|
|
|
static uint8_t hidReportRefLedOut[HID_REPORT_REF_LEN] =
|
|
|
{ HID_RPT_ID_LED_OUT, HID_REPORT_TYPE_OUTPUT };
|
|
|
|
|
|
+#if (SUPPORT_REPORT_VENDOR == true)
|
|
|
+
|
|
|
static uint8_t hidReportRefVendorOut[HID_REPORT_REF_LEN] =
|
|
|
{HID_RPT_ID_VENDOR_OUT, HID_REPORT_TYPE_OUTPUT};
|
|
|
+#endif
|
|
|
|
|
|
// HID Report Reference characteristic descriptor, Feature
|
|
|
static uint8_t hidReportRefFeature[HID_REPORT_REF_LEN] =
|
|
|
@@ -436,6 +443,7 @@ static esp_gatts_attr_db_t hidd_le_gatt_db[HIDD_LE_IDX_NB] =
|
|
|
ESP_GATT_PERM_READ,
|
|
|
sizeof(hidReportRefLedOut), sizeof(hidReportRefLedOut),
|
|
|
hidReportRefLedOut}},
|
|
|
+#if (SUPPORT_REPORT_VENDOR == true)
|
|
|
// Report Characteristic Declaration
|
|
|
[HIDD_LE_IDX_REPORT_VENDOR_OUT_CHAR] = {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid,
|
|
|
ESP_GATT_PERM_READ,
|
|
|
@@ -449,8 +457,8 @@ static esp_gatts_attr_db_t hidd_le_gatt_db[HIDD_LE_IDX_NB] =
|
|
|
ESP_GATT_PERM_READ,
|
|
|
sizeof(hidReportRefVendorOut), sizeof(hidReportRefVendorOut),
|
|
|
hidReportRefVendorOut}},
|
|
|
-
|
|
|
- // Report Characteristic Declaration
|
|
|
+#endif
|
|
|
+ // Report Characteristic Declaration
|
|
|
[HIDD_LE_IDX_REPORT_CC_IN_CHAR] = {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid,
|
|
|
ESP_GATT_PERM_READ,
|
|
|
CHAR_DECLARATION_SIZE, CHAR_DECLARATION_SIZE,
|
|
|
@@ -462,7 +470,7 @@ static esp_gatts_attr_db_t hidd_le_gatt_db[HIDD_LE_IDX_NB] =
|
|
|
NULL}},
|
|
|
// Report KEY INPUT Characteristic - Client Characteristic Configuration Descriptor
|
|
|
[HIDD_LE_IDX_REPORT_CC_IN_CCC] = {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_client_config_uuid,
|
|
|
- (ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE),
|
|
|
+ (ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE_ENCRYPTED),
|
|
|
sizeof(uint16_t), 0,
|
|
|
NULL}},
|
|
|
// Report Characteristic - Report Reference Descriptor
|
|
|
@@ -538,6 +546,7 @@ void esp_hidd_prf_cb_hdl(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if,
|
|
|
{
|
|
|
switch(event) {
|
|
|
case ESP_GATTS_REG_EVT: {
|
|
|
+ esp_ble_gap_config_local_icon (ESP_BLE_APPEARANCE_GENERIC_HID);
|
|
|
esp_hidd_cb_param_t hidd_param;
|
|
|
hidd_param.init_finish.state = param->reg.status;
|
|
|
if(param->reg.app_id == HIDD_APP_ID) {
|
|
|
@@ -584,6 +593,7 @@ void esp_hidd_prf_cb_hdl(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if,
|
|
|
case ESP_GATTS_CLOSE_EVT:
|
|
|
break;
|
|
|
case ESP_GATTS_WRITE_EVT: {
|
|
|
+#if (SUPPORT_REPORT_VENDOR == true)
|
|
|
esp_hidd_cb_param_t cb_param = {0};
|
|
|
if (param->write.handle == hidd_le_env.hidd_inst.att_tbl[HIDD_LE_IDX_REPORT_VENDOR_OUT_VAL] &&
|
|
|
hidd_le_env.hidd_cb != NULL) {
|
|
|
@@ -593,6 +603,7 @@ void esp_hidd_prf_cb_hdl(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if,
|
|
|
cb_param.vendor_write.data = param->write.value;
|
|
|
(hidd_le_env.hidd_cb)(ESP_HIDD_EVENT_BLE_VENDOR_REPORT_WRITE_EVT, &cb_param);
|
|
|
}
|
|
|
+#endif
|
|
|
break;
|
|
|
}
|
|
|
case ESP_GATTS_CREAT_ATTR_TAB_EVT: {
|