mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-06 03:40:16 +00:00
gatt-service/hids-client: emit GATTSERVICE_SUBEVENT_HID_REPORT for hids_client_send_write_report, fix #573
This commit is contained in:
parent
a2d3931b85
commit
84d4ab66f7
@ -632,7 +632,8 @@ static void handle_report_event(uint8_t packet_type, uint16_t channel, uint8_t *
|
||||
}
|
||||
|
||||
uint8_t * in_place_event = &packet[-2];
|
||||
hids_client_setup_report_event(client, report_index, in_place_event, gatt_event_characteristic_value_query_result_get_value_length(packet));
|
||||
hids_client_setup_report_event_with_report_id(client, report_index, in_place_event,
|
||||
gatt_event_characteristic_value_query_result_get_value_length(packet));
|
||||
(*client->client_handler)(HCI_EVENT_GATTSERVICE_META, client->cid, in_place_event, size + 2);
|
||||
}
|
||||
|
||||
@ -829,7 +830,7 @@ static void hids_run_for_client(hids_client_t * client){
|
||||
|
||||
// see GATT_EVENT_QUERY_COMPLETE for end of write
|
||||
att_status = gatt_client_write_value_of_characteristic(
|
||||
&handle_report_event, client->con_handle,
|
||||
&handle_gatt_client_event, client->con_handle,
|
||||
client->reports[client->report_index].value_handle,
|
||||
client->report_len, (uint8_t *)client->report);
|
||||
UNUSED(att_status);
|
||||
@ -1353,12 +1354,21 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
client->state = HIDS_CLIENT_W2_SEND_GET_REPORT;
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
case HIDS_CLIENT_W4_VALUE_OF_CHARACTERISTIC_RESULT:
|
||||
case HIDS_CLIENT_W4_WRITE_REPORT_DONE:
|
||||
client->state = HIDS_CLIENT_STATE_CONNECTED;
|
||||
break;
|
||||
|
||||
case HIDS_CLIENT_W4_WRITE_REPORT_DONE:
|
||||
{
|
||||
client->state = HIDS_CLIENT_STATE_CONNECTED;
|
||||
|
||||
// emit empty report to signal done
|
||||
uint8_t event[9];
|
||||
hids_client_setup_report_event(client, client->report_index, event, 0);
|
||||
(*client->client_handler)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -219,7 +219,8 @@ typedef struct {
|
||||
*/
|
||||
void hids_client_init(uint8_t * hid_descriptor_storage, uint16_t hid_descriptor_storage_len);
|
||||
|
||||
/* @brief Connect to HID Services of remote device. Event GATTSERVICE_SUBEVENT_HID_SERVICE_CONNECTED will be emitted
|
||||
/**
|
||||
* @brief Connect to HID Services of remote device. Event GATTSERVICE_SUBEVENT_HID_SERVICE_CONNECTED will be emitted
|
||||
* after all remote HID services and characteristics are found, and notifications for all input reports are enabled.
|
||||
* Status code can be ERROR_CODE_SUCCES if at least one HID service is found, otherwise either ATT errors or
|
||||
* ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE if no service or report map or report are found.
|
||||
@ -235,7 +236,7 @@ void hids_client_init(uint8_t * hid_descriptor_storage, uint16_t hid_descriptor_
|
||||
uint8_t hids_client_connect(hci_con_handle_t con_handle, btstack_packet_handler_t packet_handler, hid_protocol_mode_t protocol_mode, uint16_t * hids_cid);
|
||||
|
||||
/**
|
||||
* @brief Send HID report.
|
||||
* @brief Send HID report. Event GATTSERVICE_SUBEVENT_HID_REPORT is emitted with empty report
|
||||
*
|
||||
* @param hids_cid
|
||||
* @param report_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user