5 Replies Latest reply on May 19, 2019 11:22 PM by DheerajP_41

    how to use 20735 mesh sendor models

    zhjic_4227711

      I download the sensor_temperature example to the 20735 boardA.Then I add a button event to the mesh_sensor_client example and download it to another boardB.However,when i push the button,I can't see  boardA recive the button event.Two boards are both provisioned.button code shows below:

      /*

      * Process interrupts from the button.

      */

      void button_interrupt_handler(void* user_data, uint8_t pin)

      {

          uint32_t value = wiced_hal_gpio_get_pin_input_status(pin);

          uint32_t current_time = wiced_bt_mesh_core_get_tick_count();

          uint32_t button_pushed_duration;

          WICED_BT_TRACE("button handler\r\n");

          wiced_bt_mesh_event_t *p_event;

          p_event = wiced_bt_mesh_create_event(0,MESH_COMPANY_ID_BT_SIG,WICED_BT_MESH_CORE_MODEL_ID_SENSOR_CLNT, 0xFFFF, 0xFFFF);

       

       

          if (value == 0)

          {

           //   WICED_BT_TRACE("interrupt_handler: duplicate pin:%d value:%d current_time:%u\n", pin, value, current_time);

              return;

          }

          if(p_event)

          {

              wiced_bt_mesh_sensor_setting_set_data_t sensor_data;

              wiced_result_t ret;

              uint8_t data[]="123";

              sensor_data.setting_property_id = 0x11;

              //sensor_data.setting_raw_val = data;

              memcpy(sensor_data.setting_raw_val,data,sizeof(data));

              sensor_data.prop_value_len=3;

              sensor_data.property_id=0x12;

              ret = wiced_bt_mesh_model_sensor_client_sensor_setting_send_set(p_event,&sensor_data);

              //wiced_bt_mesh_model_sensor_client_sensor_send_get();

              if(ret != 0)

              {

                  WICED_BT_TRACE("data send fail\r\n");

                  return;

              }

              WICED_BT_TRACE("data send sucess\r\n");

          }

        //  button_previous_value = value;

       

       

          //WICED_BT_TRACE("interrupt_handler: pin:%d value:%d current_time:%u\n", pin, value, current_time);

       

      }