summaryrefslogtreecommitdiff
path: root/src/components/ble/NimbleController.h
diff options
context:
space:
mode:
authorJames A. Jerkins <evergreen@jamesjerkinscomputer.com>2021-09-05 20:53:20 (GMT)
committerJames A. Jerkins <evergreen@jamesjerkinscomputer.com>2021-09-05 20:53:20 (GMT)
commit22571d4b384e40d647cd994202956f08ed32d925 (patch)
tree5ecf4349a0d0cc8b29cdf35f779e5565dbb6cae4 /src/components/ble/NimbleController.h
parent4820b2ffe8be0b8d1abefd307a4c0fe6d4d41a73 (diff)
Advertise fast for at least 30 secs then slow down
On power up, advertise aggressively for at least 30 seconds then switch to a longer interval to conserve battery life. This fast/slow pattern is designed to balance connection response time and battery life. When a disconnect event is received restart the fast/slow pattern. When a failed connect event is received, restart the fast/slow pattern. When the screen is activated and ble is not connected, restart the fast/slow pattern. This pattern is consistent with Apple's BLE developer standards (QA 1931).
Diffstat (limited to 'src/components/ble/NimbleController.h')
-rw-r--r--src/components/ble/NimbleController.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h
index 078d615..473bb1a 100644
--- a/src/components/ble/NimbleController.h
+++ b/src/components/ble/NimbleController.h
@@ -72,6 +72,10 @@ namespace Pinetime {
uint16_t connHandle();
void NotifyBatteryLevel(uint8_t level);
+ void RestartFastAdv() {
+ fastAdvCount = 0;
+ }
+
private:
static constexpr const char* deviceName = "InfiniTime";
Pinetime::System::SystemTask& systemTask;
@@ -94,6 +98,7 @@ namespace Pinetime {
uint8_t addrType; // 1 = Random, 0 = PUBLIC
uint16_t connectionHandle = BLE_HS_CONN_HANDLE_NONE;
+ uint8_t fastAdvCount = 0;
ble_uuid128_t dfuServiceUuid {
.u {.type = BLE_UUID_TYPE_128},