AIROC™ BTSDK v4.7 - Documentation | ||||
The AIROC Mesh Level Client module of the Mesh Models library provides a way for an application to send Level commands (set, delta and move) to the server and optionally receive status information. More...
Typedefs | |
typedef void( | wiced_bt_mesh_level_client_callback_t )(uint16_t event, wiced_bt_mesh_event_t *p_event, void *p_data) |
Generic Level Client callback is called by the Mesh Models library on receiving a message from the peer. More... | |
Functions | |
wiced_bool_t | wiced_bt_mesh_model_level_client_message_handler (wiced_bt_mesh_event_t *p_event, uint8_t *p_data, uint16_t data_len) |
Generic Level Client Message Handler. More... | |
void | wiced_bt_mesh_model_level_client_init (uint8_t element_idx, void *p_callback, wiced_bool_t is_provisioned) |
Level Client Module initialization. More... | |
wiced_result_t | wiced_bt_mesh_model_level_client_set (uint8_t element_idx, wiced_bool_t is_final, wiced_bt_mesh_level_set_level_t *p_data) |
The application can call this function to send Set Level client message. More... | |
wiced_result_t | wiced_bt_mesh_model_level_client_send_get (wiced_bt_mesh_event_t *p_event) |
The application can call this function to send Generic Level Get message to the server. More... | |
wiced_result_t | wiced_bt_mesh_model_level_client_send_set (wiced_bt_mesh_event_t *p_event, wiced_bt_mesh_level_set_level_t *p_data) |
The application can call this function to send Set Level client message to the server. More... | |
wiced_result_t | wiced_bt_mesh_model_level_client_send_delta_set (wiced_bt_mesh_event_t *p_event, wiced_bt_mesh_level_set_delta_t *p_data) |
The application can call this function to send Set Delta Level client message to the server. More... | |
wiced_result_t | wiced_bt_mesh_model_level_client_send_move_set (wiced_bt_mesh_event_t *p_event, wiced_bt_mesh_level_set_move_t *p_data) |
The application can call this function to send Set Move client message to the server. More... | |
The AIROC Mesh Level Client module of the Mesh Models library provides a way for an application to send Level commands (set, delta and move) to the server and optionally receive status information.
The module can be used in an implementation of a simple slider device.
To include Level functionality, the device description shall contain WICED_BT_MESH_MODEL_LEVEL_CLIENT. To implement a device which supports multiple sliders, the WICED_BT_MESH_MODEL_LEVEL_CLIENT shall be included in multiple elements. Based on this information, the device that performs configuration will be able to specify different destination for different sliders supported by the device.
There are three controlling methods which can be used depending on the application. The device which remembers its state (for example, the current level), can use Level Set command. The device which does not remember the state but knows how much the level is being changed can use Delta Set command. The device which can detect speed of the change can use Move Set command.
In a simplest form, an application needs to initialize using the wiced_bt_mesh_model_level_client_init function and then call wiced_bt_mesh_model_level_client_set to tell the Mesh Library to send a command. The configuration of the destination address and security credential is done during the provisioning/configuration process and the application does not need to worry about it.
If an application needs more control of how messages are sent out, it can use wiced_bt_mesh_model_level_client_send_get, wiced_bt_mesh_model_level_client_send_set, wiced_bt_mesh_model_level_client_send_delta_set, or wiced_bt_mesh_model_level_client_send_move_set functions. These functions require to use the p_event parameter which include among others address of the desgination, application key index, retrnansmission parameters, TTL, and various others. After creating the event, the application can adjust the paramters as needed.
To receive Level Status information, an application during initialization specifies the callback that will be executed when Level status message is received. The status information can be received as a result of sending Level Get and Set commands. In addition to that, the Level server can be configured to send the status information to the device that implements the Level Client module, or to a group of the devices to which the OnOff Client belongs.
typedef void( wiced_bt_mesh_level_client_callback_t)(uint16_t event, wiced_bt_mesh_event_t *p_event, void *p_data) |
Generic Level Client callback is called by the Mesh Models library on receiving a message from the peer.
event | The event that the application should process (see Mesh Level Events) |
p_event | information about the message received. The same pointer should be used in the reply if required. |
p_data | Pointer to the level data |
void wiced_bt_mesh_model_level_client_init | ( | uint8_t | element_idx, |
void * | p_callback, | ||
wiced_bool_t | is_provisioned | ||
) |
Level Client Module initialization.
element_idx | Device element to where model is used |
p_callback | The application callback function that will be executed by the mesh models library when application action is required, or when a reply for the application request has been received. |
is_provisioned | If TRUE, the application is being restarted after being provisioned or after a power loss. If FALSE the model cleans up NVRAM on startup. |
wiced_bool_t wiced_bt_mesh_model_level_client_message_handler | ( | wiced_bt_mesh_event_t * | p_event, |
uint8_t * | p_data, | ||
uint16_t | data_len | ||
) |
Generic Level Client Message Handler.
The Mesh Core library calls this function for each message received. The function returns WICED_TRUE if the message is destined for this specific model and successfully processed, and returns WICED_FALSE otherwise. Generic Level Server device. The function parses the message and if appropriate calls the parent back to perform functionality.
p_event | Mesh event with information about received message. |
p_data | Pointer to the data portion of the message |
data_len | Length of the data in the message |
wiced_result_t wiced_bt_mesh_model_level_client_send_delta_set | ( | wiced_bt_mesh_event_t * | p_event, |
wiced_bt_mesh_level_set_delta_t * | p_data | ||
) |
The application can call this function to send Set Delta Level client message to the server.
This command will likely be used in the controlling application where application does not remember the target Level state. The instant command is just to adjust level.
p_event | Mesh event with the information about the message that has been created by the app for unsolicited message. |
p_data | Pointer to the data to send |
wiced_result_t wiced_bt_mesh_model_level_client_send_get | ( | wiced_bt_mesh_event_t * | p_event | ) |
The application can call this function to send Generic Level Get message to the server.
p_event | Mesh event with the information about the message that has been created by the app for unsolicited message. |
wiced_result_t wiced_bt_mesh_model_level_client_send_move_set | ( | wiced_bt_mesh_event_t * | p_event, |
wiced_bt_mesh_level_set_move_t * | p_data | ||
) |
The application can call this function to send Set Move client message to the server.
p_event | Mesh event with the information about the message that has been created by the app for unsolicited message. |
p_data | Pointer to the data to send |
wiced_result_t wiced_bt_mesh_model_level_client_send_set | ( | wiced_bt_mesh_event_t * | p_event, |
wiced_bt_mesh_level_set_level_t * | p_data | ||
) |
The application can call this function to send Set Level client message to the server.
This function will likely be used in the controlling application where application remembers the target Level state. If application does not remember the target state, the send_delta is more appropriate.
p_event | Mesh event with the information about the message that has been created by the app for unsolicited message. |
p_data | Pointer to the data to send |
wiced_result_t wiced_bt_mesh_model_level_client_set | ( | uint8_t | element_idx, |
wiced_bool_t | is_final, | ||
wiced_bt_mesh_level_set_level_t * | p_data | ||
) |
The application can call this function to send Set Level client message.
The function parameters doe not contain any information on where and how the message has not be sent because configuration has been done by the Confoguration client.
This function will likely be used in the controlling application where application remembers the target Level state. If application does not remember the target state, the send_delta is more appropriate.
element_idx | Device element to where model is used |
is_final | WICED_TRUE, if this is a final set command. WICED_FALSE if application expects more commands to come. |
p_data | Pointer to the data with current level and transition time |