Lightness Client#

Used to support the functionality of a node that can set the dim level of a light source (Lightness Server) on another node. This component integrates the Generic OnOff Client functionality, for ease of use. It provides functions to change the dim value by, or set the dim value to a certain percentage, and a function for getting the current lightness level. This component is prepared for integration into SOC applications. This is a Low-Code component. For example, toggling all Light Lightness Servers in the network can be achieved by adding an event handler for mesh events and calling the following code: #include "sl_btmesh_lighting_client.h" void event_handler(sl_btmesh_msg_t *evt) { case sl_btmesh_evt_node_initialized_id: if (evt->data.evt_node_initialized.provisioned) { sl_btmesh_change_switch_position(SL_BTMESH_LIGHTING_CLIENT_TOGGLE); } break; }

Functions#

void
sl_btmesh_set_lightness(uint8_t new_lightness_percentage)
void

Macros#

#define
SL_BTMESH_LIGHTING_CLIENT_OFF 0

Set switch state to off.

#define
SL_BTMESH_LIGHTING_CLIENT_ON 1

Set switch state to on.

#define
SL_BTMESH_LIGHTING_CLIENT_TOGGLE 2

Toggle switch state.

Function Documentation#

sl_btmesh_set_lightness#

void sl_btmesh_set_lightness (uint8_t new_lightness_percentage)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]new_lightness_percentage

Defines new lightness value as percentage Valid values 0-100 %

This function change the lightness and send it to the server.


sl_btmesh_change_switch_position#

void sl_btmesh_change_switch_position (uint8_t position)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]position

Defines switch position change, possible values are:

  • SL_BTMESH_LIGHTING_CLIENT_OFF

  • SL_BTMESH_LIGHTING_CLIENT_ON

  • SL_BTMESH_LIGHTING_CLIENT_TOGGLE

This function change the switch position and send it to the server.


sl_btmesh_get_lightness#

uint16_t sl_btmesh_get_lightness (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Get lightness.

This function returns actual lightness to set.

Returns

  • Actual lightness value