mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 19:20:54 +00:00
gatt-service/hids-client: fix in-place event for received HID reports
This commit is contained in:
parent
77043c43b8
commit
d41c2d2832
@ -623,10 +623,19 @@ static void handle_notification_event(uint8_t packet_type, uint16_t channel, uin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t * in_place_event = &packet[-2];
|
// GATT_EVENT_NOTIFICATION has HID report data at offset 12
|
||||||
|
// - see gatt_event_notification_get_value()
|
||||||
|
//
|
||||||
|
// GATTSERVICE_SUBEVENT_HID_REPORT has HID report data at offset 10
|
||||||
|
// - see gattservice_subevent_hid_report_get_report() and add 1 for the inserted Report ID
|
||||||
|
//
|
||||||
|
// => use existing packet from offset 2 = 12 - 10 to setup event
|
||||||
|
const int16_t offset = 2;
|
||||||
|
|
||||||
|
uint8_t * in_place_event = &packet[offset];
|
||||||
hids_client_setup_report_event_with_report_id(client, report_index, in_place_event,
|
hids_client_setup_report_event_with_report_id(client, report_index, in_place_event,
|
||||||
gatt_event_notification_get_value_length(packet));
|
gatt_event_notification_get_value_length(packet));
|
||||||
(*client->client_handler)(HCI_EVENT_GATTSERVICE_META, client->cid, in_place_event, size + 2);
|
(*client->client_handler)(HCI_EVENT_GATTSERVICE_META, client->cid, in_place_event, size - offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_report_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
|
static void handle_report_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user