Encapsulate Notification management in NotificationManager. It implement a static array of notifications to avoid dynamic allocation.
This commit is contained in:
@@ -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();
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user