1. This is on the stock LPN example, with one change to debug-print `status_code` inside handle_appkey_add().
Here is the diff:
diff --git a/models/foundation/config/src/config_server.c b/models/foundation/config/src/config_server.c index 3993942..6fa9daa 100644 --- a/models/foundation/config/src/config_server.c +++ b/models/foundation/config/src/config_server.c @@ -627,8 +627,6 @@ static void handle_appkey_add(access_model_handle_t handle, const access_message evt.type = CONFIG_SERVER_EVT_APPKEY_ADD; status = dsm_appkey_add(appkey_index, network_handle, p_pdu->appkey, &evt.params.appkey_add.appkey_handle); - __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "dsm_appkey_add(appkey_handle:%X appkey_index:%X)\n", evt.params.appkey_add.appkey_handle, appkey_index ); - switch (status) { case NRF_SUCCESS: @@ -660,6 +658,10 @@ static void handle_appkey_add(access_model_handle_t handle, const access_message break; } + __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, + "dsm_appkey_add(appkey_handle:%X appkey_index:%X) status code: %X\n", + evt.params.appkey_add.appkey_handle, appkey_index, status_code); + send_appkey_status(handle, p_message, status_code, key_indexes); if (status == NRF_SUCCESS)
2. To reproduce:
- flash and provision
- attempt to add a second application key (via proxy)
- device returns ACCESS_STATUS_INSUFFICIENT_RESOURCES (aka 0x05)
- establish friendship
- attempt to add a second application key (via friendship)
- device returns ACCESS_STATUS_INSUFFICIENT_RESOURCES (aka 0x05)
This is the log output:
<t: 0>, main.c, 580, ----- BLE Mesh LPN Demo ----- <t: 9326>, main.c, 530, Initializing and adding models <t: 14250>, mesh_app_utils.c, 66, Device UUID (raw): BC354729418A465A8BEE4596D3225B67 <t: 14254>, mesh_app_utils.c, 71, Device UUID : BC354729-418A-465A-8BEE-4596D3225B67 <t: 14270>, main.c, 644, ------------------------------------------------------ Button/RTT 1) Send the on message. Button/RTT 2) Send the off message. Button/RTT 3) Establish or terminate friendship. Button/RTT 4) Clear all the states to reset the node. ------------------------------------------------------ <t: 880839>, ble_softdevice_support.c, 104, Successfully updated connection parameters <t: 1344686>, main.c, 163, Successfully provisioned <t: 1344693>, main.c, 158, Node Address: 0x00A0 <t: 1384147>, ble_softdevice_support.c, 104, Successfully updated connection parameters <t: 1859228>, config_server.c, 663, dsm_appkey_add(appkey_handle:0 appkey_index:0) status code: 0 <t: 1874924>, config_server.c, 2540, Access Info: element_index=0 model_id = 2-FFFF model_handle=1 <t: 1890652>, config_server.c, 2540, Access Info: element_index=1 model_id = 1001-FFFF model_handle=2 <t: 2165918>, config_server.c, 663, dsm_appkey_add(appkey_handle:FFFF appkey_index:1) status code: 5 <t: 5886138>, main.c, 366, Button 3 pressed <t: 5886141>, main.c, 293, Initiating the friendship establishment procedure. <t: 5889537>, main.c, 451, Received friend offer from 0x000D <t: 5892895>, main.c, 498, Friendship established with: 0x000D <t: 6208382>, config_server.c, 663, dsm_appkey_add(appkey_handle:FFFF appkey_index:1) status code: 5 <t: 6213433>, main.c, 480, Friend poll procedure complete
3. Here are all details for the build:
-- Configuring CMake for nRF5 SDK for Bluetooth Mesh 4.1.0 -- SDK: nRF5_SDK_16.0.0_98a08e2 -- Platform: nrf52832_xxAA -- Arch: cortex-m4f -- SoftDevice: s132_7.0.1 -- Board: pca10040 -- The C compiler identification is GNU 8.3.1