Bluetooth Mesh Sensor Server Model#
Bluetooth Mesh Sensor Server Model.
This class provides the commands and messages to interface with the Sensor Server model.
A Sensor State consists of four states:
Sensor Descriptor
Sensor Setting
Sensor Cadence
Measurement value
A multisensor setup is possible by having multiple sensor states within the same model, provided that each sensor has a unique Sensor Property ID.
Sensor Descriptor states are constant. Therefore, the stack can cache them and enumerate the present sensors to clients when requested.
Currently, the Sensor Server model does not cache the measurement data, sensor settings, or cadence. When a client is querying sensor data, the requests will be propagated to the application.
Modules#
sl_btmesh_evt_sensor_server_get_request
sl_btmesh_evt_sensor_server_get_column_request
sl_btmesh_evt_sensor_server_get_series_request
sl_btmesh_evt_sensor_server_publish
Functions#
Macros#
Function Documentation#
sl_btmesh_sensor_server_init#
sl_status_t sl_btmesh_sensor_server_init (uint16_t elem_index, size_t descriptors_len, const uint8_t * descriptors)
[in] | elem_index | Server model element index |
[in] | descriptors_len | Length of data in |
[in] | descriptors | Sensor Descriptor State structures submitted as a byte array A sensor descriptor represents the attributes describing the sensor data. It does not change throughout the lifetime of the element. The following fields are required:
Sensor Property ID is a 2-octet value referencing a device property that describes the meaning and the format of data reported by the sensor. The value 0x0000 is prohibited. Valid range is 0x0001 to 0xFFFF. |
Initialize the Sensor Server model with Sensor Descriptors present at the element. The descriptors are cached and Descriptor Get queries are served without propagating it to the application. All incoming client queries are checked against the cached data. However, only valid requests related to existing sensors are propagated to the the application.
Returns
SL_STATUS_OK if successful. Error code otherwise.
11791
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_sensor_server_deinit#
sl_status_t sl_btmesh_sensor_server_deinit (uint16_t elem_index)
[in] | elem_index | Server model element index |
Deinitialize the Sensor Server functionality. Note that the heap reserved space cannot be freed or reallocated. Reinitializing with greater number of sensors than before will eventually return an out of memory error until the device is reset.
Returns
SL_STATUS_OK if successful. Error code otherwise.
11807
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_sensor_server_send_descriptor_status#
sl_status_t sl_btmesh_sensor_server_send_descriptor_status (uint16_t client_address, uint16_t elem_index, uint16_t appkey_index, uint8_t flags, size_t descriptors_len, const uint8_t * descriptors)
[in] | client_address | Destination client address. The address 0x0000 can be used to publish the message according to model configuration |
[in] | elem_index | Server model element index |
[in] | appkey_index | The application key index to use. |
[in] | flags | No flags defined currently |
[in] | descriptors_len | Length of data in |
[in] | descriptors | Serialized Sensor Descriptor states for all sensors within the element consisting one or more 8 bytes structures as follows:
|
Send a Descriptor Status message either as a reply to a Get Descriptor client request.
Returns
SL_STATUS_OK if successful. Error code otherwise.
11831
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_sensor_server_send_status#
sl_status_t sl_btmesh_sensor_server_send_status (uint16_t client_address, uint16_t elem_index, uint16_t appkey_index, uint8_t flags, size_t sensor_data_len, const uint8_t * sensor_data)
[in] | client_address | Destination client address. The address 0x0000 can be used to publish the message according to model configuration |
[in] | elem_index | Setup Server model element index |
[in] | appkey_index | The application key index to use |
[in] | flags | No flags defined currently |
[in] | sensor_data_len | Length of data in |
[in] | sensor_data | Serialized Sensor Data consisting of one or more Sensor state for each sensor within the element. To simplify processing, the byte array is in TLV format:
If sensor data was requested for a Property ID that does not exist within the element, the reply must contain the given Property ID with zero length. |
Send Sensor Status message as a reply to a Get client request or as an unsolicited message.
Returns
SL_STATUS_OK if successful. Error code otherwise.
11868
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_sensor_server_send_column_status#
sl_status_t sl_btmesh_sensor_server_send_column_status (uint16_t client_address, uint16_t elem_index, uint16_t appkey_index, uint8_t flags, uint16_t property_id, size_t sensor_data_len, const uint8_t * sensor_data)
[in] | client_address | Destination client address. The address 0x0000 can be used to publish the message according to model configuration |
[in] | elem_index | Client model element index |
[in] | appkey_index | The application key index to use. |
[in] | flags | No flags defined currently |
[in] | property_id | Property ID for the sensor. Range: 0x0001 - 0x0ffff for a specific device property, the value 0x0000 is prohibited. |
[in] | sensor_data_len | Length of data in |
[in] | sensor_data | Byte array containing the serialized Sensor Series Column state in the following format:
If the Property ID or the column ID (Raw value X) does not exist, the reply must contain only these two fields, omitting the optional Column Width and Raw Value Y fields. |
Send Column Status message as a response to a Column Get client request or as an unsolicited message
Returns
SL_STATUS_OK if successful. Error code otherwise.
11906
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_sensor_server_send_series_status#
sl_status_t sl_btmesh_sensor_server_send_series_status (uint16_t client_address, uint16_t elem_index, uint16_t appkey_index, uint8_t flags, uint16_t property_id, size_t sensor_data_len, const uint8_t * sensor_data)
[in] | client_address | Destination client address. The address 0x0000 can be used to publish the message according to model configuration |
[in] | elem_index | Client model element index |
[in] | appkey_index | The application key index to use. |
[in] | flags | No flags defined currently |
[in] | property_id | Property ID for the sensor. Range: 0x0001 - 0x0ffff for a specific device property, the value 0x0000 is prohibited. |
[in] | sensor_data_len | Length of data in |
[in] | sensor_data | Byte array containing the serialized sequence of Sensor Series Column states in the following format:
If Property ID does not exist in the element, the reply must contain only the given Property ID, omitting the other optional fields to column identifiers and column values. |
Send Series Status message as a response to a Series Get client request or as an unsolicited message.
Returns
SL_STATUS_OK if successful. Error code otherwise.
11952
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
Macro Definition Documentation#
sl_btmesh_cmd_sensor_server_init_id#
#define sl_btmesh_cmd_sensor_server_init_idValue:
0x00470028
11625
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_sensor_server_deinit_id#
#define sl_btmesh_cmd_sensor_server_deinit_idValue:
0x01470028
11626
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_sensor_server_send_descriptor_status_id#
#define sl_btmesh_cmd_sensor_server_send_descriptor_status_idValue:
0x02470028
11627
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_sensor_server_send_status_id#
#define sl_btmesh_cmd_sensor_server_send_status_idValue:
0x03470028
11628
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_sensor_server_send_column_status_id#
#define sl_btmesh_cmd_sensor_server_send_column_status_idValue:
0x04470028
11629
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_sensor_server_send_series_status_id#
#define sl_btmesh_cmd_sensor_server_send_series_status_idValue:
0x05470028
11630
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_sensor_server_init_id#
#define sl_btmesh_rsp_sensor_server_init_idValue:
0x00470028
11631
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_sensor_server_deinit_id#
#define sl_btmesh_rsp_sensor_server_deinit_idValue:
0x01470028
11632
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_sensor_server_send_descriptor_status_id#
#define sl_btmesh_rsp_sensor_server_send_descriptor_status_idValue:
0x02470028
11633
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_sensor_server_send_status_id#
#define sl_btmesh_rsp_sensor_server_send_status_idValue:
0x03470028
11634
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_sensor_server_send_column_status_id#
#define sl_btmesh_rsp_sensor_server_send_column_status_idValue:
0x04470028
11635
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_sensor_server_send_series_status_id#
#define sl_btmesh_rsp_sensor_server_send_series_status_idValue:
0x05470028
11636
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h