example: handle HCI_EVENT_ENCRYPTION_CHANGE_V2

This commit is contained in:
Matthias Ringwald 2022-06-28 14:53:24 +02:00
parent 8601e696a7
commit 2c50985d9c
3 changed files with 4 additions and 1 deletions

View File

@ -514,6 +514,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
sm_request_pairing(connection_handle); sm_request_pairing(connection_handle);
break; break;
case HCI_EVENT_ENCRYPTION_CHANGE: case HCI_EVENT_ENCRYPTION_CHANGE:
case HCI_EVENT_ENCRYPTION_CHANGE_V2:
if (connection_handle != hci_event_encryption_change_get_connection_handle(packet)) break; if (connection_handle != hci_event_encryption_change_get_connection_handle(packet)) break;
printf("Connection encrypted: %u\n", hci_event_encryption_change_get_encryption_enabled(packet)); printf("Connection encrypted: %u\n", hci_event_encryption_change_get_encryption_enabled(packet));
if (hci_event_encryption_change_get_encryption_enabled(packet) == 0){ if (hci_event_encryption_change_get_encryption_enabled(packet) == 0){

View File

@ -427,6 +427,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
sm_request_pairing(connection_handle); sm_request_pairing(connection_handle);
break; break;
case HCI_EVENT_ENCRYPTION_CHANGE: case HCI_EVENT_ENCRYPTION_CHANGE:
case HCI_EVENT_ENCRYPTION_CHANGE_V2:
if (connection_handle != hci_event_encryption_change_get_connection_handle(packet)) break; if (connection_handle != hci_event_encryption_change_get_connection_handle(packet)) break;
printf("Connection encrypted: %u\n", hci_event_encryption_change_get_encryption_enabled(packet)); printf("Connection encrypted: %u\n", hci_event_encryption_change_get_encryption_enabled(packet));
if (hci_event_encryption_change_get_encryption_enabled(packet) == 0){ if (hci_event_encryption_change_get_encryption_enabled(packet) == 0){

View File

@ -213,7 +213,8 @@ static void hci_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *p
// general gatt client request to trigger mandatory authentication // general gatt client request to trigger mandatory authentication
// gatt_client_discover_primary_services(&hci_packet_handler, con_handle); // gatt_client_discover_primary_services(&hci_packet_handler, con_handle);
break; break;
case HCI_EVENT_ENCRYPTION_CHANGE: case HCI_EVENT_ENCRYPTION_CHANGE:
case HCI_EVENT_ENCRYPTION_CHANGE_V2:
con_handle = hci_event_encryption_change_get_connection_handle(packet); con_handle = hci_event_encryption_change_get_connection_handle(packet);
printf("Connection encrypted: %u\n", hci_event_encryption_change_get_encryption_enabled(packet)); printf("Connection encrypted: %u\n", hci_event_encryption_change_get_encryption_enabled(packet));
break; break;