diff options
author | Jean-François Milants <jf@codingfield.com> | 2021-04-09 21:16:21 +0200 |
---|---|---|
committer | Jean-François Milants <jf@codingfield.com> | 2021-04-09 21:16:21 +0200 |
commit | 15b3b8e282dd5b2132b0095716cd9d88740d4579 (patch) | |
tree | c26870103f8baaa933399cfb86cca25aa7e60d8b /src/components/ble/NotificationManager.cpp | |
parent | 9ac4be8b759bb2cedeb999ce5e87d983261beded (diff) | |
parent | 57b4c3f0edc6acfa31bd2160abdcd6091920ba63 (diff) |
Merge branch 'develop' into motion-sensor
# Conflicts:
# src/CMakeLists.txt
# src/displayapp/Apps.h
# src/displayapp/DisplayApp.cpp
# src/displayapp/DisplayApp.h
# src/displayapp/lv_pinetime_theme.c
# src/displayapp/screens/ApplicationList.cpp
# src/drivers/TwiMaster.cpp
# src/systemtask/SystemTask.h
Diffstat (limited to 'src/components/ble/NotificationManager.cpp')
-rw-r--r-- | src/components/ble/NotificationManager.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp index 36abf026..88e83b92 100644 --- a/src/components/ble/NotificationManager.cpp +++ b/src/components/ble/NotificationManager.cpp @@ -87,3 +87,19 @@ size_t NotificationManager::NbNotifications() const { return std::count_if(notifications.begin(), notifications.end(), [](const Notification& n){ return n.valid;}); } +const char* NotificationManager::Notification::Message() const { + const char* itField = std::find(message.begin(), message.begin()+size-1, '\0'); + if(itField != message.begin()+size-1) { + const char* ptr = (itField)+1; + return ptr; + } + return const_cast<char*>(message.data()); +} + +const char* NotificationManager::Notification::Title() const { + const char * itField = std::find(message.begin(), message.begin()+size-1, '\0'); + if(itField != message.begin()+size-1) { + return message.data(); + } + return {}; +} |