Sensor Client#

Used to support the functionality of a node that can monitor sensor data and configure a set of sensors on another node. Sensor Client can connect to multiple Sensor Servers. It may operate on states defined by Sensor Server model and Sensor Setup model via Sensor messages. This component supports temperature, people count, and illuminance data. It provides callback functions for receiving these data, for events, such as when Sensor Server discovery has started, when a device is found. There is an interface to change the current property listened to and request data on said property. This component is prepared for integration into SOC applications. This can be a Low-Code component. The bare minimum for e.g. listening to a broadcast sensor server data is calling sl_btmesh_sensor_client_update_registered_devices on initialization and implementing the relevant weak callbacks. The provided callbacks are the following: void sl_btmesh_sensor_client_on_discovery_started void sl_btmesh_sensor_client_on_new_device_found void sl_btmesh_sensor_client_on_new_temperature_data void sl_btmesh_sensor_client_on_new_people_count_data void sl_btmesh_sensor_client_on_new_illuminance_data

Functions#

SL_ENUM(sl_btmesh_sensor_client_data_status_t)
void
sl_btmesh_sensor_client_on_new_device_found(uint16_t property_id, uint16_t address)
void
sl_btmesh_sensor_client_on_new_temperature_data(uint8_t sensor_idx, uint16_t address, sl_btmesh_sensor_client_data_status_t status, temperature_8_t temperature)
void
sl_btmesh_sensor_client_on_new_people_count_data(uint8_t sensor_idx, uint16_t address, sl_btmesh_sensor_client_data_status_t status, count16_t people_count)
void
sl_btmesh_sensor_client_on_new_illuminance_data(uint8_t sensor_idx, uint16_t address, sl_btmesh_sensor_client_data_status_t status, illuminance_t illuminance)
void
sl_btmesh_sensor_client_on_new_power_consumption_data(uint8_t sensor_idx, uint16_t address, sl_btmesh_sensor_client_data_status_t status, energy32_t power_consumption)
sl_status_t
sl_btmesh_sensor_client_update_registered_devices(mesh_device_properties_t property)
sl_status_t
sl_btmesh_sensor_client_get_sensor_data(mesh_device_properties_t property)
void

Macros#

#define
SL_BTMESH_SENSOR_POWER_CONSUMPTION_UNKNOWN ((energy32_t) 0xFFFFFFFF)

Represents an unknown value for power consumption sensor data.

#define
SL_BTMESH_SENSOR_POWER_CONSUMPTION_INVALID ((energy32_t) 0xFFFFFFFE)

Represents an invalid value for power consumption sensor data.

#define
SL_BTMESH_SENSOR_CLIENT_ILLUMINANCE_UNKNOWN ((illuminance_t) 0xFFFFFF)

Represents an unknown value for illuminance sensor data.

#define
SL_BTMESH_SENSOR_CLIENT_PEOPLE_COUNT_UNKNOWN ((count16_t) 0xFFFF)

Represents an unknown value for people count sensor data.

#define
SL_BTMESH_SENSOR_CLIENT_TEMPERATURE_UNKNOWN ((temperature_8_t) 0x7F)

Represents an unknown value for temperature sensor data.

Function Documentation#

SL_ENUM#

SL_ENUM (sl_btmesh_sensor_client_data_status_t )
Parameters
TypeDirectionArgument NameDescription
sl_btmesh_sensor_client_data_status_tN/A

Enumeration representing the status of the sensor data received from the sensor server.


sl_btmesh_sensor_client_on_discovery_started#

void sl_btmesh_sensor_client_on_discovery_started (uint16_t property_id)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]property_id

property id of the device being discovered.

Called when Sensor Server discovery is started

This is a callback which can be implemented in the application. Note

  • If no implementation is provided in the application, then the default weak implementation will be an empty function.


sl_btmesh_sensor_client_on_new_device_found#

void sl_btmesh_sensor_client_on_new_device_found (uint16_t property_id, uint16_t address)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]property_id

New property ID for which the new device was registered.

uint16_t[in]address

Address of the new device.

Called when a Device with the current Device Property ID was found

This is a callback which can be implemented in the application. Note

  • If no implementation is provided in the application, then the default weak implementation will be an empty function.


sl_btmesh_sensor_client_on_new_temperature_data#

void sl_btmesh_sensor_client_on_new_temperature_data (uint8_t sensor_idx, uint16_t address, sl_btmesh_sensor_client_data_status_t status, temperature_8_t temperature)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]sensor_idx

The sensor index represents the order the sensor servers were registered.

uint16_t[in]address

Address of the sensor server.

