summaryrefslogtreecommitdiff
path: root/src/components/ble/NimbleController.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-07-11 16:55:06 +0200
committerJean-François Milants <jf@codingfield.com>2021-07-11 16:55:06 +0200
commite21f6a7f414d1f832e8fddfeaab3b9de05aa3459 (patch)
treea4ebbc3a74ba7daf87aa99c0eafcb0e9e7bc6c35 /src/components/ble/NimbleController.cpp
parent6a91b83b12ef849f68d54f490153b02f0ecf58dc (diff)
Notify battery level every 10 minutes when connected to a BLE host.
Refactor battery percent : only use uint8_t to store the battery % remaining.
Diffstat (limited to 'src/components/ble/NimbleController.cpp')
-rw-r--r--src/components/ble/NimbleController.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp
index 2c1d0f99..5eb227bf 100644
--- a/src/components/ble/NimbleController.cpp
+++ b/src/components/ble/NimbleController.cpp
@@ -235,3 +235,9 @@ void NimbleController::StartDiscovery() {
uint16_t NimbleController::connHandle() {
return connectionHandle;
}
+
+void NimbleController::NotifyBatteryLevel(uint8_t level) {
+ if(connectionHandle != BLE_HS_CONN_HANDLE_NONE) {
+ batteryInformationService.NotifyBatteryLevel(connectionHandle, level);
+ }
+}