3 Replies Latest reply on Sep 12, 2019 7:13 AM by VictorZ_46

    some questions about scene


      Hi :

          I encountered some problems when I realize more than one scene in the mesh_vendor_speficic_app project.

         there are two scene callback functions which are mesh_vendor_server_scene_store_handler and mesh_vendor_server_scene_recall_handler in the project

        as we know, if we want to create more than one scene, We should can get the scene numbers.

      however I don't know how to get the scene numbers and scene payload from the massage callback functions:


      uint16_t     mesh_vendor_server_scene_store_handler(uint8_t element_idx, uint8_t *p_buffer, uint16_t buffer_len);

      uint16_t     mesh_vendor_server_scene_recall_handler(uint8_t element_idx, uint8_t *p_buffer, uint16_t buffer_len, uint32_t transition_time, uint32_t delay);



        if there is any method to get the scene payload from the scene coming message p_buffer






        • 1. Re: some questions about scene

          When I print  the scene message by the uart . the message length buffer_len is 255,I doubt if this is the scene comming message

          • 2. Re: some questions about scene

            Hi :

               I have do an experiment which I  print the store scene callback funtion input parameters of the lightness server by uart.

                uint16_t wiced_bt_mesh_model_light_lightness_server_scene_store_handler(uint8_t element_idx, uint8_t *p_buffer,   uint16_t buffer_len);


            I can be sure the function can be called when I send the store scene commmand by the mesh client control


            the buffer_len is also  255. the API  wiced_bt_mesh_model_light_lightness_server_scene_store_handler should be  Parsed by Parsed correctly .


            who can tell me how to Parse the store scene and recall scene callback message!








            • 3. Re: some questions about scene

              All scene messages are processed by the scene server model of the mesh models library.  The library parses and validates all the messages.  The library also manages NVRAM locations.  Each scene is stored/restored from a specific NVRAM location. The number of scenes that device supports is configured in the libraries/common/mesh_app_lib/mesh_application.c.

                  wiced_bt_mesh_scene_max_num            = 10;

              The only thing that each specific model needs to worry about is filling information for the scene server on what information needs to be stored and consume this data during the restore. For that purpose, scene model will call registered model application handlers.


              For SIG defined models, each particular model manages states that needs to be stored and restored.  Lets consider a standard dimmable bulb.  The definition of the device will contain WICED_BT_MESH_MODEL_LIGHT_LIGHTNESS_SERVER.  If you check wiced_bt_mesh_models.h, the WICED_BT_MESH_CORE_MODEL_ID_LIGHT_LIGHTNESS_SRV model contains light_lightness_server_scene_store_handler and light_lightness_server_scene_recall_handler. When peer sends Scene Store or Scene Store Unacknowledged Opcode, the scene model goes through all models of the device and finds all scene_store handlers.  Scene model calls scene_store_handler so that each handler fills the buffer with the data that needs to be stored.  The light_lightness model copies all the data that needs to be stored into the buffer.  When device receives Recall Opcode, the scene model reads data from the NVRAM and calls the recall_handler so that light_lightness model sets lightness to the appropriate values.


              Note that application does not need to do anything for standard BT SIG models unless it changes model definition in the wiced_bt_mesh_models.h.


              For the vendor specific model when mesh_vendor_server_scene_store_handler is executed, the application needs to fill the buffer with vendor specific data that needs to be stored and return number of bytes that have been filled in the buffer.  Scene model will pass the same data to the mesh_vendor_server_scene_recall_handler during the recall operation. Make sure that vendor model returns the same number of bytes in the store and recall handlers.