mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-06 07:00:59 +00:00
example/sm_pairing_peripheral: print identity address and type
This commit is contained in:
parent
13377825df
commit
9c22b849b4
@ -147,6 +147,7 @@ static void sm_peripheral_setup(void){
|
|||||||
|
|
||||||
/* LISTING_START(packetHandler): Packet Handler */
|
/* LISTING_START(packetHandler): Packet Handler */
|
||||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||||
|
bd_addr_t addr;
|
||||||
switch (packet_type) {
|
switch (packet_type) {
|
||||||
case HCI_EVENT_PACKET:
|
case HCI_EVENT_PACKET:
|
||||||
switch (hci_event_packet_get_type(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:
|
case SM_EVENT_PASSKEY_DISPLAY_NUMBER:
|
||||||
printf("Display Passkey: %u\n", sm_event_passkey_display_number_get_passkey(packet));
|
printf("Display Passkey: %u\n", sm_event_passkey_display_number_get_passkey(packet));
|
||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user