Bluetooth LE Profile API document
Bluetooth LE Profile API document Rev.1.00 [May 22, 2020]
Battery Service Server

The Battery Service exposes the state of a battery within a device. More...

Detailed Description

The Battery Service exposes the state of a battery within a device.

Data Structures

struct  st_ble_bas_battery_level_presn_format_t
 Characteristic Presentation Format value structure. More...
 

Enumerations

enum  e_ble_bas_char_idx_t {
  BLE_BAS_BATTERY_LEVEL_IDX,
  BLE_BAS_BATTERY_LEVEL_PRESN_FORMAT_IDX,
  BLE_BAS_BATTERY_LEVEL_CLI_CNFG_IDX
}
 Battery Service characteristic Index. More...
 
enum  e_ble_bas_event_t {
  BLE_BAS_EVENT_BATTERY_LEVEL_READ_REQ = BLE_SERVS_ATTR_EVENT(BLE_BAS_BATTERY_LEVEL_IDX, BLE_SERVS_READ_REQ),
  BLE_BAS_EVENT_BATTERY_LEVEL_PRESN_FORMAT_READ_REQ = BLE_SERVS_ATTR_EVENT(BLE_BAS_BATTERY_LEVEL_PRESN_FORMAT_IDX, BLE_SERVS_READ_REQ),
  BLE_BAS_EVENT_BATTERY_LEVEL_CLI_CNFG_WRITE_REQ = BLE_SERVS_ATTR_EVENT(BLE_BAS_BATTERY_LEVEL_CLI_CNFG_IDX, BLE_SERVS_WRITE_REQ),
  BLE_BAS_EVENT_BATTERY_LEVEL_CLI_CNFG_WRITE_COMP = BLE_SERVS_ATTR_EVENT(BLE_BAS_BATTERY_LEVEL_CLI_CNFG_IDX, BLE_SERVS_WRITE_COMP),
  BLE_BAS_EVENT_BATTERY_LEVEL_CLI_CNFG_READ_REQ = BLE_SERVS_ATTR_EVENT(BLE_BAS_BATTERY_LEVEL_CLI_CNFG_IDX, BLE_SERVS_READ_REQ)
}
 Battery Service event type. More...
 

Functions

ble_status_t R_BLE_BAS_SetBatteryLevel (const uint8_t *p_value)
 Set Battery Level characteristic value to the local GATT database. More...
 
ble_status_t R_BLE_BAS_GetBatteryLevel (uint8_t *p_value)
 Get Battery Level characteristic value from the local GATT database. More...
 
ble_status_t R_BLE_BAS_NotifyBatteryLevel (uint16_t conn_hdl, const uint8_t *p_value)
 Send notification of Battery Level characteristic value to the remote device. More...
 
ble_status_t R_BLE_BAS_SetBatteryLevelPresnFormat (const st_ble_bas_battery_level_presn_format_t *p_value)
 Set Battery Level presn format descriptor value to the local GATT database. More...
 
ble_status_t R_BLE_BAS_GetBatteryLevelPresnFormat (st_ble_bas_battery_level_presn_format_t *p_value)
 Get Battery Level presn format descriptor value from the local GATT database. More...
 
ble_status_t R_BLE_BAS_SetBatteryLevelCliCnfg (const uint16_t *p_value)
 Set Battery Level cli cnfg descriptor value to the local GATT database. More...
 
ble_status_t R_BLE_BAS_GetBatteryLevelCliCnfg (uint16_t *p_value)
 Get Battery Level cli cnfg descriptor value from the local GATT database. More...
 
ble_status_t R_BLE_BAS_Init (ble_servs_app_cb_t cb)
 Initialize Battery Service service. More...
 

Enumeration Type Documentation

◆ e_ble_bas_char_idx_t

Battery Service characteristic Index.

◆ e_ble_bas_event_t

Battery Service event type.

Function Documentation

◆ R_BLE_BAS_SetBatteryLevel()

ble_status_t R_BLE_BAS_SetBatteryLevel ( const uint8_t *  p_value)

Set Battery Level characteristic value to the local GATT database.

Parameters
[in]p_valueCharacteristic value to set.
Returns
ble_status_t

◆ R_BLE_BAS_GetBatteryLevel()

ble_status_t R_BLE_BAS_GetBatteryLevel ( uint8_t *  p_value)

Get Battery Level characteristic value from the local GATT database.

Parameters
[in]p_valueOutput location for the acquired descriptor value.
Returns
ble_status_t

◆ R_BLE_BAS_NotifyBatteryLevel()

ble_status_t R_BLE_BAS_NotifyBatteryLevel ( uint16_t  conn_hdl,
const uint8_t *  p_value 
)

Send notification of Battery Level characteristic value to the remote device.

Parameters
[in]conn_hdlConnection handle.
[in]p_valueCharacteristic value to send.
Returns
ble_status_t

◆ R_BLE_BAS_SetBatteryLevelPresnFormat()

ble_status_t R_BLE_BAS_SetBatteryLevelPresnFormat ( const st_ble_bas_battery_level_presn_format_t p_value)

Set Battery Level presn format descriptor value to the local GATT database.

Parameters
[in]p_valueDescriptor value to set.
Returns
ble_status_t

◆ R_BLE_BAS_GetBatteryLevelPresnFormat()

ble_status_t R_BLE_BAS_GetBatteryLevelPresnFormat ( st_ble_bas_battery_level_presn_format_t p_value)

Get Battery Level presn format descriptor value from the local GATT database.

Parameters
[in]p_valueOutput location for the acquired descriptor value.
Returns
ble_status_t

◆ R_BLE_BAS_SetBatteryLevelCliCnfg()

ble_status_t R_BLE_BAS_SetBatteryLevelCliCnfg ( const uint16_t *  p_value)

Set Battery Level cli cnfg descriptor value to the local GATT database.

Parameters
[in]p_valueDescriptor value to set.
Returns
ble_status_t

◆ R_BLE_BAS_GetBatteryLevelCliCnfg()

ble_status_t R_BLE_BAS_GetBatteryLevelCliCnfg ( uint16_t *  p_value)

Get Battery Level cli cnfg descriptor value from the local GATT database.

Parameters
[in]p_valueOutput location for the acquired descriptor value.
Returns
ble_status_t

◆ R_BLE_BAS_Init()

ble_status_t R_BLE_BAS_Init ( ble_servs_app_cb_t  cb)

Initialize Battery Service service.

Parameters
[in]cbService callback.
Returns
ble_status_t