From 092fc1dbc5fe348a7e6f8a5e49cb75c2065ecda0 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Tue, 20 Oct 2020 11:36:57 +0200 Subject: [PATCH] test/security_manager_sc: print message on disconnect after working state was reached --- test/security_manager_sc/sm_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/security_manager_sc/sm_test.c b/test/security_manager_sc/sm_test.c index 609d38b9c..16b6471fc 100644 --- a/test/security_manager_sc/sm_test.c +++ b/test/security_manager_sc/sm_test.c @@ -296,7 +296,7 @@ static void hci_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * case HCI_EVENT_LE_META: switch (hci_event_le_meta_get_subevent_code(packet)) { case HCI_SUBEVENT_LE_CONNECTION_COMPLETE: - connection_handle = little_endian_read_16(packet, 4); + connection_handle = hci_subevent_le_connection_complete_get_connection_handle(packet); printf("CONNECTED: Connection handle 0x%04x\n", connection_handle); break; default: @@ -304,6 +304,9 @@ static void hci_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * } break; case HCI_EVENT_DISCONNECTION_COMPLETE: + if (hci_get_state() != HCI_STATE_WORKING) break; + connection_handle = hci_event_disconnection_complete_get_connection_handle(packet); + printf("DISCONNECTED: Connection handle 0x%04x\n", connection_handle); break; default: break;