BLE legacy pairing with OOB but not through NFC, using nrf connect Desktop and/or nrf connect mobile

 I currently work with the nRF5 17.0.2 SDK on the either the nrf52 DK or nrf52840 DK 

Currently I want to implement legacy pairing with OOB but not through NFC, the OOB key will be obtained through another method. Also I want to do only pairing but not bonding.

At the moment, I have taken the ble_app_hrs example and implemented OOB pairing with a fixed static OOB key for authentication. However, I am having issues actually testing my implementation using both the nrf connect Desktop and the nrf connect android app. 

the static OOB key used is:

static ble_advdata_tk_value_t m_oob_auth_key = {
.tk = {0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30}
};

When trying to test with nrf connect Desktop, I keep running into the issue "Authentication failed with status BLE_GAP_SEC_STATUS_CONFIRM_VALUE", even though I'm sure that I entered the fixed OOB key correctly. I wasn't sure if the input was HEX or ASCII but I tried both forms. Below are pictures that show roughly what I did:

then:

and then the error

 

When I tried to test it with the nrf connect mobile app I just had no idea where to start, the OOB input screen just never shows up and I have no clue what is happening there.

 

However, I do think my implementation is probably correct, I did a third option to test, which was taking the central example ble_app_hrs_c and implementing letting it support OOB pairing, and in that case it worked, although I hardly think this is a good way to verify my implementation and my end product goal in mind is OOB legacy pairing with my company's own android APP. But in any case here is my code, and the I marked I think most of my edits to the original example with /***ADDED CODE ****/.

main.c for ble_app_hrs (peripheral): 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* Copyright (c) 2014 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

main.c for ble_app_hrs_c (central): 

 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* Copyright (c) 2014 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

My main goal right now is to try to get the legacy pairing OOB using the static passkey with both nrf connect for desktop and for android. The end product will use legacy OOB pairing using my company's own android APP