Infineon Logo AIROC BTSDK v4.9 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Mesh Level Client

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...
 

Detailed Description

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 Documentation

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.

Parameters
eventThe event that the application should process (see Mesh Level Events)
p_eventinformation about the message received. The same pointer should be used in the reply if required.
p_dataPointer to the level data
Returns
None

Function Documentation

void wiced_bt_mesh_model_level_client_init ( uint8_t  element_idx,
void *  p_callback,
wiced_bool_t  is_provisioned 
)

Level Client Module initialization.

Parameters
element_idxDevice element to where model is used
p_callbackThe 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_provisionedIf TRUE, the application is being restarted after being provisioned or after a power loss. If FALSE the model cleans up NVRAM on startup.
Returns
None
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.

Parameters
p_eventMesh event with information about received message.
p_dataPointer to the data portion of the message
data_lenLength of the data in the message
Returns
WICED_TRUE if the message is for this company ID/Model/Element Index combination, WICED_FALSE otherwise.
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.

Parameters
p_eventMesh event with the information about the message that has been created by the app for unsolicited message.
p_dataPointer to the data to send
Returns
WICED_BT_SUCCESS if message has been queued for transmission.
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.

Parameters
p_eventMesh event with the information about the message that has been created by the app for unsolicited message.
Returns
WICED_BT_SUCCESS if message has been queued for transmission.
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.

Parameters
p_eventMesh event with the information about the message that has been created by the app for unsolicited message.
p_dataPointer to the data to send
Returns
WICED_BT_SUCCESS if message has been queued for transmission.
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.

Parameters
p_eventMesh event with the information about the message that has been created by the app for unsolicited message.
p_dataPointer to the data to send
Returns
WICED_BT_SUCCESS if message has been queued for transmission.
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.

Parameters
element_idxDevice element to where model is used
is_finalWICED_TRUE, if this is a final set command. WICED_FALSE if application expects more commands to come.
p_dataPointer to the data with current level and transition time
Returns
WICED_BT_SUCCESS if message has been queued for transmission.