From 0614d6792da28c72ac7c16c70909c76363f2b166 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 1 Feb 2018 17:36:56 +0100 Subject: [PATCH] example/sm_pairing_central: print SM_EVENT_PAIRING_COMPLETE --- example/sm_pairing_peripheral.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/example/sm_pairing_peripheral.c b/example/sm_pairing_peripheral.c index 84f9c7ca9..9579413ec 100644 --- a/example/sm_pairing_peripheral.c +++ b/example/sm_pairing_peripheral.c @@ -182,8 +182,28 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack sm_event_identity_created_get_address(packet, addr); printf("Identity resolving failed\n"); break; - } - break; + case SM_EVENT_PAIRING_COMPLETE: + switch (sm_event_pairing_complete_get_status(packet)){ + case ERROR_CODE_SUCCESS: + printf("Pairing complete, success\n"); + break; + case ERROR_CODE_CONNECTION_TIMEOUT: + printf("Pairing failed, timeout\n"); + break; + case ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION: + printf("Pairing faileed, disconnected\n"); + break; + case ERROR_CODE_AUTHENTICATION_FAILURE: + printf("Pairing failed, reason = %u\n", sm_event_pairing_complete_get_reason(packet)); + break; + default: + break; + } + break; + default: + break; + } + break; } } /* LISTING_END */