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

Broadcast Mesh Message

Hi,

I'm trying to send a broadcast message from my client to all my server. Actually i'm working over a modifed version of the light switch example.

i saw that in the node_setup of the provisioner the server address is set.

The easiest thing that i thought to do the broadcast is to change this part from this

if ((m_current_node_addr % 0x02))
{
    address.value  = GROUP_ADDRESS_ODD;
}
else
{
    address.value  = GROUP_ADDRESS_EVEN;
}

to this

address.value = GROUP_ADDRESS_ODD;

And then on the client side doing this

static void button_event_handler(uint32_t button_number)
{
    ...
    
    status = simple_on_off_client_set_unreliable(&m_clients[3],
                                                         &ptr[0],4,
                                                         GROUP_MSG_REPEAT_COUNT);
                                                         
    ...
}

I should be able to send a message to all server. Actually the message is recived but after the 1st time i send it the client stop work but not getting any errors. The client just looks like he's lost on his code.

Any suggestion?

The only change that i've made to this code is the possibility to send an array of values and i added as well the code for the dfu even if that last part has not been tested yet.

Thanks for the help.

Parents
  • Very sorry for the delayed response. It seems like you are using the regular provisioning example. What changes have you made to the simple_on_off_client_set_unreliable() function? I understand the first argument , but what about the second & third arguments?

    What does the log for the client & server look like? Could you upload it please?

    It seems like you are doing the correct thing in the provisioner by making all of the server nodes subscribe to the GROUP_ADDRESS_ODD address.

    In the code below in node_setup.c of the provisioner:

            case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT3:
            {
                config_publication_state_t pubstate = {0};
                client_pub_state_set(&pubstate,
                                     m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT3,
                                     GROUP_ADDRESS_ODD);
                retry_on_fail(config_client_model_publication_set(&pubstate));
    
                static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
                expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
                break;
            }
    
            case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT4:
            {
                config_publication_state_t pubstate = {0};
                client_pub_state_set(&pubstate,
                                     m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT4,
                                     GROUP_ADDRESS_EVEN);
                retry_on_fail(config_client_model_publication_set(&pubstate));
    
                static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
                expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
                break;
            }

    You could try to change the GROUP_ADDRESS_EVEN in client_pub_state_set() to GROUP_ADDRESS_ODD & see if that makes a difference. I am not sure it will, but it could be worth a shot.

    If you use the smartphone as the provisioner with the nrf mesh app & the proxy client & proxy server examples, it is really easy to setup a group address. The generic on off client model on the client can publish to a group address (e.g. 0xc001) & all of the servers can subscribe to this address in their respective generic on off server models. Take a look at this youtube video for more info.

    In addition, here are two pdf's which explain the steps further:

    Mesh Hands-on Android_october2018.pdf

    Mesh Hands-on iOS_October2018.pdf

    Hope that helps!

Reply
  • Very sorry for the delayed response. It seems like you are using the regular provisioning example. What changes have you made to the simple_on_off_client_set_unreliable() function? I understand the first argument , but what about the second & third arguments?

    What does the log for the client & server look like? Could you upload it please?

    It seems like you are doing the correct thing in the provisioner by making all of the server nodes subscribe to the GROUP_ADDRESS_ODD address.

    In the code below in node_setup.c of the provisioner:

            case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT3:
            {
                config_publication_state_t pubstate = {0};
                client_pub_state_set(&pubstate,
                                     m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT3,
                                     GROUP_ADDRESS_ODD);
                retry_on_fail(config_client_model_publication_set(&pubstate));
    
                static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
                expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
                break;
            }
    
            case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT4:
            {
                config_publication_state_t pubstate = {0};
                client_pub_state_set(&pubstate,
                                     m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT4,
                                     GROUP_ADDRESS_EVEN);
                retry_on_fail(config_client_model_publication_set(&pubstate));
    
                static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
                expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
                break;
            }

    You could try to change the GROUP_ADDRESS_EVEN in client_pub_state_set() to GROUP_ADDRESS_ODD & see if that makes a difference. I am not sure it will, but it could be worth a shot.

    If you use the smartphone as the provisioner with the nrf mesh app & the proxy client & proxy server examples, it is really easy to setup a group address. The generic on off client model on the client can publish to a group address (e.g. 0xc001) & all of the servers can subscribe to this address in their respective generic on off server models. Take a look at this youtube video for more info.

    In addition, here are two pdf's which explain the steps further:

    Mesh Hands-on Android_october2018.pdf

    Mesh Hands-on iOS_October2018.pdf

    Hope that helps!

Children
No Data
Related