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

Modifying the Light Switch example Mesh SDK 2.2.0

Hello mates,

I am modifying the Light Switch Client and Server example, to send messages uint8_t from the client to the server instead of use bool on_ff with no luck yet, for the behavior I am experimenting I am not sure if the provisioner play a role for the messages between nodes, as far as I know the provisioner is used only to join nodes in the network and authentication.

few changes I did:

inside generic_onoff_common.h I changed bool on_off to uint8_t on_off

/** Mandatory parameters for the Generic OnOff Set message. */
typedef struct
{
    uint8_t on_off; // bool on_off;                          /**< State to set */
    uint8_t tid;                                            /**< Transaction ID */
} generic_onoff_set_params_t;

changes on the button handle (main.c)

    switch(button_number)
    {
        case 0:
                set_params.on_off = 1;
                 break;
        case 1:
                 set_params.on_off =20;
                break;
    }

inside message_set_packet_create()  p_set->on_off = p_params->on_off ? 1 : 0; to p_set->on_off = p_params->on_off;

inside the server code at app_onoff.c I watch for generic_onoff_state_set_cb() handler and it is triggered only when received 0 or 1

Back to the Client Code

Before transmit using access_model_publish() I verify that the p_buffer has the correct data at access_reliable.c -> access_model_reliable_publish() adding the following:

___LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "p_reliable->message.p_buffer[0] on_off [%d] \n", p_reliable->message.p_buffer[0])

access_model_publish() always returns 0 (that's fine) it does not matter what values p_buffer[0] has, but if values are different than 0 or 1, I got the following message:

main.c,  129, Acknowledged transfer timeout. and not being received for the server node

Can someone give an advise how to send messages to the server from a client node?

Regards,

Meliodas

#################

#update 

well I solved my issue, not sure what was wrong, I rebuild again the 3 projects (I did it before) and suddenly it start to work

now I am trying to add a new field/variable uint8_t or uint32_t to generic_onoff_set_msg_pkt_t and generic_onoff_status_params_t and I am having the same issue than before, so it is really confusing to me lol, some advice will be really appreciated the server is not getting the new data variable, after clean and rebuild 3 the projects, and provisioning... 

Parents Reply Children
Related