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

BLE Mesh SDK - Publish to unicast address

Hi,

how can I publish a message to unicast address from a generic on/off client with mesh sdk?

How can I set the address?

Jost to be more precise, the function:

      access_model_reliable_publish(const access_reliable_t * p_reliable)

only works if the client model publishes on a unicast address:

    if (pub_addr.type == NRF_MESH_ADDRESS_TYPE_UNICAST)
    {
        add_reliable_message(index, p_reliable);
    }

    return NRF_SUCCESS;

What if the model publishes on group address?

We need to implement a gateway. How can we address singles nodes in the mesh net?

Thank you

Lucio

Parents
  • Hi Lucio, 

     

    Are you asking about publish to an unicast address or group address ? In your question, it's not clear. 

    Note that the reliable publish is only for unicast address. If you publish to a group address, you shouldn't expect there will be a response because there is no way to know how many nodes are subscribed to the group addresses and if all of them replies.

    If you want to send something to a group, please use access_model_publish (unreliable message) . You still can receive response from multiple nodes if you configure those nodes to publish to your unicast address or to the group address you subscribed to. 

     

Reply
  • Hi Lucio, 

     

    Are you asking about publish to an unicast address or group address ? In your question, it's not clear. 

    Note that the reliable publish is only for unicast address. If you publish to a group address, you shouldn't expect there will be a response because there is no way to know how many nodes are subscribed to the group addresses and if all of them replies.

    If you want to send something to a group, please use access_model_publish (unreliable message) . You still can receive response from multiple nodes if you configure those nodes to publish to your unicast address or to the group address you subscribed to. 

     

Children
  • Hi Hung,

    I will explain in more detail.

    We are developing a gateway node.

    That node acts as standard node in the BLE Mesh net (generic on/off server) and communicates via uart with a wifi module connected to internet (all on the same product).

    This special gateway node then receives activations from a server and forward them to the BLE Mesh net.

    The BLE node implements a generic on-off server and a generic on-off client to forward activations received from the wifi side.

    My question is, how can I programmatically (using BLE mesh sdk) forward on/off messages addressed to other nodes on the net if my client model can publish only to a single address/group?

    Can I programmatically change the publishing address of my client model?

    Thank you

  • Yes, the client can change its publication address. You can have a look here: https://devzone.nordicsemi.com/f/nordic-q-a/35931/multiple-server-on-one-client---light-switch-demo

    I also suggest you to try our nRFMesh provision app on the phone. It allows you to configure the proxy node in the network. You can try to change the publication address on the model on the client to target different server. This is a little bit different from the approach in the case I pointed above, where the setting is done inside the code not by reconfigure. A video demo of the app can be found here.

  • Hung,

    thank you, this may be the way.

    Do you have any example on how to use the calls you suggested?

    dsm_address_publish_add() to add an address to the DSM, then use access_model_publish_address_set() to set the app key, and access_model_publish_address_set() to set the publication address of the client mode. 

    I think the right configuration is to have the standard nodes as generic_server and the gateway node as both generic_server and generic_client and then use the calls you suggested to address the generic_server nodes.

    For the provisioning I'm already using the nRF-Mesh app.

  • Hi Lucio, 

    We already use those functions in the configuration server, to update the models with publication address sent by the configuration client. 

    Or you can have a look here.

    I'm not sure why you need a generic server  on the gateway but you can do that. Just make sure you have the server and the client on different elements. Same model shouldn't be on one element.

  • Hung,

    I think we need a generic_server because the gateway has all the functions of a standard node plus the wifi connectivity to act as a bribge to internet. Do you agree about that or I should only use a generic_client? I'm not sure. 

    I'm looking to config_server.c - handle_config_model_publication_set() function.

    Here they call dsm_address_publish_remove() before calling dsm_address_publish_add() if publish_address_stored is different from publish_address.

    This way you always have one element on the table.

    In the above link you suggest to add all addresses before then switch between them. Which is the preferred way?

    Do I need to call access_flash_config_store() at the end of this process every time I change the publishing address? This can lead to a rapid deterioration of the flash memory?

    Thank you

Related