bluekitchen / btstack

Dual-mode Bluetooth stack, with small memory footprint.
http://bluekitchen-gmbh.com
Other
1.74k stars 618 forks source link

After `hids_client_send_write_report()` client state never gets back to `HIDS_CLIENT_STATE_CONNECTED` #573

Closed ricardoquesada closed 7 months ago

ricardoquesada commented 8 months ago

Describe the bug

After calling hids_client_send_write_report(), the client state does not return to HIDS_CLIENT_STATE_CONNECTED. It remains on HIDS_CLIENT_W4_WRITE_REPORT_DONE.

To Reproduce

Just call hids_client_send_write_report().

It seems that handle_report_event is ignoring the GATT_EVENT_QUERY_COMPLETE event triggered by gatt_client_write_value_of_characteristic(), and the client state remains at HIDS_CLIENT_W4_WRITE_REPORT_DONE

mringwal commented 7 months ago

Hi @ricardoquesada - the first bug was actually that the wrong packet handler was registered. With that in place, the state is set back to connected correctly. However, there was no event that indicates that the write is complete. I've changed the code to emit an empty GATTSERVICE_SUBEVENT_HID_REPORT. What do you think about this? Does this work for you?

ricardoquesada commented 7 months ago

Thanks. works great.