Use of Scene Server in BLE mesh with nRF52840

Hi,

I'd like to know how can I implement a Scene Server for one or more Generic Onoff Servers (typically leds).

I read the documentation related to Scene Server and I understood that I have to implement the following functions:

  • scene_store
  • scene_recall
  • scene_recall_complete

and the structure:

  • BT_MESH_SCENE_ENTRY_SIG(onoff)
Is this correct?
Can you give me an example code with one or more generic onoff server and a scene server (I'd like to recall a scene in which one or more led are lighted on)?
Thanks
Best regards
Parents
  • Hi,

    For Generic OnOff servers, scenes are already implemented (see <sdk folder>\nrf\subsys\bluetooth\mesh\gen_onoff_srv.c), so there is no need to manually implement it. The documentation at Adding scene data for a model is for reference if you need to implement the functionality for a custom model.

    Make sure to add the Scene Server at the first element containing a Generic OnOff server which you want to include in the scene (or at an element before that), and check that configs (such as CONFIG_BT_MESH_SCENES_MAX) are appropriate.

    For code reference for a device with a scene server added, see the Bluetooth Mesh: Light fixture sample, where the scene server is added using the BT_MESH_MODEL_SCENE_SRV macro in the elements listing near line 248 in <sdk folder>\nrf\samples\bluetooth\mesh\light_ctrl\src\model_handler.c.

    Regards,
    Terje

Reply
  • Hi,

    For Generic OnOff servers, scenes are already implemented (see <sdk folder>\nrf\subsys\bluetooth\mesh\gen_onoff_srv.c), so there is no need to manually implement it. The documentation at Adding scene data for a model is for reference if you need to implement the functionality for a custom model.

    Make sure to add the Scene Server at the first element containing a Generic OnOff server which you want to include in the scene (or at an element before that), and check that configs (such as CONFIG_BT_MESH_SCENES_MAX) are appropriate.

    For code reference for a device with a scene server added, see the Bluetooth Mesh: Light fixture sample, where the scene server is added using the BT_MESH_MODEL_SCENE_SRV macro in the elements listing near line 248 in <sdk folder>\nrf\samples\bluetooth\mesh\light_ctrl\src\model_handler.c.

    Regards,
    Terje

Children
Related