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/SystemTask | |
| parent | 68240704c7a60534342cfc0157564f11cf82d9d8 (diff) | |
Encapsulate Notification management in NotificationManager. It implement a static array of notifications to avoid dynamic allocation.
Diffstat (limited to 'src/SystemTask')
| -rw-r--r-- | src/SystemTask/SystemTask.cpp | 15 | ||||
| -rw-r--r-- | src/SystemTask/SystemTask.h | 13 |
2 files changed, 15 insertions, 13 deletions
diff --git a/src/SystemTask/SystemTask.cpp b/src/SystemTask/SystemTask.cpp index 0080c6b..e65abb6 100644 --- a/src/SystemTask/SystemTask.cpp +++ b/src/SystemTask/SystemTask.cpp @@ -5,17 +5,19 @@ #include <hal/nrf_rtc.h> #include <BLE/BleManager.h> #include <softdevice/common/nrf_sdh_freertos.h> +#include <Components/Ble/NotificationManager.h> #include "SystemTask.h" #include "../main.h" using namespace Pinetime::System; -SystemTask::SystemTask(Pinetime::Drivers::SpiMaster &spi, Pinetime::Drivers::St7789 &lcd, - Pinetime::Drivers::Cst816S &touchPanel, Pinetime::Components::LittleVgl &lvgl, - Pinetime::Controllers::Battery &batteryController, Pinetime::Controllers::Ble &bleController, - Pinetime::Controllers::DateTime& dateTimeController) : +SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, Drivers::Cst816S &touchPanel, + Components::LittleVgl &lvgl, + Controllers::Battery &batteryController, Controllers::Ble &bleController, + Controllers::DateTime &dateTimeController, + Pinetime::Controllers::NotificationManager& notificationManager) : spi{spi}, lcd{lcd}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController}, bleController{bleController}, dateTimeController{dateTimeController}, - watchdog{}, watchdogView{watchdog}{ + watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager} { systemTaksMsgQueue = xQueueCreate(10, 1); } @@ -44,7 +46,8 @@ void SystemTask::Work() { touchPanel.Init(); batteryController.Init(); - displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController, dateTimeController, watchdogView, *this)); + displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController, + dateTimeController, watchdogView, *this, notificationManager)); displayApp->Start(); batteryController.Update(); diff --git a/src/SystemTask/SystemTask.h b/src/SystemTask/SystemTask.h index b64fda6..a1ba277 100644 --- a/src/SystemTask/SystemTask.h +++ b/src/SystemTask/SystemTask.h @@ -16,13 +16,11 @@ namespace Pinetime { enum class Messages {GoToSleep, GoToRunning, OnNewTime, OnNewNotification }; - SystemTask(Pinetime::Drivers::SpiMaster& spi, - Pinetime::Drivers::St7789& lcd, - Pinetime::Drivers::Cst816S& touchPanel, - Pinetime::Components::LittleVgl& lvgl, - Pinetime::Controllers::Battery& batteryController, - Pinetime::Controllers::Ble& bleController, - Pinetime::Controllers::DateTime& dateTimeController); + SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, Drivers::Cst816S &touchPanel, + Components::LittleVgl &lvgl, + Controllers::Battery &batteryController, Controllers::Ble &bleController, + Controllers::DateTime &dateTimeController, + Pinetime::Controllers::NotificationManager& manager); void Start(); @@ -45,6 +43,7 @@ namespace Pinetime { bool isSleeping = false; Pinetime::Drivers::Watchdog watchdog; Pinetime::Drivers::WatchdogView watchdogView; + Pinetime::Controllers::NotificationManager& notificationManager; static constexpr uint8_t pinSpiSck = 2; |
