diff options
| author | JF <jf@codingfield.com> | 2020-03-28 18:05:28 (GMT) |
|---|---|---|
| committer | JF <jf@codingfield.com> | 2020-03-28 18:05:28 (GMT) |
| commit | baca0fc3e59e88420d6c7983ad133fe63c794ec0 (patch) | |
| tree | e817de0b040712bb95129520fcc51eae59ecc161 /src/main.cpp | |
| parent | 68240704c7a60534342cfc0157564f11cf82d9d8 (diff) | |
Encapsulate Notification management in NotificationManager. It implement a static array of notifications to avoid dynamic allocation.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index a4a759d..106d19e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,6 +16,7 @@ #include <drivers/SpiMaster.h> #include <DisplayApp/LittleVgl.h> #include <SystemTask/SystemTask.h> +#include <Components/Ble/NotificationManager.h> #if NRF_LOG_ENABLED #include "Logging/NrfLogger.h" @@ -55,6 +56,8 @@ void ble_manager_set_ble_disconnection_callback(void (*disconnection)()); static constexpr uint8_t pinTouchIrq = 28; std::unique_ptr<Pinetime::System::SystemTask> systemTask; +Pinetime::Controllers::NotificationManager notificationManager; + void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { if(pin == pinTouchIrq) { systemTask->OnTouchEvent(); @@ -86,7 +89,7 @@ void OnBleDisconnection() { } void OnNewNotification(const char* message, uint8_t size) { - bleController.PushNotification(message, size); + notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, message, size); systemTask->PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); } @@ -128,7 +131,8 @@ int main(void) { debounceTimer = xTimerCreate ("debounceTimer", 200, pdFALSE, (void *) 0, DebounceTimerCallback); - systemTask.reset(new Pinetime::System::SystemTask(spi, lcd, touchPanel, lvgl, batteryController, bleController, dateTimeController)); + systemTask.reset(new Pinetime::System::SystemTask(spi, lcd, touchPanel, lvgl, batteryController, bleController, + dateTimeController, notificationManager)); systemTask->Start(); ble_manager_init(); |
