Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BatteryService Class Reference
#include <BatteryService.h>
Public Member Functions | |
BatteryService (BLE &_ble, uint8_t level=100) | |
void | updateBatteryLevel (uint8_t newLevel) |
Update the battery level with a new value. | |
Protected Attributes | |
BLE & | ble |
A reference to the underlying BLE instance that this object is attached to. | |
uint8_t | batteryLevel |
The current battery level represented as an integer from 0% to 100%. | |
ReadOnlyGattCharacteristic < uint8_t > | batteryLevelCharacteristic |
A ReadOnlyGattCharacteristic that allows access to the peer device to the batteryLevel value through BLE. |
Detailed Description
BLE Battery Service.
This service displays the battery level from 0% to 100%, represented as an 8bit number. Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml Battery Level Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.battery_level.xml
Definition at line 28 of file BatteryService.h.
Constructor & Destructor Documentation
BatteryService | ( | BLE & | _ble, |
uint8_t | level = 100 |
||
) |
- Parameters:
-
[in] _ble BLE object for the underlying controller. [in] level 8bit batterly level. Usually used to represent percentage of batterly charge remaining.
Definition at line 36 of file BatteryService.h.
Member Function Documentation
void updateBatteryLevel | ( | uint8_t | newLevel ) |
Update the battery level with a new value.
Valid values lie between 0 and 100, anything outside this range will be ignored.
- Parameters:
-
newLevel Update to battery level.
Definition at line 54 of file BatteryService.h.
Field Documentation
uint8_t batteryLevel [protected] |
The current battery level represented as an integer from 0% to 100%.
Definition at line 69 of file BatteryService.h.
ReadOnlyGattCharacteristic<uint8_t> batteryLevelCharacteristic [protected] |
A ReadOnlyGattCharacteristic that allows access to the peer device to the batteryLevel value through BLE.
Definition at line 74 of file BatteryService.h.
Generated on Tue Jul 12 2022 20:03:30 by
