Mistake on this page?
Report an issue in GitHub or email us

BatteryService

It is often a requirement for devices operating on battery to report the battery charge level to the user.

The Bluetooth Battery Service defines how to expose a battery charge level through a BLE link. It allows a client - usually a smartphone application - of a device to read the current battery charge level and follow its evolution.

The BatteryService class implements the Bluetooth Battery Service as defined by the Bluetooth SIG. Makers of BLE devices operating on battery can use the API to expose interoperably the charge level of their products.

BatteryService class reference

Public Member Functions
 BatteryService (BLE &_ble, uint8_t level=100)
 Instantiate a battery service. More...
void updateBatteryLevel (uint8_t newLevel)
 Update the battery charge level that the service exposes. More...
Protected Attributes
BLEble
 Reference to the underlying BLE instance that this object is attached to. More...
uint8_t batteryLevel
 The current battery level represented as an integer from 0% to 100%. More...
ReadOnlyGattCharacteristic< uint8_t > batteryLevelCharacteristic
 The GATT characteristic, which exposes the charge level. More...
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.