Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Client side (on the light switch example) to receive broadcast messages

I am estudying and modifying the light switch example.

the example shared in the SDK, this example works as star network. (1 client and 3 (or many) servers) where:

- The client sends (unicast and broadcast) messages to servers

- The server only sends unicast messages (reply) to client.

In this moment I already can to send and receive broadcast messages between the servers, but in this message type, the client side does not treat  the message.

What modification I need to do, to client side "undestand" that him are receiving a broadcast messages?

  • The question is:

    Why the servers receives the broadcast messages and the client not?

    what function do I need to modify to the client receives the broadcast messages?

  • I think it might be of interest to take a look at this devzone post. It seems some people have had a few difficulties, but most people have gotten it working after debugging a bit. 

  • Hi Bjorn,

    This post didnt help me because, I already did the communication between client and server by unicast messages.

    What I wanna do now is subscribe tha client to receive broadcast messages since in tlight switch example only server side receive the broadcast messages, the client side dont..

    How I told above, I already  send broadcast messages from server to server (trought 0xCAFE address), but the client dont receive these messages because it is not subscribed.

    I need to modify the light switch example to init the client side able to receive broadcast messages.

  • As you probably already know, the simple_on_off_client_set_unreliable() function inside the simple_on_off_client.c file in the light switch client example (mesh sdk 1.0.1) sends the broadcast messages from the client to the server. I believe you could add this function to the server (which you might have already done) & before you call the access_model_publish() function, you can call this function:

    void address_set(uint16_t addr)
    {
        ERROR_CHECK(dsm_address_publish_add(addr, &m_central_handle));
        ERROR_CHECK(access_model_publish_address_set(m_server.model_handle, m_central_handle));
    }

    where, addr is the GROUP_ADDRESS (0xCAFE), m_central_handle is defined as:

    static dsm_handle_t m_central_handle;

    & m_server is already defined in main.c of the light_switch_server example. This should hopefully set the group address in the server & allow you to broadcast a message from the server to the client.

    I am not fully certain this will work, but it is a starting point.

Related