nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches

◆ bt_mesh_sensor_value_from_special_status()

int bt_mesh_sensor_value_from_special_status ( const struct bt_mesh_sensor_format * format,
enum bt_mesh_sensor_value_status status,
struct bt_mesh_sensor_value * sensor_val )

#include <include/bluetooth/mesh/sensor.h>

Convert a bt_mesh_sensor_value_status value to a bt_mesh_sensor_value.

This is useful for creating a bt_mesh_sensor_value representing a special status value like BT_MESH_SENSOR_VALUE_UNKNOWN or BT_MESH_SENSOR_VALUE_TOTAL_DEVICE_LIFE.

This cannot be used to create a value representing BT_MESH_SENSOR_VALUE_NUMBER. Use one of bt_mesh_sensor_value_from_sensor_value, bt_mesh_sensor_value_from_micro or bt_mesh_sensor_value_from_float instead.

Not all formats can represent all special status values. In the case where the supplied status value cannot be represented by the format, this function will return a (negative) error code.

Parameters
[in]formatFormat to use when encoding the sensor value.
[in]statusThe bt_mesh_sensor_value_status value to convert.
[out]sensor_valThe resulting bt_mesh_sensor_value on success. Unchanged otherwise.
Returns
0 on success, (negative) error code otherwise.