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

How to use "Any Node (Destination)Address" to send data?

Hi Nordic Team,
I am currently working on how to build one mesh provisioner. 
Current Env: Nrf_sdk: 17.0, Mesh SDK: 5.0, Board Chip: nrf52832
My Questions is how to use any node address to send data.
If one mesh node had been provisioned by Phone, and i only have know its node address, how do i control it with my nrf52832's mesh provisioner?
For example, if we conrtol its "ONOFF", i will follow your example as this.(generic_onoff_client_set(&m_clients[0], &set_params, NULL);)
But i dont have node's handle, how do i exchange the dst addr to model_handle? (node addr  --> /** Model handle assigned to this instance */ access_model_handle_t model_handle; ???)

(Questions 2:  As i know, if i want to control node's configuration server, i need to add the devkey into my provisioner, it that right? can you help to list how to control one node(not provisioned by current provisioner)) 

Thanks for Nordic Team
BR,
TimCheng.

Parents
  • Hi Tim, 
    Please study what's inside generic_onoff_client_set(). 
    m_clients[0] you provide contain the instance of the light switch client model you have on the light switch client (or the provisioner if you implemented this on a provisioner). 

    On your provisioner, you need to implement a light switch client if you want to use this function. And you can change the publication address of this model to the node you want to send data to. Please refer to handle_config_model_publication_set() function in config_server.c to see how to change that. 

    However, if you plan to build a "central" device that can flexibly send data to any node, I would suggest to use the transport layer directly and skip the model and access layer. This mean you call nrf_mesh_packet_send() directly with all customized data you need, including the destination address. Please have a look into the packet_tx() function in access.c.

Reply
  • Hi Tim, 
    Please study what's inside generic_onoff_client_set(). 
    m_clients[0] you provide contain the instance of the light switch client model you have on the light switch client (or the provisioner if you implemented this on a provisioner). 

    On your provisioner, you need to implement a light switch client if you want to use this function. And you can change the publication address of this model to the node you want to send data to. Please refer to handle_config_model_publication_set() function in config_server.c to see how to change that. 

    However, if you plan to build a "central" device that can flexibly send data to any node, I would suggest to use the transport layer directly and skip the model and access layer. This mean you call nrf_mesh_packet_send() directly with all customized data you need, including the destination address. Please have a look into the packet_tx() function in access.c.

Children
  • Hi Hung,

    Appreciate your helpful info. 

    Yes, it will contain many clients(onoff, llc, ctl, vendor client etc) for this mesh provisioner.

    Just follow "handle_config_model_publication_set", it seems ok. We may do "publication set" operations to many server. 

    if we do "generic_onoff_client_set()", it will send data to many server(not point to point).

    What i focus on how to implement it by point to point? 

    For example, A: provisioner + onoff client. B: onoff server, node addr: 0x123, B: onoff server, node addr: 0x124, 

    We may bind "B+C onoff server" with "A onoff client". but at one time,  we only want to control one of  B or C.

    As i understand, it seems be fixed with the second way(packet_tx()).let me study it.

    BR.

    Tim

  • So Sad,

    From Mesh SDK, I learn that the client can only reflect one server.

    Code: 

    packet_tx--->

    dsm_address_get(m_model_pool[handle].model_info.publish_address_handle, &dst_address)

    The "publish_address_handle" is static after setting. we can not use dynamic way to transfer address.

  • Hi Tim,

    I am not sure I fully understand what you plan to do. 
    To send data to multiple node with one packet, you can use a group address that those node subscribed to. 

    If you want to send data to one node at a time, B and then C for example. You first set the publication address to B. Send the packet. After that you set the publication address to C , then you send the new packet. 

    If you use nrf_mesh_packet_send() you simple set the destination address there. 

  • If you want to send data to one node at a time, B and then C for example. You first set the publication address to B. Send the packet. After that you set the publication address to C , then you send the new packet. 

    Yes, it is correct image. but after test,

    1, set B into publish_address_handle, (Ok, and node address is ok)

    2, set C into publish_address_handle,(Ok, and node address is ok, because B and C are new address)

    3, when trying to switch the C to B, it preforms wrong (Wrong, Still C,  because B is existed. it will not set)

    Anyway, i make some changes for exchanging the node address into  publish_address_handle. and not store these publish_address_handle for fitting my application. 

    (After view Nordic DevZone, there are some engineers confused about this handle,it is big different from other platforms)

  • I'm not sure which function you are calling at step 1 2 and 3.

    You can to store the address handle you have and reuse later. If you don't store it and want to get it back from the list, you call dsm_address_handle_get() to get the handle from the address. 
    Think of the DSM as a database of addresses that's stored on the flash. All library uses the handles in DSM instead of directly use the address. 

Related