summaryrefslogtreecommitdiff
path: root/src/DisplayApp/DisplayApp.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-03-28 19:05:28 +0100
committerJF <jf@codingfield.com>2020-03-28 19:05:28 +0100
commitbaca0fc3e59e88420d6c7983ad133fe63c794ec0 (patch)
treee817de0b040712bb95129520fcc51eae59ecc161 /src/DisplayApp/DisplayApp.cpp
parent68240704c7a60534342cfc0157564f11cf82d9d8 (diff)
Encapsulate Notification management in NotificationManager. It implement a static array of notifications to avoid dynamic allocation.
Diffstat (limited to 'src/DisplayApp/DisplayApp.cpp')
-rw-r--r--src/DisplayApp/DisplayApp.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/DisplayApp/DisplayApp.cpp b/src/DisplayApp/DisplayApp.cpp
index 2e07cbc5..1b4515e0 100644
--- a/src/DisplayApp/DisplayApp.cpp
+++ b/src/DisplayApp/DisplayApp.cpp
@@ -15,18 +15,16 @@
#include <DisplayApp/Screens/Gauge.h>
#include <DisplayApp/Screens/Brightness.h>
#include <DisplayApp/Screens/ScreenList.h>
+#include <Components/Ble/NotificationManager.h>
#include "../SystemTask/SystemTask.h"
using namespace Pinetime::Applications;
-DisplayApp::DisplayApp(Pinetime::Drivers::St7789& lcd,
- Pinetime::Components::LittleVgl& lvgl,
- Pinetime::Drivers::Cst816S& touchPanel,
- Controllers::Battery &batteryController,
- Controllers::Ble &bleController,
- Controllers::DateTime &dateTimeController,
- Pinetime::Drivers::WatchdogView& watchdog,
- Pinetime::System::SystemTask& systemTask) :
+DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &touchPanel,
+ Controllers::Battery &batteryController, Controllers::Ble &bleController,
+ Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
+ System::SystemTask &systemTask,
+ Pinetime::Controllers::NotificationManager& notificationManager) :
lcd{lcd},
lvgl{lvgl},
batteryController{batteryController},
@@ -35,7 +33,8 @@ DisplayApp::DisplayApp(Pinetime::Drivers::St7789& lcd,
watchdog{watchdog},
touchPanel{touchPanel},
currentScreen{new Screens::Clock(this, dateTimeController, batteryController, bleController) },
- systemTask{systemTask} {
+ systemTask{systemTask},
+ notificationManager{notificationManager} {
msgQueue = xQueueCreate(queueSize, itemSize);
onClockApp = true;
modal.reset(new Screens::Modal(this));
@@ -113,12 +112,8 @@ void DisplayApp::Refresh() {
// clockScreen.SetBatteryPercentRemaining(batteryController.PercentRemaining());
break;
case Messages::NewNotification: {
- Pinetime::Controllers::Ble::NotificationMessage notificationMessage;
- if (bleController.PopNotification(notificationMessage)) {
- std::string m {notificationMessage.message, notificationMessage.size};
- modal->Show(m);
- // TODO delete message
- }
+ auto notification = notificationManager.Pop();
+ modal->Show(notification.message.data());
}
break;
case Messages::TouchEvent: {