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

how to set mesh model publish address to a client model which is on other mesh node

I have three mesh nodes in a mesh network, a provisioner, a vendor server model, and a vendor client model.

I know that a provisioner can set client model publish address to a server model address via access_model_publish_address_set(...) if the client model is on the same mesh node(provisioner).

But I need to set client model publish address on another mesh node.

Is there anybody can tell me how to do that?

Update: Sorry, I didn't describe my question clearly. I need to set publish address on a node which is not a provisioner, just a node with a vendor client model. There is another node with a vendor server model, and I have already implemented a configuration server on both client and server model node. I know how to set publish address on a provisioner node, but I don't know how to get the server model address on a non-provisioner node for access_model_publish_address_set(…). Or publish address assignment has only to be done once, all client models will be assigned the same publish address?

Parents
  • Please be aware that client and server is not a role or type of a node. They are types of model. A node can have several models and can be client and server.

    Assigning publish address is the configuration client job. You would need to implement a configuration server on the node you want to set publish address (your "client node")

    Please follow the implementation of config server we have in the light switch server example.

  • I understand you. As I mentioned, the configuration server will need to receive the command from the configuration client to set the publication address. In our example, we set that inside do_config_step() in provisioner.c at PROV_STATE_CONFIG_PUBLICATION_ONOFF state. You can find that each of the light switch server was set to the address: PROVISIONER_ADDRESS + m_target_address - UNPROV_START_ADDRESS; The m_target_address is increased after each light switch server. You can do the same to your client node.

    On the server side, the command will be handled in handle_config_model_publication_set() in config_server.c. You can find inside this function, the address is set locally and access_model_publish_address_set() will be called as you saw on the provisioner code.

    So, basically, you need to follow what our provisioner does to set the public address of the server to do the same to your client node.

  • I post here as seems it is my follow-up question about the issue, if you find it is more proper to issue another ticket, please advice.

    So, I understand we need to use the config_client_model_subscription_add at the client, such that, it can assign the specific server can listen to those message to the address that assigned.

    However, when digging deeper, it found that the config_client always send the message to m_client.model_handle in send_reliable functions, while the m_client.model_handle seems always assigned to the server that last touched.

    So, how should I modify the address that the server that already configured, and some other device is provisioned afterwards thru the config_client model?.

    I cant find a proper helper function of the config_client to handle the m_client.model_handle.

  • I don't get it Ajay. 

    config_client_model_subscription_add() is called for all server and all of them subscribe to GROUP_ADDRESS. I don't see any problem with config_client_model_subscription_add() function. The m_target_address is the address of the server and the address is the group address. Are you sure you looking at the correct function ? 

Reply Children
  • Hi Hung Bui,

    In my project, i will have more than on Group of device.

    Say i have Group 0xCAFE, 0xCAFF, 0xCB00

    So, it is understand that if i put a server into a specific group, i can use config_client_model_subscription_add()

    But, if i later, i would like to reassign the device to the other Group, say Gp 0xCb00 - > 0xCafe, i will use the function config_client_model_subscription_overwrite

    so, config_client_model_subscription_overwrite->subscription_add_del_owr_send->send_reliable

    while the send_reliable handle is m_client.model_handle;

    And this m_client.model_handle, will always pointed to the last provision device in the stack. Does it make sense to you, or i have overlook anything?

  • Should i call ERROR_CHECK(config_client_server_set(m_devkey_handles[client_idx],m_server_handles[client_idx]));

    for each client, before i call config_client_model_subscription_overwrite??

  • Yes, if you are planning to change the publication address of a server remotely, you should call config_client_server_set() for each node. This basically change the publication address of the config client. 


    If you want to change the publication address of a model on a node locally, you can call access_model_publish_address_set()

Related