InPlay API
BLE Battery Service

BLE Battery Service. More...

Data Structures

struct  ble_basc_read_info_rsp_t
 Parameters of the BASC_READ_INFO_RSP message. More...
 
struct  ble_bas_prf_t
 Parameters for the database creation. More...
 
struct  ble_bass_enable_req_t
 Parameters of the BASS_ENABLE_REQ message. More...
 

Enumerations

enum  ble_bas_evt { , BASC_EVT_BATT_LEVEL_IND , BASS_EVT_BATT_LEVEL_NTF_CFG_IND }
 Events defines for Battery Services. More...
 
enum  ble_basc_info { BLE_BASC_BATT_LVL_VAL, BLE_BASC_NTF_CFG, BLE_BASC_BATT_LVL_PRES_FORMAT }
 Peer battery info that can be read. More...
 
enum  ble_bass_features { BLE_BAS_BATT_LVL_NTF_NOT_SUP, BLE_BAS_BATT_LVL_NTF_SUP }
 Features Flag Masks. More...
 
enum  ble_bass_char_type { BLE_BAS_CHAR_BATT_LEVEL }
 Battery Service Characteristics. More...
 
enum  ble_bass_desc_type { BLE_BAS_DESC_BATT_LEVEL_PRES_FORMAT, BLE_BAS_DESC_BATT_LEVEL_CFG }
 Battery Service Descriptors. More...
 

Functions

int in_ble_basc_add (void *hdl, ble_bas_prf_t *p_prf, comp_cb callback)
 Add Battery Client Service. More...
 
int in_ble_basc_enable (void *hdl, int conidx, int con_type, uint8_t bas_nb, ble_basc_content_t content[], comp_cb callback)
 Enable BAS client service. More...
 
int in_ble_basc_read_info_req (void *hdl, int conidx, int bas_nb, int basc_info, ble_basc_read_info_rsp_t *rsp, comp_cb callback)
 Read peer info. More...
 
int in_ble_basc_ntf_req (void *hdl, uint8_t conidx, uint8_t bas_nb, uint16_t ntf_cfg, comp_cb callback)
 Configure notification. More...
 
int in_ble_bass_add (void *hdl, ble_bas_prf_t *p_prf, comp_cb callback)
 Add Battery Server Service. More...
 
int in_ble_bass_enable (void *hdl, int conidx, ble_bass_enable_req_t *p_req, comp_cb callback)
 Enable BAS server service. More...
 
int in_ble_bass_batt_level_upd_req (void *hdl, int conidx, uint8_t instance, uint8_t batt_lvl, comp_cb callback)
 Update battery level request. More...
 

Detailed Description

BLE Battery Service.

Enumeration Type Documentation

◆ ble_bas_evt

Events defines for Battery Services.

Enumerator
BASC_EVT_BATT_LEVEL_IND 

Indicate that the Battery Level value has been received,.

See also
in_ble_evt_basc_batt_level_ind_t
BASS_EVT_BATT_LEVEL_NTF_CFG_IND 

Inform that Battery Level Notification Configuration has been changed - use to update bond data,.

See also
in_ble_evt_bass_level_ntf_cfg_ind_t

◆ ble_basc_info

Peer battery info that can be read.

Enumerator
BLE_BASC_BATT_LVL_VAL 

Battery Level value.

BLE_BASC_NTF_CFG 

Battery Level Client Characteristic Configuration.

BLE_BASC_BATT_LVL_PRES_FORMAT 

Battery Level Characteristic Presentation Format.

◆ ble_bass_char_type

Battery Service Characteristics.

Enumerator
BLE_BAS_CHAR_BATT_LEVEL 

Battery Level.

◆ ble_bass_desc_type

Battery Service Descriptors.

Enumerator
BLE_BAS_DESC_BATT_LEVEL_PRES_FORMAT 

Battery Level Characteristic Presentation Format.

BLE_BAS_DESC_BATT_LEVEL_CFG 

