20#warning "These services are deprecated and will be removed. Please see services.md for details about replacement services."
22#ifndef MBED_BLE_BATTERY_SERVICE_H__
23#define MBED_BLE_BATTERY_SERVICE_H__
25#if BLE_FEATURE_GATT_SERVER
27#include "platform/mbed_assert.h"
31#include "ble/GattServer.h"
92 sizeof(charTable) /
sizeof(charTable[0])
95 ble.gattServer().addService(batteryService);
115 ble.gattServer().write(
BatteryService(BLE &_ble, uint8_t level=100)
Instantiate a battery service.
BLE & ble
Reference to the underlying BLE instance that this object is attached to.
void updateBatteryLevel(uint8_t newLevel)
Update the battery charge level that the service exposes.
uint8_t batteryLevel
The current battery level represented as an integer from 0% to 100%.
ReadOnlyGattCharacteristic< uint8_t > batteryLevelCharacteristic
The GATT characteristic, which exposes the charge level.
Representation of a GattServer characteristic.
GattAttribute::Handle_t getValueHandle() const
Get the characteristic's value attribute handle in the ATT table.
Representation of a GattServer service.
@ UUID_BATTERY_SERVICE
UUID of the Battery service.
Helper class that represents a read only GattCharacteristic.
Abstract away BLE-capable radio transceivers or SOCs.
Entry namespace for all BLE API definitions.