sm_pairing_central: print encryption state

This commit is contained in:
Matthias Ringwald 2017-11-21 16:08:29 +01:00
parent e5779dd230
commit 6c42608ae7

View File

@ -102,7 +102,7 @@ static void sm_pairing_central_setup(void){
// LE Legacy Pairing, Just Works
sm_set_io_capabilities(IO_CAPABILITY_DISPLAY_YES_NO);
sm_set_authentication_requirements(0);
sm_set_authentication_requirements(SM_AUTHREQ_NO_BONDING);
// LE Legacy Pairing, Passkey entry initiator enter, responder (us) displays
// sm_set_io_capabilities(IO_CAPABILITY_DISPLAY_ONLY);
@ -179,7 +179,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
case SM_EVENT_PASSKEY_DISPLAY_NUMBER:
printf("Display Passkey: %"PRIu32"\n", sm_event_passkey_display_number_get_passkey(packet));
break;
case HCI_EVENT_LE_META:
// wait for connection complete
if (hci_event_le_meta_get_subevent_code(packet) != HCI_SUBEVENT_LE_CONNECTION_COMPLETE) break;
@ -187,6 +186,10 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
// start pairing
sm_request_pairing(con_handle);
break;
case HCI_EVENT_ENCRYPTION_CHANGE:
con_handle = hci_event_encryption_change_get_connection_handle(packet);
printf("Connection encrypted: %u\n", hci_event_encryption_change_get_encryption_enabled(packet));
break;
default:
break;
}