diff options
Diffstat (limited to 'src/components/ble/NimbleController.cpp')
| -rw-r--r-- | src/components/ble/NimbleController.cpp | 9 |
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({¤tTimeClient}) { + immediateAlertService {systemTask, notificationManager}, + serviceDiscovery({¤tTimeClient, &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: |
