The BAC library of the AIROC BTSDK provide a simple method for an application to integrate the BAC service functionality.
More...
The BAC library of the AIROC BTSDK provide a simple method for an application to integrate the BAC service functionality.
The application calls the library APIs to control the Battery service of a peer device using GATT.
BAC Callback function type wiced_bt_battery_client_callback_t.
This function is called to send BAC events to the application. This function is registered with the wiced_bt_battery_client_initialize function.
- Parameters
-
[in] | event | : BAC Event. |
[in] | p_data | : Data (pointer on union of structure) associated with the event. |
- Returns
- NONE.
BAC Events received by the applicaton's BAC callback (see wiced_bt_battery_client_callback_t)
Enumerator |
---|
WICED_BT_BAC_EVENT_DISCOVERY_COMPLETE |
GATT Discovery Complete.
|
WICED_BT_BAC_EVENT_RSP |
Read Response.
|
WICED_BT_BAC_EVENT_NOTIFICATION |
Notification received.
|
WICED_BT_BAC_EVENT_INDICATION |
Notification received.
|
The application calls this function when LE connection with a peer device disconnected.
- Parameters
-
- Returns
- None.
The application calls this function when LE connection with a peer device established.
- Parameters
-
- Returns
- None.
void wiced_bt_battery_client_disable |
( |
uint16_t |
conn_id | ) |
|
Writes a client characteristic configuration descriptor to stop receiving battery level notifications from the server.
- Parameters
-
conn_id | : GATT connection ID. |
- Returns
- Returns the status of the GATT operation.
wiced_bt_gatt_status_t wiced_bt_battery_client_discover |
( |
uint16_t |
conn_id, |
|
|
uint16_t |
start_handle, |
|
|
uint16_t |
end_handle |
|
) |
| |
The application calls this function to performs Battery Service characteristics discovery and characteristic descriptor discovery.
After the discovery is complete, a registered application p_op_complete_callback is called with the result of the operation.
- Parameters
-
conn_id | : GATT connection ID. |
start_handle | : Start GATT handle of the ANP service. |
end_handle | : End GATT handle of the ANP service. |
- Returns
- Returns the status of the GATT operation.
The application calls this API during GATT discovery to pass discovery complete information for the BAC service to the BAC Library.
As the GATT discovery is performed in multiple steps this function initiates the next discovery request.
- Parameters
-
p_data | : Discovery complete data as passed from the stack. |
- Returns
- None.
The application calls this API during GATT discovery to pass discovery results for the BAC service to the BAC Library.
The library needs to find BAC service characteristics and associated characteristic client configuration descriptors.
- Parameters
-
p_data | : Discovery result data as passed from the stack. |
- Returns
- None.
void wiced_bt_battery_client_enable |
( |
uint16_t |
conn_id | ) |
|
Writes a client characteristic configuration descriptor to receive battery level notifications from the server.
- Parameters
-
conn_id | : GATT connection ID. |
- Returns
- Returns the status of the GATT operation.
The application calls this function to initialize the Battery Client profile.
The application registered callbacks get called when requested operations are completed. After a connection is success, the application does the BAC service discovery. If the BAC service is discovered successfully, the application can read the Battery Level or Enable Battery Level Notifications.
- Parameters
-
p_callback | : Pointer to application BAC callback function. |
- Returns
- WICED_SUCCESS if BAC initialized successfully, error otherwise.
The application calls this when it receives notification from the server.
The Profile processes the indication and sends it as a callback to the application.
- Parameters
-
p_data | : The pointer to a GATT operation complete data structure. |
- Returns
- None.
The application calls this when it receives notification from the server.
The Profile processes the notification and sends it as a callback to the application.
- Parameters
-
p_data | : The pointer to a GATT operation complete data structure. |
- Returns
- None.
If a discovery complete is a success, the application can read the battery level provided by the server.
- Parameters
-
conn_id | : GATT connection ID. |
- Returns
- Returns the status of the GATT operation.
The application calls this function when it receives GATT Read Response for the attribute handle that belongs to the BAC service.
- Parameters
-
p_data | : The pointer to a GATT operation complete data structure. |
- Returns
- None.
char* wiced_bt_battery_client_uuid_to_str |
( |
uint16_t |
uuid | ) |
|
This function returns supported BAS v1.1 characteristic service name by given uuid.
- Parameters
-
uuid | : The uuid of BAS characteristic |
- Returns
- characteristics service name if uuid is valid, else returns empty string