Infineon Logo AIROC BTSDK v4.3 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
BAC Library API

The BAC library of the AIROC BTSDK provide a simple method for an application to integrate the BAC service functionality. More...

Data Structures

struct  wiced_bt_battery_client_discovery_complete_t
 Data associated with WICED_BT_BAC_EVENT_DISCOVERY_COMPLETE. More...
 
struct  wiced_bt_battery_client_data_t
 event Data More...
 
union  wiced_bt_battery_client_event_data_t
 Union of data associated with BAC events. More...
 

Typedefs

typedef void( wiced_bt_battery_client_callback_t )(wiced_bt_battery_client_event_t event, wiced_bt_battery_client_event_data_t *p_data)
 BAC Callback function type wiced_bt_battery_client_callback_t. More...
 

Enumerations

enum  wiced_bt_battery_client_event_t { WICED_BT_BAC_EVENT_DISCOVERY_COMPLETE = 1, WICED_BT_BAC_EVENT_RSP, WICED_BT_BAC_EVENT_NOTIFICATION, WICED_BT_BAC_EVENT_INDICATION }
 BAC Events received by the applicaton's BAC callback (see wiced_bt_battery_client_callback_t) More...
 

Functions

char * wiced_bt_battery_client_uuid_to_str (uint16_t uuid)
 This function returns supported BAS v1.1 characteristic service name by given uuid. More...
 
wiced_result_t wiced_bt_battery_client_init (wiced_bt_battery_client_callback_t *p_callback)
 The application calls this function to initialize the Battery Client profile. More...
 
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. More...
 
void wiced_bt_battery_client_discovery_result (wiced_bt_gatt_discovery_result_t *p_data)
 The application calls this API during GATT discovery to pass discovery results for the BAC service to the BAC Library. More...
 
void wiced_bt_battery_client_discovery_complete (wiced_bt_gatt_discovery_complete_t *p_data)
 The application calls this API during GATT discovery to pass discovery complete information for the BAC service to the BAC Library. More...
 
wiced_bt_gatt_status_t wiced_bt_battery_client_read (uint16_t conn_id)
 If a discovery complete is a success, the application can read the battery level provided by the server. More...
 
void wiced_bt_battery_client_enable (uint16_t conn_id)
 Writes a client characteristic configuration descriptor to receive battery level notifications from the server. More...
 
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. More...
 
void wiced_bt_battery_client_read_rsp (wiced_bt_gatt_operation_complete_t *p_data)
 The application calls this function when it receives GATT Read Response for the attribute handle that belongs to the BAC service. More...
 
void wiced_bt_battery_client_process_notification (wiced_bt_gatt_operation_complete_t *p_data)
 The application calls this when it receives notification from the server. More...
 
void wiced_bt_battery_client_process_indication (wiced_bt_gatt_operation_complete_t *p_data)
 The application calls this when it receives notification from the server. More...
 
void wiced_bt_battery_client_connection_up (wiced_bt_gatt_connection_status_t *p_conn_status)
 The application calls this function when LE connection with a peer device established. More...
 
void wiced_bt_battery_client_connection_down (wiced_bt_gatt_connection_status_t *p_conn_status)
 The application calls this function when LE connection with a peer device disconnected. More...
 

Detailed Description

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.

Typedef Documentation

typedef void( wiced_bt_battery_client_callback_t)(wiced_bt_battery_client_event_t event, wiced_bt_battery_client_event_data_t *p_data)

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.

Enumeration Type Documentation

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.

Function Documentation

void wiced_bt_battery_client_connection_down ( wiced_bt_gatt_connection_status_t p_conn_status)

The application calls this function when LE connection with a peer device disconnected.

Parameters
p_conn_status: The pointer to a wiced_bt_gatt_connection_status_t which includes the address and connection ID.
Returns
None.
void wiced_bt_battery_client_connection_up ( wiced_bt_gatt_connection_status_t p_conn_status)

The application calls this function when LE connection with a peer device established.

Parameters
p_conn_status: The pointer to a wiced_bt_gatt_connection_status_t that includes the address and connection ID.
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.
void wiced_bt_battery_client_discovery_complete ( wiced_bt_gatt_discovery_complete_t p_data)

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.
void wiced_bt_battery_client_discovery_result ( wiced_bt_gatt_discovery_result_t p_data)

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.
wiced_result_t wiced_bt_battery_client_init ( wiced_bt_battery_client_callback_t p_callback)

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.
void wiced_bt_battery_client_process_indication ( wiced_bt_gatt_operation_complete_t p_data)

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.
void wiced_bt_battery_client_process_notification ( wiced_bt_gatt_operation_complete_t p_data)

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.
wiced_bt_gatt_status_t wiced_bt_battery_client_read ( uint16_t  conn_id)

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.
void wiced_bt_battery_client_read_rsp ( wiced_bt_gatt_operation_complete_t p_data)

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