example/sm_pairing_peripheral: print identity address and type

This commit is contained in:
Matthias Ringwald 2016-10-27 11:12:13 +02:00
parent 13377825df
commit 9c22b849b4

View File

@ -147,6 +147,7 @@ static void sm_peripheral_setup(void){
/* LISTING_START(packetHandler): Packet Handler */
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
bd_addr_t addr;
switch (packet_type) {
case HCI_EVENT_PACKET:
switch (hci_event_packet_get_type(packet)) {
@ -161,6 +162,18 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
case SM_EVENT_PASSKEY_DISPLAY_NUMBER:
printf("Display Passkey: %u\n", sm_event_passkey_display_number_get_passkey(packet));
break;
case SM_EVENT_IDENTITY_CREATED:
sm_event_identity_created_get_identity_address(packet, addr);
printf("Identity created: type %u address %s\n", sm_event_identity_created_get_identity_addr_type(packet), bd_addr_to_str(addr));
break;
case SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED:
sm_event_identity_resolving_succeeded_get_identity_address(packet, addr);
printf("Identity resolved: type %u address %s\n", sm_event_identity_resolving_succeeded_get_identity_addr_type(packet), bd_addr_to_str(addr));
break;
case SM_EVENT_IDENTITY_RESOLVING_FAILED:
sm_event_identity_created_get_address(packet, addr);
printf("Identity resolving failed\n");
break;
}
break;
}