This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to remove server's handle for Mesh SDK

Hi,

   In the light_switch_client_nrf52832_xxAA_s132_3_1_0 project, I have tried some ways to remove server from configured devices, but failed. Anyone know?

Here's my code:

uint16_t addr_msb = (uint16_t)p_data[2]<<8;
uint16_t addr_lsb = p_data[1] & 0xFF;
target_addr = addr_msb + addr_lsb;

__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Target address 0x%04X\n", target_addr);

uint16_t target_addr_index = target_addr - UNPROV_START_ADDRESS;

ERROR_CHECK(dsm_address_publish_remove(m_server_handles[target_addr_index])); 
ERROR_CHECK(dsm_devkey_delete(m_devkey_handles[target_addr_index]));   
ERROR_CHECK(access_model_application_unbind(m_clients[target_addr_index].model_handle, m_appkey_handle));

  when restart client, and calls  access_flash_config_load(), it will report error.    

  • Hi, 

    Which SDK version are you using ? 

    Could you let me know what kind of error you have when calling access_flash_config_load() ? 

    We strongly suggest you to use newer SDK where we have more stable flash management. The current SDK is v2.0.1. 

     

    Please be aware that the server information is not really stored on the client node. Devkey is the only information bind to the server. You only need to erase the devkey (and the publish address in the dsm address database if you want, but it not really needed). 

    If you erase the publish address in the dsm , make sure you also change the publication address of the client's model to something else . 

    I don't see the point of unbinding the client's model to the app key.

     

     

  • Hi,

       I am using SDK v1.0.1.

       The following picture shows the error when I did steps showed before and  restarted the client.

       SDK v2.0.1 has one more node (provisioner) than the  SDK v1.0.1 and needs a new board to support its function. That doesn't meet our demands now.

       My purpose is to remove an odd server(address 0x0101) and replace it with the new one(address will be 0x0101) if be provisioned then. 

      Can you tell me what should I do, thanks very much!

  • Hi Chen, 

     

    It actually on intention in SDK v2.x that we split the light switch client to have a separated provisioner. Just to make it clear that the client doesn't need to be located on the provisioner. And the provisioner only needed when setting up the network and can be removed when provisioning is not needed. 

     

    But you can always add provisioning role back to the client node if you want. We do have some bug fixes in SDK v2.x regarding erasing provisioning data.  So new SDK is recommended. 

     

    The recommended way of removing a node in the network is: 

     

    1- Configuration client send node reset using config_client_node_reset(). Have a look here. 

    2- On the server side, when receive that request, it should erase flash. This is handled in our example code. But there was some bug fixed here, so we recommend to use SDK v2.0.1

    3- The provisioner after that can either provision a new node with the old address 0x0101 or can assign a new address. 

    4- The provisioner/or the client can delete the devkey of the old node, and remove the publication address in the dsm of 0x0101 if it choose to assign a new address. 

     

    In your code you are doing step 4. I don't know why you need to unbind the application key of the client. If you are going to do the same application on that client, you don't have to unbind application key. The only thing you need to do on the client is to change the publication address if you assign a new address to the new node. 

     

    Regarding 

  • Hi,

    mesh sdk:1.0.1

    I also encountered the same problem with him.

    Can Fix this Problem in the SDK 1.0.1?
  • @caca: Please create a new case and describe your issue. Please be aware that the latest version of Mesh SDK is v2.0.1 and SDK v1.0.1 is not qualified. 

Related