Infineon Logo AIROC BTSDK v4.0 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Mesh Battery Server

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

Detailed Description

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.

Macro Definition Documentation

#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 Documentation

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

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

Function Documentation

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.

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

Parameters
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
WICED_TRUE if initialization was successful
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.

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 combination, WICED_FALSE otherwise.