nRF Connect SDK API 0.1.0
|
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.
[in] | format | Format to use when encoding the sensor value. |
[in] | status | The bt_mesh_sensor_value_status value to convert. |
[out] | sensor_val | The resulting bt_mesh_sensor_value on success. Unchanged otherwise. |