diff options
Diffstat (limited to 'src/components/ble/NotificationManager.cpp')
| -rw-r--r-- | src/components/ble/NotificationManager.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp index 11555be..6771172 100644 --- a/src/components/ble/NotificationManager.cpp +++ b/src/components/ble/NotificationManager.cpp @@ -7,17 +7,10 @@ using namespace Pinetime::Controllers; constexpr uint8_t NotificationManager::MessageSize; -void NotificationManager::Push(Pinetime::Controllers::NotificationManager::Categories category, - const char *message, uint8_t currentMessageSize) { - // TODO handle edge cases on read/write index - auto checkedSize = std::min(currentMessageSize, MessageSize); - auto& notif = notifications[writeIndex]; - std::memcpy(notif.message.data(), message, checkedSize); - notif.message[checkedSize] = '\0'; - notif.category = category; +void NotificationManager::Push(NotificationManager::Notification &¬if) { notif.id = GetNextId(); notif.valid = true; - + notifications[writeIndex] = std::move(notif); writeIndex = (writeIndex + 1 < TotalNbNotifications) ? writeIndex + 1 : 0; if(!empty) readIndex = (readIndex + 1 < TotalNbNotifications) ? readIndex + 1 : 0; |
