mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-24 03:40:07 +00:00
gatt-service/hids_device: provide hids_device_send_input_report_for_id
This commit is contained in:
parent
6853468ee2
commit
45569c346d
@ -113,6 +113,17 @@ static hids_device_report_t * hids_device_get_report_for_client_configuration_ha
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static hids_device_report_t * hids_device_get_report_for_type_and_id(hids_device_t * device, hid_report_type_t type, uint16_t report_id){
|
||||
uint8_t pos;
|
||||
uint8_t total_reports = device->hid_input_reports_num + device->hid_output_reports_num + device->hid_feature_reports_num;
|
||||
for (pos = 0 ; pos < total_reports ; pos++){
|
||||
if ((device->hid_reports[pos].type == type) && (device->hid_reports[pos].id == report_id)){
|
||||
return &device->hid_reports[pos];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static hids_device_report_t * hids_device_get_report_for_id(hids_device_t * device, uint16_t report_id){
|
||||
uint8_t pos;
|
||||
uint8_t total_reports = device->hid_input_reports_num + device->hid_output_reports_num + device->hid_feature_reports_num;
|
||||
@ -422,18 +433,14 @@ void hids_device_request_can_send_now_event(hci_con_handle_t con_handle){
|
||||
att_server_register_can_send_now_callback(&instance->battery_callback, con_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send HID Report: Input
|
||||
*/
|
||||
|
||||
uint8_t hids_device_send_report_with_id(hci_con_handle_t con_handle, uint16_t report_id, const uint8_t * report, uint16_t report_len){
|
||||
uint8_t hids_device_send_input_report_for_id(hci_con_handle_t con_handle, uint16_t report_id, const uint8_t * report, uint16_t report_len){
|
||||
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 ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
hids_device_report_t * report_storage = hids_device_get_report_for_id(instance, report_id);
|
||||
hids_device_report_t * report_storage = hids_device_get_report_for_type_and_id(instance, HID_REPORT_TYPE_INPUT, report_id);
|
||||
if (report_storage == NULL){
|
||||
return ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
|
||||
}
|
||||
|
@ -93,12 +93,19 @@ void hids_device_register_packet_handler(btstack_packet_handler_t callback);
|
||||
void hids_device_request_can_send_now_event(hci_con_handle_t con_handle);
|
||||
|
||||
/**
|
||||
* @brief Send HID Report with given ID
|
||||
* @brief Send HID Input Report for Report ID
|
||||
* @param con_handle
|
||||
* @param report_id
|
||||
* @param report
|
||||
* @param report_len
|
||||
*/
|
||||
uint8_t hids_device_send_report_with_id(hci_con_handle_t con_handle, uint16_t report_id, const uint8_t * report, uint16_t report_len);
|
||||
uint8_t hids_device_send_input_report_for_id(hci_con_handle_t con_handle, uint16_t report_id, const uint8_t * report, uint16_t report_len);
|
||||
|
||||
/**
|
||||
* @brief Send HID Report: Input
|
||||
* @brief Send HID Input Report for first Input Report
|
||||
* @param con_handle
|
||||
* @param report
|
||||
* @param report_len
|
||||
*/
|
||||
void hids_device_send_input_report(hci_con_handle_t con_handle, const uint8_t * report, uint16_t report_len);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user