sl_btmesh_sensor_client_data_status_t[in]status

Determines if the data is valid, available or unknown

temperature_8_t[in]temperature

Measured temperature on the sensor server in 0.5 degree Celsius steps.

Called when temperature sensor data is received from one of the registered devices

This is a callback which can be implemented in the application. Note

  • If no implementation is provided in the application, then the default weak implementation will be an empty function.


sl_btmesh_sensor_client_on_new_people_count_data#

void sl_btmesh_sensor_client_on_new_people_count_data (uint8_t sensor_idx, uint16_t address, sl_btmesh_sensor_client_data_status_t status, count16_t people_count)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]sensor_idx

The sensor index represents the order the sensor servers were registered.

uint16_t[in]address

Address of the sensor server.

sl_btmesh_sensor_client_data_status_t[in]status

Determines if the data is valid, available or unknown

count16_t[in]people_count

Measured people count on the sensor server.

Called when people count sensor data is received from one of the registered devices.

This is a callback which can be implemented in the application. Note

  • If no implementation is provided in the application, then the default weak implementation will be an empty function.


sl_btmesh_sensor_client_on_new_illuminance_data#

void sl_btmesh_sensor_client_on_new_illuminance_data (uint8_t sensor_idx, uint16_t address, sl_btmesh_sensor_client_data_status_t status, illuminance_t illuminance)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]sensor_idx

The sensor index represents the order the sensor servers were registered.

uint16_t[in]address

Address of the sensor server.

sl_btmesh_sensor_client_data_status_t[in]status

Determines if the data is valid, available or unknown

illuminance_t[in]illuminance

Measured illuminance on the sensor server in lux with a resolution of 0.01. (0xFFFFFF represents unknown data)

Called when illuminance sensor data is received from one of the registered devices.

This is a callback which can be implemented in the application. Note

  • If no implementation is provided in the application, then the default weak implementation will be an empty function.


sl_btmesh_sensor_client_on_new_power_consumption_data#

void sl_btmesh_sensor_client_on_new_power_consumption_data (uint8_t sensor_idx, uint16_t address, sl_btmesh_sensor_client_data_status_t status, energy32_t power_consumption)
Parameters
TypeDirectionArgument NameDescription
uint8_t[in]sensor_idx

The sensor index represents the order the sensor servers were registered.

uint16_t[in]address

Address of the sensor server.

sl_btmesh_sensor_client_data_status_t[in]status

Determines if the data is valid, available or unknown

energy32_t[in]power_consumption

Measured power consumption on the sensor server in units of kilowatt-hours, with a precision of 1 Watt-hour

Called when energy monitor sensor data is received from one of the registered devices.

This is a callback which can be implemented in the application. Note

  • If no implementation is provided in the application, then the default weak implementation will be an empty function.


sl_btmesh_sensor_client_update_registered_devices#

sl_status_t sl_btmesh_sensor_client_update_registered_devices (mesh_device_properties_t property)
Parameters
TypeDirectionArgument NameDescription
mesh_device_properties_t[in]property

New property ID for which devices need to be registered.

Updating the list of registered devices. All previously registered device will be lost.

Generated callback: SL_WEAK void sl_btmesh_sensor_client_on_discovery_started(uint16_t property_id); SL_WEAK void sl_btmesh_sensor_client_on_new_device_found(uint16_t property_id, uint16_t address);

Returns

  • Status of the operation. Returns SL_STATUS_OK(0) if succeeded, non-zero otherwise.


sl_btmesh_sensor_client_get_sensor_data#

sl_status_t sl_btmesh_sensor_client_get_sensor_data (mesh_device_properties_t property)
Parameters
TypeDirectionArgument NameDescription
mesh_device_properties_t[in]property

New property ID for which devices need to be registered.

Requesting new sensor data for the currently selected sensor property ID.

Generated callback:

Called callback signature depends on the received sensor data type. The <> symbols marks the part which is different due to the different sensor types in these callbacks.

SL_WEAK void sl_btmesh_sensor_client_on_new_<sensor>_data( uint8_t sensor_idx, uint16_t address, sl_btmesh_sensor_client_data_status_t status, <sensor_data_type_t> <sensor_data>)

Returns

  • Status of the operation. Returns SL_STATUS_OK(0) if succeeded, non-zero otherwise.


sl_btmesh_handle_sensor_client_on_event#

void sl_btmesh_handle_sensor_client_on_event (sl_btmesh_msg_t * evt)
Parameters
TypeDirectionArgument NameDescription
sl_btmesh_msg_t *[in]evt

Pointer to incoming event

Handle Sensor Client events.

This function is called automatically after enabling the component.