mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-23 19:20:51 +00:00
hid_host_demo: only accept incoming connection if status is ok
This commit is contained in:
parent
c72af13194
commit
b848f4ec55
@ -343,11 +343,18 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
switch (hci_event_hid_meta_get_subevent_code(packet)){
|
||||
|
||||
case HID_SUBEVENT_INCOMING_CONNECTION:
|
||||
// There is an incoming connection: we can accept it or decline it.
|
||||
// The hid_host_report_mode in the hid_host_accept_connection function
|
||||
// allows the application to request a protocol mode.
|
||||
// For available protocol modes, see hid_protocol_mode_t in btstack_hid.h file.
|
||||
hid_host_accept_connection(hid_subevent_incoming_connection_get_hid_cid(packet), hid_host_report_mode);
|
||||
// There is an incoming connection: we can accept it or decline it
|
||||
|
||||
// If there are no resources to handle the connection,
|
||||
// the status will be ERROR_CODE_MEMORY_CAPACITY_EXCEEDED
|
||||
|
||||
// The hid_host_report_mode in the hid_host_accept_connection function
|
||||
// allows the application to request a protocol mode.
|
||||
|
||||
// For available protocol modes, see hid_protocol_mode_t in btstack_hid.h file.
|
||||
if (hid_subevent_incoming_connection_get_status(packet) == ERROR_CODE_SUCCESS) {
|
||||
hid_host_accept_connection(hid_subevent_incoming_connection_get_hid_cid(packet), hid_host_report_mode);
|
||||
}
|
||||
break;
|
||||
|
||||
case HID_SUBEVENT_CONNECTION_OPENED:
|
||||
|
Loading…
x
Reference in New Issue
Block a user