The AIROC Mesh Power On/Off Client module of the Mesh Models library provides a way for an application to manage the On Power Up behavior of other mesh devices.
More...
The AIROC Mesh Power On/Off Client module of the Mesh Models library provides a way for an application to manage the On Power Up behavior of other mesh devices.
It is typicallly used by the applications running on devices which performs mesh network configuration.
To include Power On/Off functionality, the device description shall contain WICED_BT_MESH_MODEL_POWER_ONOFF_CLIENT. The application shall also initialize the Power On/Off Client calling the wiced_bt_mesh_model_power_onoff_client_init registering a callback to receive Power OnOff status messages
To find out the current On Power Up state set on a particular device and to modify the behavior the application shall use wiced_bt_mesh_model_power_onoff_client_send_onpowerup_get. and wiced_bt_mesh_model_power_onoff_client_send_onpowerup_set methods respectively. These functions require to use the p_event parameter which include among others the address of the desgination device, the application key index, the retrnansmission parameters, the TTL, and various others.
typedef void( wiced_bt_mesh_power_onoff_client_callback_t)(uint16_t event, wiced_bt_mesh_event_t *p_event, void *p_data) |
Power On/Off Client callback is called by the Mesh Models library on receiving WICED_BT_MESH_POWER_ONOFF_ONPOWERUP_STATUS message from the peer.
The function is also called when transmission of the request has been completed WICED_BT_MESH_TX_COMPLETE with tx_failed field of the p_event parameter indicating if the request has been sent out successfully.
- Parameters
-
event | The event that the application should process (see Mesh Power On/Off Events) |
p_event | information about the message received. |
p_data | Pointer to the data with the status information |
- Returns
- None
Power On/Off Client Module initialization.
- Parameters
-
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 a request has been sent out, or failed, 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. |
- Returns
- None
wiced_bool_t wiced_bt_mesh_model_power_onoff_client_message_handler |
( |
wiced_bt_mesh_event_t * |
p_event, |
|
|
uint8_t * |
p_data, |
|
|
uint16_t |
data_len |
|
) |
| |
Generic Power OnOff Client Message Handler.
This is an internal Mesh Models library function and does not need to be implemented or called by the application, unless application wants to replace the library functionality. The Mesh Core library calls this function for each message received. The function shall return WICED_TRUE if the message is destined for this specific model, and returns WICED_FALSE otherwise.
- Parameters
-
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 |
- Returns
- WICED_TRUE if the message is for this company ID/Model/Element Index combination, WICED_FALSE otherwise.
The application can call this function to send the Get Power On/Off state client message to the server.
- Parameters
-
p_event | Mesh event with the information about the message that has been created by the application. |
- Returns
- WICED_BT_SUCCESS if message has been queued for transmission.
The application can call this function to send Set OnOff client message to the server.
- Parameters
-
p_event | Mesh event with the information about the message that has been created by the application. The p_event->reply specifies if application wants to receive Status from the peer. |
p_data | Pointer to the data to send |
- Returns
- WICED_BT_SUCCESS if message has been queued for transmission.