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

send data from client to specific server via unicast address

Hi Guys,

We are currently working on a mesh sensor network. I have already developed a vendor sensor model (client and server). The client will also work as a gateway and will run on a nRF52840 DK. The Provisioner is on a separate DK just like in the Light Switch Example. The sonsors are a costum hardware with an nRF52840 on it.

The sensor send data on regular bases to the client via the mesh and the client then send it via UART to a computer.

During the provisioning process the nodes are picked randomly to add them to the network. Now the problem is that I have to know which device has received which unicast address.

I now want to send an On/Off message from the client to a unicast address and set an LED to identify which node it is. For that I have to change the publication address of the client locally. So is this possible without the provisioner? I have read that there is the following function available to change the publication address of a node: access_model_publish_address_set()

I found out that this function is in the access_config. h file decelerated but I haven't found a access_config.c file.

So which files do I have to include to use this functions?

Is there another way to change the publication address of a node locally?

Best regards,

Michel

 

Parents
  • You change the publication address like this: 

    uint32_t status = NRF_SUCCESS;
    
      dsm_handle_t publish_address_handle = DSM_HANDLE_INVALID;
      nrf_mesh_address_t publish_address_stored;
    
      if (access_model_publish_address_get(m_clients[0].model_handle, &publish_address_handle) != NRF_SUCCESS) {
    
        status = dsm_address_publish_add(destination_address, &publish_address_handle);
    
      } else {
    
        if (dsm_address_get(publish_address_handle, &publish_address_stored) == NRF_SUCCESS) {
    
          if ((publish_address_stored.type == NRF_MESH_ADDRESS_TYPE_VIRTUAL) ||
              (publish_address_stored.type != NRF_MESH_ADDRESS_TYPE_VIRTUAL &&
                  publish_address_stored.value != destination_address)) {
            /* This should never assert */
            NRF_MESH_ASSERT(dsm_address_publish_remove(publish_address_handle) == NRF_SUCCESS);
            status = dsm_address_publish_add(destination_address, &publish_address_handle);
          } else {
            /* Use the retrieved publish_address_handle */
          }
        } else {
    
          status = dsm_address_publish_add(destination_address, &publish_address_handle);
        }
      }
    
      switch (status) {
      case NRF_ERROR_NO_MEM:
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "NRF_ERROR_NO_MEM\n");
        //            status_error_pub_send(handle, p_message, sig_model, ACCESS_STATUS_INSUFFICIENT_RESOURCES);
        return;
    
      case NRF_SUCCESS:
        break;
    
      default:
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "ACCESS_STATUS_UNSPECIFIED_ERROR\n");
        //            status_error_pub_send(handle, p_message, sig_model, ACCESS_STATUS_UNSPECIFIED_ERROR);
        return;
      }
    
      NRF_MESH_ASSERT(access_model_publish_address_set(m_clients[0].model_handle, publish_address_handle) == NRF_SUCCESS);

    destination_address is unicast address you want to send on/off command. You can figure out which header file you must include by searching the function on all solution. 
  • Hi Karinca,

    Using       nRF5_SDK_17.0.2_d674dde    +     nrf5_SDK_for_Mesh_v5.0.0_src

     

    I have tried the above function code to change the publish address but getting Mesh Assert " Mesh assert at 0x000316E0 (:0)".

    I am trying to send data to server side from client node using UART communication. UART data gives the server node publish address and data(1 byte) to be sent. 

    Tried to debug the cause of assertion and found function "dirty_entries_process" is causing this assertion.

    After success in single byte, going for Insta-Burst implementation.

    Need support in this.. Thanks

    One more Input to this, After Resetting client device only once dirty_entries_process works perfect. later when the unicast address changed his error comes again.

Reply
  • Hi Karinca,

    Using       nRF5_SDK_17.0.2_d674dde    +     nrf5_SDK_for_Mesh_v5.0.0_src

     

    I have tried the above function code to change the publish address but getting Mesh Assert " Mesh assert at 0x000316E0 (:0)".

    I am trying to send data to server side from client node using UART communication. UART data gives the server node publish address and data(1 byte) to be sent. 

    Tried to debug the cause of assertion and found function "dirty_entries_process" is causing this assertion.

    After success in single byte, going for Insta-Burst implementation.

    Need support in this.. Thanks

    One more Input to this, After Resetting client device only once dirty_entries_process works perfect. later when the unicast address changed his error comes again.

Children
No Data
Related