Battery Level Client Characteristic Configuration.

◆ ble_bass_features

Features Flag Masks.

Enumerator
BLE_BAS_BATT_LVL_NTF_NOT_SUP 

Battery Level Characteristic doesn't support notifications.

BLE_BAS_BATT_LVL_NTF_SUP 

Battery Level Characteristic support notifications.

Function Documentation

◆ in_ble_basc_add()

int in_ble_basc_add ( void *  hdl,
ble_bas_prf_t p_prf,
comp_cb  callback 
)

Add Battery Client Service.

Note
Add it after device configuration, but before any activity starts
Parameters
[in]p_prfPointer to profile attributes,
See also
ble_bas_prf_t
Returns
IN_BLE_ERR_NO_ERROR if successful, otherwise failed.
See also
enum in_ble_err_t

◆ in_ble_basc_enable()

int in_ble_basc_enable ( void *  hdl,
int  conidx,
int  con_type,
uint8_t  bas_nb,
ble_basc_content_t  content[],
comp_cb  callback 
)

Enable BAS client service.

Note
First function to call after connection
Parameters
[in]conidxConnection index
[in]con_typeConnnetion type,
See also
enum in_ble_con_type
Parameters
[in]bas_nbNumber of instances
[in,out]contentContents of service
  • Discover connection type: Stack will fill it
  • Normal connection type: Application needs to fill it.
Returns
IN_BLE_ERR_NO_ERROR if successful, otherwise failed.
See also
enum in_ble_err_t

◆ in_ble_basc_ntf_req()

int in_ble_basc_ntf_req ( void *  hdl,
uint8_t  conidx,
uint8_t  bas_nb,
uint16_t  ntf_cfg,
comp_cb  callback 
)

Configure notification.

Parameters
[in]conidxConnection index
[in]bas_nbInstance index
[in]ntf_cfgnotification config
Returns
IN_BLE_ERR_NO_ERROR if successful, otherwise failed.
See also
enum in_ble_err_t

◆ in_ble_basc_read_info_req()

int in_ble_basc_read_info_req ( void *  hdl,
int  conidx,
int  bas_nb,
int  basc_info,
ble_basc_read_info_rsp_t rsp,
comp_cb  callback 
)

Read peer info.

Parameters
[in]conidxConnection index
[in]bas_nbInstance index
[in]basc_infoInformation to read,
See also
enum ble_basc_info
Parameters
[out]rspResponse from the peer
Returns
IN_BLE_ERR_NO_ERROR if successful, otherwise failed.
See also
enum in_ble_err_t

◆ in_ble_bass_add()

int in_ble_bass_add ( void *  hdl,
ble_bas_prf_t p_prf,
comp_cb  callback 
)

Add Battery Server Service.

Note
Add it after device configuration, but before any activity starts
Parameters
[in]p_prfPointer to profile attributes,
See also
in_ble_bas_prf_t
Returns
IN_BLE_ERR_NO_ERROR if successful, otherwise failed.
See also
enum in_ble_err_t

◆ in_ble_bass_batt_level_upd_req()

int in_ble_bass_batt_level_upd_req ( void *  hdl,
int  conidx,
uint8_t  instance,
uint8_t  batt_lvl,
comp_cb  callback 
)

Update battery level request.

Parameters
[in]conidxConnection index
[in]instanceInstance index
[in]batt_lvlBattery level
Returns
IN_BLE_ERR_NO_ERROR if successful, otherwise failed.
See also
enum in_ble_err_t

◆ in_ble_bass_enable()

int in_ble_bass_enable ( void *  hdl,
int  conidx,
ble_bass_enable_req_t p_req,
comp_cb  callback 
)

Enable BAS server service.

Note
First function to call after connection
Parameters
[in]conidxConnection index
[in]p_reqPointer to the request structure
Returns
IN_BLE_ERR_NO_ERROR if successful, otherwise failed.
See also
enum in_ble_err_t