mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-15 22:20:59 +00:00
gatt-service/hids_device: provide report id in report enable events
This commit is contained in:
parent
cdd6cc33b8
commit
f00767dfec
@ -142,6 +142,24 @@ static void hids_device_emit_event_with_uint8(uint8_t event, hci_con_handle_t co
|
||||
(*packet_handler)(HCI_EVENT_PACKET, 0, buffer, sizeof(buffer));
|
||||
}
|
||||
|
||||
static void hids_device_emit_event_with_uint8_uint8_t(uint8_t event, hci_con_handle_t con_handle, uint8_t value_1, uint8_t value_2){
|
||||
hids_device_t * instance = hids_device_get_instance_for_con_handle(con_handle);
|
||||
if (!instance){
|
||||
log_error("no instance for handle 0x%02x", con_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!packet_handler) return;
|
||||
uint8_t buffer[7];
|
||||
buffer[0] = HCI_EVENT_HIDS_META;
|
||||
buffer[1] = 4;
|
||||
buffer[2] = event;
|
||||
little_endian_store_16(buffer, 3, (uint16_t) con_handle);
|
||||
buffer[5] = value_1;
|
||||
buffer[6] = value_2;
|
||||
(*packet_handler)(HCI_EVENT_PACKET, 0, buffer, sizeof(buffer));
|
||||
}
|
||||
|
||||
static void hids_device_emit_event(uint8_t event, hci_con_handle_t con_handle){
|
||||
hids_device_t * instance = hids_device_get_instance_for_con_handle(con_handle);
|
||||
if (!instance){
|
||||
@ -268,13 +286,13 @@ static int att_write_callback(hci_con_handle_t con_handle, uint16_t att_handle,
|
||||
|
||||
switch (report->type){
|
||||
case HID_REPORT_TYPE_INPUT:
|
||||
hids_device_emit_event_with_uint8(HIDS_SUBEVENT_INPUT_REPORT_ENABLE, con_handle, (uint8_t) new_value);
|
||||
hids_device_emit_event_with_uint8_uint8_t(HIDS_SUBEVENT_INPUT_REPORT_ENABLE, con_handle, report->id, (uint8_t) new_value);
|
||||
break;
|
||||
case HID_REPORT_TYPE_OUTPUT:
|
||||
hids_device_emit_event_with_uint8(HIDS_SUBEVENT_OUTPUT_REPORT_ENABLE, con_handle, (uint8_t) new_value);
|
||||
hids_device_emit_event_with_uint8_uint8_t(HIDS_SUBEVENT_OUTPUT_REPORT_ENABLE, con_handle, report->id, (uint8_t) new_value);
|
||||
break;
|
||||
case HID_REPORT_TYPE_FEATURE:
|
||||
hids_device_emit_event_with_uint8(HIDS_SUBEVENT_FEATURE_REPORT_ENABLE, con_handle, (uint8_t) new_value);
|
||||
hids_device_emit_event_with_uint8_uint8_t(HIDS_SUBEVENT_FEATURE_REPORT_ENABLE, con_handle, report->id, (uint8_t) new_value);
|
||||
break;
|
||||
default:
|
||||
btstack_unreachable();
|
||||
|
@ -3863,25 +3863,28 @@ typedef uint8_t sm_key_t[16];
|
||||
#define HIDS_SUBEVENT_BOOT_KEYBOARD_INPUT_REPORT_ENABLE 0x04u
|
||||
|
||||
/**
|
||||
* @format 121
|
||||
* @format 1211
|
||||
* @param subevent_code
|
||||
* @param con_handle
|
||||
* @param report_id
|
||||
* @param enable
|
||||
*/
|
||||
#define HIDS_SUBEVENT_INPUT_REPORT_ENABLE 0x05u
|
||||
|
||||
/**
|
||||
* @format 121
|
||||
* @format 1211
|
||||
* @param subevent_code
|
||||
* @param con_handle
|
||||
* @param report_id
|
||||
* @param enable
|
||||
*/
|
||||
#define HIDS_SUBEVENT_OUTPUT_REPORT_ENABLE 0x06u
|
||||
|
||||
/**
|
||||
* @format 121
|
||||
* @format 1211
|
||||
* @param subevent_code
|
||||
* @param con_handle
|
||||
* @param report_id
|
||||
* @param enable
|
||||
*/
|
||||
#define HIDS_SUBEVENT_FEATURE_REPORT_ENABLE 0x07u
|
||||
|
@ -12377,6 +12377,15 @@ static inline uint8_t hids_subevent_boot_keyboard_input_report_enable_get_enable
|
||||
static inline uint16_t hids_subevent_input_report_enable_get_con_handle(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field report_id from event HIDS_SUBEVENT_INPUT_REPORT_ENABLE
|
||||
* @param event packet
|
||||
* @return report_id
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t hids_subevent_input_report_enable_get_report_id(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field enable from event HIDS_SUBEVENT_INPUT_REPORT_ENABLE
|
||||
* @param event packet
|
||||
@ -12384,7 +12393,7 @@ static inline uint16_t hids_subevent_input_report_enable_get_con_handle(const ui
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t hids_subevent_input_report_enable_get_enable(const uint8_t * event){
|
||||
return event[5];
|
||||
return event[6];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -12396,6 +12405,15 @@ static inline uint8_t hids_subevent_input_report_enable_get_enable(const uint8_t
|
||||
static inline uint16_t hids_subevent_output_report_enable_get_con_handle(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field report_id from event HIDS_SUBEVENT_OUTPUT_REPORT_ENABLE
|
||||
* @param event packet
|
||||
* @return report_id
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t hids_subevent_output_report_enable_get_report_id(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field enable from event HIDS_SUBEVENT_OUTPUT_REPORT_ENABLE
|
||||
* @param event packet
|
||||
@ -12403,7 +12421,7 @@ static inline uint16_t hids_subevent_output_report_enable_get_con_handle(const u
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t hids_subevent_output_report_enable_get_enable(const uint8_t * event){
|
||||
return event[5];
|
||||
return event[6];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -12415,6 +12433,15 @@ static inline uint8_t hids_subevent_output_report_enable_get_enable(const uint8_
|
||||
static inline uint16_t hids_subevent_feature_report_enable_get_con_handle(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field report_id from event HIDS_SUBEVENT_FEATURE_REPORT_ENABLE
|
||||
* @param event packet
|
||||
* @return report_id
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t hids_subevent_feature_report_enable_get_report_id(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field enable from event HIDS_SUBEVENT_FEATURE_REPORT_ENABLE
|
||||
* @param event packet
|
||||
@ -12422,7 +12449,7 @@ static inline uint16_t hids_subevent_feature_report_enable_get_con_handle(const
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t hids_subevent_feature_report_enable_get_enable(const uint8_t * event){
|
||||
return event[5];
|
||||
return event[6];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user