1 Reply Latest reply on Oct 22, 2020 6:36 AM by DheerajP_41

    Is it possible to pass custom structure through dimmer mesh application ?

    RaSa_4767806

      Hi,

       

      I would like to know is it possible to pass the custom data from dimmer through wiced_bt_mesh_model_level_client_set(0, is_final, &set_data); in this api the set_data is declared as wiced_bt_mesh_level_set_level_t set_data.

       

      The question is if I create a new structure of having more than 10 bytes of data as follows,

       

      typedef struct

      {

          uint8_t cd_1;

          uint8_t cd_2;

          uint8_t cd_3;

          uint8_t cd_4;

          uint8_t cd_5;

          uint8_t cd_6;

      } app_mesh_Custom_data_t;

       

      app_mesh_Custom_data_t custom_data;

       

      and pass this structure through same api wiced_bt_mesh_model_level_client_set(0, is_final, &custom_data);

       

      At Light dimmable side function mesh_app_process_set_level(element_idx, (app_mesh_Custom_data_t *)p_data); is called when event is received and Data type of p_data is declared as same custom structure defined in dimmer.

       

      When parsed the received structure getting different value for each of structure member (checked via trace).

      Passing values from dimmer as "cd1 = 0x01, cd2 = 0x02, cd3 = 0x03, cd4 = 0x04, cd5 = 0x05, cd6 = 0x06", but at light dimmable getting values as "cd1 = 1, cd2 = 130, cd3 = 5, cd4 = 66, cd5 = 1; cd6 = 130"; or "cd1 = 0, cd2 = 130, cd3 = 4, cd4 = 66, cd5 = 0; cd6 = 130"

       

      Adding to this based on the "cd1" value i am able to toggle the LED on light dimmable dev bored. On dimmer side on every switch press, only "cd1" value is toggled between 0 and 1.

       

      To brief you about my project is i would like to pass or broadcast power monitor data, along with environment data.

       

      If it is possible to do this, is it a correct way to do, or is there anything i am missing or not having clear understanding of code.

      if possible what would be the way to perform this ?

       

      Development board is used:- CYBT 423028 EVAL,

      using WICED Studio ver 6.4.

       

       

      Thank You !!

        • 1. Re: Is it possible to pass custom structure through dimmer mesh application ?
          DheerajP_41

          Hi,

           

          wiced_bt_mesh_model_level_client_set() expects the third parameter in wiced_bt_mesh_level_set_level_t structure format. You cannot customize it since the definition is located inside the model library.

           

          /**

          * \brief The application can call this function to send Set Level client message. The function parameters doe not contain any information on where and how the

          * message has not be sent because configuration has been done by the Confoguration client.

          *

          * This function will likely be used in the controlling application

          * where application remembers the target Level state. If application does not remember the target state, the send_delta is more appropriate.

          *

          * @param       element_idx Device element to where model is used

          * @param       is_final WICED_TRUE, if this is a final set command.  WICED_FALSE if application expects more commands to come.

          * @param       p_data Pointer to the data with current level and transition time

          *

          * @return      WICED_BT_SUCCESS if message has been queued for transmission.

          */

          wiced_result_t wiced_bt_mesh_model_level_client_set(uint8_t element_idx, wiced_bool_t is_final, wiced_bt_mesh_level_set_level_t *p_data);

           

           

          If you would like to create a custom model, you can use vendor_specific_app, and add your own logic on top of it.

          Please refer below two applications.

          mtb-example-btsdk-mesh-snip-perf-testing app shows how to transfer adv tx power.

           

          Thanks,

          -Dheeraj