Light Saturation Server
The Light Saturation Server controls the saturation of the light color. It should be instantiated in the light fixture node.
The Light Saturation Server adds a single model instance to the composition data, in addition to the extended Generic Level Server.
Although the Light Saturation Server contains range
and default
states like other lighting models, the states cannot be accessed directly by other nodes without a Light HSL Server.
States
- Saturation:
uint16_t
The Saturation controls the light’s color saturation. If the Saturation of a light is
0
, the light’s color is a completely gray scale, that is, white light. If the Saturation of a light is the maximum value of65535
, the color should be fully saturated.The Saturation state power-up behavior is determined by the On Power Up state of the extended Generic Power OnOff Server:
BT_MESH_ON_POWER_UP_OFF
- The Saturation state is set to the Default Saturation state on power-up.BT_MESH_ON_POWER_UP_ON
- The Saturation state is set to the Default Saturation state on power-up.BT_MESH_ON_POWER_UP_RESTORE
- The Saturation state is set to the last known Saturation value on power-up.
Your application is expected to hold the state memory and provide access to the state through the
bt_mesh_light_sat_srv_handlers
handler structure.Note
If the Saturation Server is part of an HSL Server, the application must publish the HSL status using
bt_mesh_light_hsl_srv_pub()
whenever the Saturation state changes. This is not handled automatically by the HSL Server.- Saturation Range:
bt_mesh_light_hsl_range
The Saturation Range is a meta state that defines the valid range for the Saturation state. The Saturation should never go outside the Saturation Range.
The memory for the Saturation Range state is held by the model, and the application may receive updates on state changes through the
bt_mesh_light_sat_handlers.range_update
callback.- Default Saturation:
uint16_t
The Default Saturation state is only used when the model is instantiated as part of a Light HSL Server. The Default Saturation determines the initial Saturation when the node is powered on, and the On Power Up state of the Light HSL Server’s extended Generic Power OnOff Server is
ON
orOFF
.The memory for the Default Saturation state is held by the model, and the application may receive updates on state changes through the
bt_mesh_light_sat_handlers.default_update
callback.
Extended models
The Light Saturation Server extends the following models:
As the state of the extended model is bound to the Saturation state, the extended model is not exposed directly to the application.
Persistent storage
The Light Saturation Server stores the following information:
Any changes to the Default Saturation and Saturation Range states.
The last known Saturation level.
This information is used to reestablish the correct Saturation level when the device powers up.
If CONFIG_BT_SETTINGS
is enabled, the Light Saturation Server stores all its states persistently using a configurable storage delay to stagger storing.
See CONFIG_BT_MESH_STORE_TIMEOUT
.
The Light Saturation Server can use the emergency data storage (EMDS) together with persistent storage for the following purposes:
Extend the flash memory life expectancy.
Reduce the use of resources by reducing the number of writes to flash memory.
If option CONFIG_EMDS
is enabled, the Light Saturation Server continues to store the default saturation and saturation range states to the flash memory through the settings library, but the last known saturation level is stored by using the EMDS library.
This split is done so the values that may change often are stored on shutdown only, while the rarely changed values are immediately stored in flash memory.
API documentation
include/bluetooth/mesh/light_sat_srv.h
subsys/bluetooth/mesh/light_sat_srv.c