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

Use a REPLY instead of a PUBLISH to transmit state from a server to a client, (on a transmission initiated by the client)

Hello,

Here is a summary of my main transmission protocol:

The (unique) client contact one of the many servers to get the value of a particular server's state.

In the light_switch application the server, in the handle_set_cb use the access_model_reply to acknowledge the client and then the access_model_publish to publish the state back to the client.

In the handle_get_cb, only the access_model_publish is used.

On client side, I managed to retrieve the sever state (ON or OFF) only with the sever handle_set_cb function, which will trigger the client client_status_cb thanks to the sever access_model_publish.

However when I use the client simple_on_off_client_get I cannot retrieve (get) the server's state, as the client_status_cb is not called when the server only use the access_model_reply.

Therefore, each time my client want to receive the state of the server, the server has to first reply and then publish, which will trigger two communications (doubling the network traffic).

My question would be:

Is it possible  to only use the server access_model_reply to transmit the concerned state to the client, rather than have to first use access_model_reply and then access_model_publish ? (to reduce the network traffic)

Thanks!

Parents
  • I just figured out, that the reliable_status_cb  in simple_on_off_client.c do exactly what I needed.

    in reliable_status_cb :

    "

       simple_on_off_client_t * p_client = p_args;
        NRF_MESH_ASSERT(p_client->status_cb != NULL);
     
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "we got an Acknowledgment = %d \n", p_client->state.data.on_off);

    "

    No need for the publish anymore.

    In case someone is the same situation as I was.

Reply
  • I just figured out, that the reliable_status_cb  in simple_on_off_client.c do exactly what I needed.

    in reliable_status_cb :

    "

       simple_on_off_client_t * p_client = p_args;
        NRF_MESH_ASSERT(p_client->status_cb != NULL);
     
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "we got an Acknowledgment = %d \n", p_client->state.data.on_off);

    "

    No need for the publish anymore.

    In case someone is the same situation as I was.

Children
No Data
Related