Bluetooth Mesh Generic Client Model#
Bluetooth Mesh Generic Client Model.
Generic client model API provides a functionality to send and receive messages using Bluetooth SIG client models, including generic client models and lighting client models.
In the API, the client model that is used is identified by its element address and model ID, while the server model responding to client model requests is identified by its element address and model ID.
The API has functions for querying server model states, requesting server model state changes, and publishing messages. The application has to implement more complex functionality (state machines or other model-specific logic).
Data for state change requests and server responses is passed as serialized byte arrays through BGAPI. There are functions to convert byte arrays to and from model state structures in the Bluetooth mesh SDK.
The stack will handle Mesh transaction layer segmentation and reassembly automatically if the messages sent are long enough to require it.
Note on time resolution
Because of message formatting, transition time and remaining time resolution units depend on the requested or reported value. For example, until 6.2 seconds it is 100 ms; until 62 seconds it is 1 s; until 620 seconds it is 10 s; and until 620 minutes it is 10 minutes. The value cannot be longer than 620 minutes. Therefore, it is not possible to request a delay of exactly 7500 ms. The resolution unit is 1 s between 6.2 and 62 seconds, so the value would be rounded down to 7 s.
Delay resolution is 5 ms and values will be rounded down to the closest 5 ms. The value can't be longer than 1275 ms.
Modules#
Generic Client Get State Types
Generic Client Set Request Types
sl_btmesh_evt_generic_client_server_status
Functions#
Macros#
Function Documentation#
sl_btmesh_generic_client_get#
sl_status_t sl_btmesh_generic_client_get (uint16_t server_address, uint16_t elem_index, uint16_t model_id, uint16_t appkey_index, uint8_t type)
[in] | server_address | Destination server model address |
[in] | elem_index | Client model element index |
[in] | model_id | Client model ID |
[in] | appkey_index | The application key index to use |
[in] | type | Model-specific state type, identifying the kind of state to retrieve. See Generic Client Get State Types list for details. |
Get the current state of a server model or models in the network. Besides the immediate result code, the response or responses from the network will generate server state report events for the replies received.
The server model responses will be reported in sl_btmesh_evt_generic_client_server_status events.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
5345
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_set#
sl_status_t sl_btmesh_generic_client_set (uint16_t server_address, uint16_t elem_index, uint16_t model_id, uint16_t appkey_index, uint8_t tid, uint32_t transition_ms, uint16_t delay_ms, uint16_t flags, uint8_t type, size_t parameters_len, const uint8_t * parameters)
[in] | server_address | Destination server model address |
[in] | elem_index | Client model element index |
[in] | model_id | Client model ID |
[in] | appkey_index | The application key index to use |
[in] | tid | Transaction identifier. This applies to those messages the Mesh Model specification defines as transactional and can be left as zero for others. |
[in] | transition_ms | Transition time (in milliseconds) for the state change. If both the transition time and the delay are zero, the transition is immediate. This applies to messages the Mesh Model specification defines to have transition and delay times and can be left as zero for others. |
[in] | delay_ms | Delay time (in milliseconds) before starting the state change. If both the transition time and the delay are zero, the transition is immediate. This applies to messages the Mesh Model specification defines to have transition and delay times and can be left as zero for others. |
[in] | flags | Message flags. Bitmask of the following:
|
[in] | type | Model-specific request type. See set request types list for details. |
[in] | parameters_len | Length of data in |
[in] | parameters | Message-specific set request parameters serialized into a byte array |
Set the current state of a server model or models in the network. Besides the immediate result code, the response or responses from the network will generate server state report events for the replies received.
The server model responses will be reported in sl_btmesh_evt_generic_client_server_status events. Note that for responses to be generated the corresponding flag needs to be set.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
5400
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_publish#
sl_status_t sl_btmesh_generic_client_publish (uint16_t elem_index, uint16_t model_id, uint8_t tid, uint32_t transition_ms, uint16_t delay_ms, uint16_t flags, uint8_t type, size_t parameters_len, const uint8_t * parameters)
[in] | elem_index | Client model element index |
[in] | model_id | Client model ID |
[in] | tid | Transaction identifier |
[in] | transition_ms | Transition time (in milliseconds) for the state change. If both the transition time and the delay are zero, the transition is immediate. This applies to messages the Mesh Model specification defines to have transition and delay times and can be left as zero for others. |
[in] | delay_ms | Delay time (in milliseconds) before starting the state change. If both the transition time and the delay are zero, the transition is immediate. This applies to messages the Mesh Model specification defines to have transition and delay times, and can be left as zero for others. |
[in] | flags | Message flags. Bitmask of the following:
|
[in] | type | Model-specific request type. See set request types list for details. |
[in] | parameters_len | Length of data in |
[in] | parameters | Message-specific set request parameters serialized into a byte array |
Publish a set request to the network using the publish address and publish application key of the model. The message will be received by the server models which subscribe to the publish address, and there's no need to explicitly specify a destination address or application key.
The server model responses will be reported in sl_btmesh_evt_generic_client_server_status events. To generate responses, the corresponding flag needs to be set.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
5458
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_get_params#
sl_status_t sl_btmesh_generic_client_get_params (uint16_t server_address, uint16_t elem_index, uint16_t model_id, uint16_t appkey_index, uint8_t type, size_t parameters_len, const uint8_t * parameters)
[in] | server_address | Destination server model address |
[in] | elem_index | Client model element index |
[in] | model_id | Client model ID |
[in] | appkey_index | The application key index to use. |
[in] | type | Model-specific state type, identifying the kind of state to retrieve. See Generic Client Get State Types list for details. |
[in] | parameters_len | Length of data in |
[in] | parameters | Message-specific get request parameters serialized into a byte array |
Get the current state of a server model or models in the network, with additional parameters detailing the request. Besides the immediate result code, the response or responses from the network will generate server state report events for the replies received.
The server model responses will be reported in sl_btmesh_evt_generic_client_server_status events.
This call is used to query properties, for which the property ID is given as a parameter.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
5498
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init#
sl_status_t sl_btmesh_generic_client_init ()
Initialize generic client models. This command initializes all generic client models on the device. Alternatively, only the necessary client models can be initialized using model-specific initialization commands. Using model-specific initialization can result in a smaller firmware image size for SoC projects.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5518
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_common#
sl_status_t sl_btmesh_generic_client_init_common ()
Initialize the generic client model common functionality. This command should be called after all model-specific initialization calls are done. It does not need to be called if sl_btmesh_generic_client_init is used.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5530
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_on_off#
sl_status_t sl_btmesh_generic_client_init_on_off ()
Initialize generic on/off client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5540
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_level#
sl_status_t sl_btmesh_generic_client_init_level ()
Initialize generic level client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5550
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_default_transition_time#
sl_status_t sl_btmesh_generic_client_init_default_transition_time ()
Initialize generic default transition time client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5560
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_power_on_off#
sl_status_t sl_btmesh_generic_client_init_power_on_off ()
Initialize generic power on/off client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5570
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_power_level#
sl_status_t sl_btmesh_generic_client_init_power_level ()
Initialize generic power level client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5580
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_battery#
sl_status_t sl_btmesh_generic_client_init_battery ()
Initialize generic battery client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5590
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_location#
sl_status_t sl_btmesh_generic_client_init_location ()
Initialize generic location client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5600
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_property#
sl_status_t sl_btmesh_generic_client_init_property ()
Initialize generic property client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5610
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_lightness#
sl_status_t sl_btmesh_generic_client_init_lightness ()
Initialize light lightness client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5620
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_ctl#
sl_status_t sl_btmesh_generic_client_init_ctl ()
Initialize light CTL client models.
Returns
SL_STATUS_OK if successful. Error code otherwise.
5630
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_generic_client_init_hsl#
sl_status_t sl_btmesh_generic_client_init_hsl ()
Initialize light HSL client models
Returns
SL_STATUS_OK if successful. Error code otherwise.
5640
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_generic_client_get_id#
#define sl_btmesh_cmd_generic_client_get_idValue:
0x001e0028
5031
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_set_id#
#define sl_btmesh_cmd_generic_client_set_idValue:
0x011e0028
5032
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_publish_id#
#define sl_btmesh_cmd_generic_client_publish_idValue:
0x021e0028
5033
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_get_params_id#
#define sl_btmesh_cmd_generic_client_get_params_idValue:
0x031e0028
5034
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_id#
#define sl_btmesh_cmd_generic_client_init_idValue:
0x041e0028
5035
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_common_id#
#define sl_btmesh_cmd_generic_client_init_common_idValue:
0x051e0028
5036
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_on_off_id#
#define sl_btmesh_cmd_generic_client_init_on_off_idValue:
0x061e0028
5037
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_level_id#
#define sl_btmesh_cmd_generic_client_init_level_idValue:
0x071e0028
5038
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_default_transition_time_id#
#define sl_btmesh_cmd_generic_client_init_default_transition_time_idValue:
0x081e0028
5039
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_power_on_off_id#
#define sl_btmesh_cmd_generic_client_init_power_on_off_idValue:
0x091e0028
5040
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_power_level_id#
#define sl_btmesh_cmd_generic_client_init_power_level_idValue:
0x0a1e0028
5041
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_battery_id#
#define sl_btmesh_cmd_generic_client_init_battery_idValue:
0x0b1e0028
5042
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_location_id#
#define sl_btmesh_cmd_generic_client_init_location_idValue:
0x0c1e0028
5043
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_property_id#
#define sl_btmesh_cmd_generic_client_init_property_idValue:
0x0d1e0028
5044
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_lightness_id#
#define sl_btmesh_cmd_generic_client_init_lightness_idValue:
0x0e1e0028
5045
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_ctl_id#
#define sl_btmesh_cmd_generic_client_init_ctl_idValue:
0x0f1e0028
5046
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_cmd_generic_client_init_hsl_id#
#define sl_btmesh_cmd_generic_client_init_hsl_idValue:
0x101e0028
5047
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_get_id#
#define sl_btmesh_rsp_generic_client_get_idValue:
0x001e0028
5048
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_set_id#
#define sl_btmesh_rsp_generic_client_set_idValue:
0x011e0028
5049
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_publish_id#
#define sl_btmesh_rsp_generic_client_publish_idValue:
0x021e0028
5050
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_get_params_id#
#define sl_btmesh_rsp_generic_client_get_params_idValue:
0x031e0028
5051
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_id#
#define sl_btmesh_rsp_generic_client_init_idValue:
0x041e0028
5052
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_common_id#
#define sl_btmesh_rsp_generic_client_init_common_idValue:
0x051e0028
5053
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_on_off_id#
#define sl_btmesh_rsp_generic_client_init_on_off_idValue:
0x061e0028
5054
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_level_id#
#define sl_btmesh_rsp_generic_client_init_level_idValue:
0x071e0028
5055
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_default_transition_time_id#
#define sl_btmesh_rsp_generic_client_init_default_transition_time_idValue:
0x081e0028
5056
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_power_on_off_id#
#define sl_btmesh_rsp_generic_client_init_power_on_off_idValue:
0x091e0028
5057
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_power_level_id#
#define sl_btmesh_rsp_generic_client_init_power_level_idValue:
0x0a1e0028
5058
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_battery_id#
#define sl_btmesh_rsp_generic_client_init_battery_idValue:
0x0b1e0028
5059
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_location_id#
#define sl_btmesh_rsp_generic_client_init_location_idValue:
0x0c1e0028
5060
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_property_id#
#define sl_btmesh_rsp_generic_client_init_property_idValue:
0x0d1e0028
5061
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_lightness_id#
#define sl_btmesh_rsp_generic_client_init_lightness_idValue:
0x0e1e0028
5062
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_ctl_id#
#define sl_btmesh_rsp_generic_client_init_ctl_idValue:
0x0f1e0028
5063
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h
sl_btmesh_rsp_generic_client_init_hsl_id#
#define sl_btmesh_rsp_generic_client_init_hsl_idValue:
0x101e0028
5064
of file /mnt/raid/workspaces/ws.wDIAeKYhQ/overlay/gsdk/protocol/bluetooth/build/native/mesh_app/inc/sl_btmesh_api.h