Functions | |
uint32_t | ble_bas_c_init (ble_bas_c_t *p_ble_bas_c, ble_bas_c_init_t *p_ble_bas_c_init) |
Function for initializing the Battery Service Client module. More... | |
void | ble_bas_c_on_ble_evt (ble_bas_c_t *p_ble_bas_c, const ble_evt_t *p_ble_evt) |
Function for handling BLE events from the SoftDevice. More... | |
uint32_t | ble_bas_c_bl_notif_enable (ble_bas_c_t *p_ble_bas_c) |
Function for enabling notifications on the Battery Level characteristic. More... | |
uint32_t | ble_bas_c_bl_read (ble_bas_c_t *p_ble_bas_c) |
Function for reading the Battery Level characteristic. More... | |
void | ble_bas_on_db_disc_evt (ble_bas_c_t *p_ble_bas_c, const ble_db_discovery_evt_t *p_evt) |
Function for handling events from the database discovery module. More... | |
uint32_t | ble_bas_c_handles_assign (ble_bas_c_t *p_ble_bas_c, uint16_t conn_handle, ble_bas_c_db_t *p_peer_handles) |
Function for assigning handles to a this instance of bas_c. More... | |
uint32_t ble_bas_c_bl_notif_enable | ( | ble_bas_c_t * | p_ble_bas_c | ) |
Function for enabling notifications on the Battery Level characteristic.
This function will enable to notification of the Battery Level characteristic at the peer by writing to the CCCD of the Battery Level Characteristic.
p_ble_bas_c | Pointer to the Battery Service client structure. |
NRF_SUCCESS | If the SoftDevice has been requested to write to the CCCD of the peer. NRF_ERROR_NULL Parameter is NULL. Otherwise, an error code returned by the SoftDevice API sd_ble_gattc_write. |
uint32_t ble_bas_c_bl_read | ( | ble_bas_c_t * | p_ble_bas_c | ) |
Function for reading the Battery Level characteristic.
p_ble_bas_c | Pointer to the Battery Service client structure. |
NRF_SUCCESS | If the read request was successfully queued to be sent to peer. |
uint32_t ble_bas_c_handles_assign | ( | ble_bas_c_t * | p_ble_bas_c, |
uint16_t | conn_handle, | ||
ble_bas_c_db_t * | p_peer_handles | ||
) |
Function for assigning handles to a this instance of bas_c.
Call this function when a link has been established with a peer to associate this link to this instance of the module. This makes it possible to handle several link and associate each link to a particular instance of this module. The connection handle and attribute handles will be provided from the discovery event BLE_BAS_C_EVT_DISCOVERY_COMPLETE.
[in] | p_ble_bas_c | Pointer to the Battery client structure instance to associate. |
[in] | conn_handle | Connection handle to associated with the given Battery Client Instance. |
[in] | p_peer_handles | Attribute handles on the BAS server you want this BAS client to interact with. |
uint32_t ble_bas_c_init | ( | ble_bas_c_t * | p_ble_bas_c, |
ble_bas_c_init_t * | p_ble_bas_c_init | ||
) |
Function for initializing the Battery Service Client module.
This function will initialize the module and set up Database Discovery to discover the Battery Service. After calling this function, call ble_db_discovery_start to start discovery once a link with a peer has been established.
[out] | p_ble_bas_c | Pointer to the Battery Service client structure. |
[in] | p_ble_bas_c_init | Pointer to the Battery Service initialization structure containing the initialization information. |
NRF_SUCCESS | Operation success. |
NRF_ERROR_NULL | A parameter is NULL. Otherwise, an error code returned by ble_db_discovery_evt_register. |
void ble_bas_c_on_ble_evt | ( | ble_bas_c_t * | p_ble_bas_c, |
const ble_evt_t * | p_ble_evt | ||
) |
Function for handling BLE events from the SoftDevice.
This function will handle the BLE events received from the SoftDevice. If the BLE event is relevant for the Battery Service Client module, then it is used to update interval variables and, if necessary, send events to the application.
[in] | p_ble_bas_c | Pointer to the Battery Service client structure. |
[in] | p_ble_evt | Pointer to the BLE event. |
void ble_bas_on_db_disc_evt | ( | ble_bas_c_t * | p_ble_bas_c, |
const ble_db_discovery_evt_t * | p_evt | ||
) |
Function for handling events from the database discovery module.
Call this function when getting a callback event from the DB discovery modue. This function will handle an event from the database discovery module, and determine if it relates to the discovery of Battery service at the peer. If so, it will call the application's event handler indicating that the Battery service has been discovered at the peer. It also populates the event with the service related information before providing it to the application.
p_ble_bas_c | Pointer to the Battery Service client structure. | |
[in] | p_evt | Pointer to the event received from the database discovery module. |