AIROC™ BTSDK v4.2 - Documentation | ||||
The AIROC Mesh Battery Server module provides a way for a client to retrieve the Battery status of this device. More...
Macros | |
#define | WICED_BT_MESH_MODEL_BATTERY_SERVER { MESH_COMPANY_ID_BT_SIG, WICED_BT_MESH_CORE_MODEL_ID_GENERIC_BATTERY_SRV, wiced_bt_mesh_model_battery_server_message_handler, NULL, NULL } |
Mesh Battery Server Device. More... | |
Typedefs | |
typedef void( | wiced_bt_mesh_battery_server_callback_t )(uint16_t event, wiced_bt_mesh_event_t *p_event) |
Battery Server callback. More... | |
Functions | |
void | wiced_bt_mesh_model_battery_server_init (wiced_bt_mesh_battery_server_callback_t *p_callback, wiced_bool_t is_provisioned) |
Battery Server Module initialization. More... | |
wiced_bool_t | wiced_bt_mesh_model_battery_server_message_handler (wiced_bt_mesh_event_t *p_event, uint8_t *p_data, uint16_t data_len) |
Battery Server Message Handler. More... | |
wiced_result_t | wiced_bt_mesh_battery_server_send_status (wiced_bt_mesh_event_t *p_event, mesh_battery_event_t *p_data) |
The application can call this function to send status message to the Battery Client. More... | |
The AIROC Mesh Battery Server module provides a way for a client to retrieve the Battery status of this device.
The Server Model can also be configured by a Provisioner to allow sending the Status message to a specific node or group of nodes.
On startup the application should call wiced_bt_mesh_model_battery_server_init function providing the callback that will be called when a request for the battery status is received. The application should call the wiced_bt_mesh_battery_server_send_status function in response to a get request, or when application logic requires battery status to be sent out. In the latter case the message will be sent out only if device is configured remotely with the destination address where the battery status should be sent to and the application key to be used to secure the message.
#define WICED_BT_MESH_MODEL_BATTERY_SERVER { MESH_COMPANY_ID_BT_SIG, WICED_BT_MESH_CORE_MODEL_ID_GENERIC_BATTERY_SRV, wiced_bt_mesh_model_battery_server_message_handler, NULL, NULL } |
Mesh Battery Server Device.
The device can exist standalone, but usually is combined with other battery powered devices.
typedef void( wiced_bt_mesh_battery_server_callback_t)(uint16_t event, wiced_bt_mesh_event_t *p_event) |
Battery Server callback.
The Battery Server callback is called by the Mesh Models library on receiving a get message from the peer
event | The event that the application should process (see Mesh Battery Events) |
p_event | information about the message received. The same pointer should be used in the reply if required. |
wiced_result_t wiced_bt_mesh_battery_server_send_status | ( | wiced_bt_mesh_event_t * | p_event, |
mesh_battery_event_t * | p_data | ||
) |
The application can call this function to send status message to the Battery Client.
The mesh event should contain information if this is a reply or an unsolicited message.
p_event | Mesh event with the information about the message that has been received in the request, or created by the app for unsolicited message. |
p_data | Pointer to the Battery data |
void wiced_bt_mesh_model_battery_server_init | ( | wiced_bt_mesh_battery_server_callback_t * | p_callback, |
wiced_bool_t | is_provisioned | ||
) |
Battery Server Module initialization.
Application should call this function during startup to register a callback which will be executed when received message requires application processing.
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_battery_server_message_handler | ( | wiced_bt_mesh_event_t * | p_event, |
uint8_t * | p_data, | ||
uint16_t | data_len | ||
) |
Battery Server Message Handler.
Application can call this models library function to process a message received from the Battery Client. The function parses the message and if appropriate calls the application 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 |