From ef5670c7e09a1a63fc5df4a066472ed7fe7550ff Mon Sep 17 00:00:00 2001 From: JF Date: Tue, 20 Oct 2020 20:57:39 +0200 Subject: Integrate new notification UI with notifications coming from BLE --- src/components/ble/NotificationManager.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/components/ble/NotificationManager.h') diff --git a/src/components/ble/NotificationManager.h b/src/components/ble/NotificationManager.h index daa1571b..6bf689a8 100644 --- a/src/components/ble/NotificationManager.h +++ b/src/components/ble/NotificationManager.h @@ -1,6 +1,7 @@ #pragma once #include +#include namespace Pinetime { namespace Controllers { @@ -10,20 +11,32 @@ namespace Pinetime { static constexpr uint8_t MessageSize{18}; struct Notification { + using Id = uint8_t; + Id id; + bool valid = false; + uint8_t index; + uint8_t number = TotalNbNotifications; std::array message; Categories category = Categories::Unknown; }; + Notification::Id nextId {0}; void Push(Categories category, const char* message, uint8_t messageSize); - Notification Pop(); + Notification GetLastNotification(); + Notification GetNext(Notification::Id id); + Notification GetPrevious(Notification::Id id); + bool ClearNewNotificationFlag(); + bool AreNewNotificationsAvailable(); private: + Notification::Id GetNextId(); static constexpr uint8_t TotalNbNotifications = 5; std::array notifications; uint8_t readIndex = 0; uint8_t writeIndex = 0; bool empty = true; + std::atomic newNotification{false}; }; } } \ No newline at end of file -- cgit v1.2.3-70-g09d2