summaryrefslogtreecommitdiff
path: root/src/components/ble/NimbleController.cpp
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-04-13 18:53:16 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-04-13 18:53:16 (GMT)
commit531c1172a2357d53b214aaf7b29efee47d9b32e5 (patch)
treee9c008f13900e1d3c63332a3bbc305754f8ae35c /src/components/ble/NimbleController.cpp
parent27fa6bba08766831fe143fe5ca13767bedcd9072 (diff)
Revert "Sans notification (notification manager retained as it seems to be used by the dfu manager)"ultraredux2
This reverts commit 569e6fea41c13f33ad1374bb80ca489aaf4a7037.
Diffstat (limited to 'src/components/ble/NimbleController.cpp')
-rw-r--r--src/components/ble/NimbleController.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp
index 5236619..f63d98c 100644
--- a/src/components/ble/NimbleController.cpp
+++ b/src/components/ble/NimbleController.cpp
@@ -38,9 +38,11 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
currentTimeClient {dateTimeController},
anService {systemTask, notificationManager},
+ alertNotificationClient {systemTask, notificationManager},
currentTimeService {dateTimeController},
batteryInformationService {batteryController},
- serviceDiscovery({&currentTimeClient}) {
+ immediateAlertService {systemTask, notificationManager},
+ serviceDiscovery({&currentTimeClient, &alertNotificationClient}) {
}
void nimble_on_reset(int reason) {
@@ -81,6 +83,7 @@ void NimbleController::Init() {
anService.Init();
dfuService.Init();
batteryInformationService.Init();
+ immediateAlertService.Init();
int rc;
rc = ble_hs_util_ensure_addr(0);
@@ -163,6 +166,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
if (event->connect.status != 0) {
/* Connection failed; resume advertising. */
currentTimeClient.Reset();
+ alertNotificationClient.Reset();
connectionHandle = BLE_HS_CONN_HANDLE_NONE;
bleController.Disconnect();
fastAdvCount = 0;
@@ -181,6 +185,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
NRF_LOG_INFO("disconnect reason=%d", event->disconnect.reason);
currentTimeClient.Reset();
+ alertNotificationClient.Reset();
connectionHandle = BLE_HS_CONN_HANDLE_NONE;
if(bleController.IsConnected()) {
bleController.Disconnect();
@@ -271,6 +276,8 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
event->notify_rx.conn_handle,
event->notify_rx.attr_handle,
notifSize);
+
+ alertNotificationClient.OnNotification(event);
} break;
case BLE_GAP_EVENT_NOTIFY_TX: