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

Broadcast in Mesh 2.0.1

Hi,

I'm working with the light_switch example on Mesh 2.0.1 and I would like to modify the simple_on_off_client_set_unreliable function to broadcast to all servers in the network, no matter they are odd or even.

I had a look at this post, but it seems that it is for previous mesh version.

Is there a simple way to change the simple_on_off_client_set_unreliable function to send messages to the group address?

Thanks in advance!

BR,

Paulo Zacarias

  • FormerMember
    0 FormerMember

    First, please have a look at this post, it shows how to assign a group address.

    After adding the group address and group handle to dsm_address_publish_add(), I would think you should be able to add the necessary parameters to simple_on_off_client_set_unreliable().

  • Hi Kristin,

    If I understood correctly, in this Mesh version 2.0.1 we don't have this broadcast address 0xCAFE. I looked at the function config_step_execute() int he node_setup.c on the provisioner side and we assign 2 group addresses, EVEN and ODD.

    Should I, as first step, change this code to attribute only the address 0xCAFE as group address to all nodes, regardless they are even or odd?

  • Hi,

    I am follwing this link to do the same thing (broadcasting a simple message through the nodes) in mesh 2.0.1.

    Could you suggest me the steps to be followed or differences in it when we are doing it in mesh 2.0.1?

  • FormerMember
    +1 FormerMember in reply to Paulo.Zacarias

    Yes, ODD and EVEN are just examples of groups. If the address of your group is 0xCAFE,  the following will have to be added/modified in example_network_configh.h node_setup.c in the light switch provisioner example.

    example_network_config.h
    
    #define GROUP_ADDRESS_CUSTOM  (0xCAFE)
     
    ******************************************
    
    
    node_setup.c
    
    
    typedef enum
    {
        ...
        // Add the node for belonging to the group CUSTOM (given address GROUP_ADDRESS_CUSTOM)
        NODE_SETUP_CONFIG_PUBLICATION_CUSTOM_CLIENT,
        NODE_SETUP_CONFIG_SUBSCRIPTION_CUSTOM_SERVER,
        ...
    } config_steps_t;
    
    /* Sequence of steps for the client nodes */
    static const config_steps_t client_config_steps[] =
    {
       ...
       // Add configuration of node CUSTOM to the client configuration sequence.
        NODE_SETUP_CONFIG_PUBLICATION_CUSTOM_CLIENT,
        ...
    };
    
    /* Sequence of steps for the server nodes */
    static const config_steps_t server_config_steps[] =
    {
        ...
        // Add configuration of node CUSTOM to the server configuration sequence.
        NODE_SETUP_CONFIG_SUBSCRIPTION_CUSTOM_SERVER,
        ...
    };
    
    /** Step execution function for the configuration state machine. */
    static void config_step_execute(void)
    {
    
    ...
    
    // Configuration for the server
     case NODE_SETUP_CONFIG_SUBSCRIPTION_CUSTOM_SERVER:
     {
         ...
          address.value  = GROUP_ADDRESS_CUSTOM;
         ...
     }
    
    // Configuration for the client
    case NODE_SETUP_CONFIG_PUBLICATION_CUSTOM_CLIENT:
    {
        config_publication_state_t pubstate = {0};
        client_pub_state_set(&pubstate,
                             m_current_node_addr + ELEMENT_IDX_CUSTOM_CLIENT,
                             GROUP_ADDRESS_CUSTOM);
        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;
    }
    
    ...
    
    }
    

Related