summaryrefslogtreecommitdiff
path: root/src/components/ble/NotificationManager.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2021-04-21 18:19:57 (GMT)
committerGitea <gitea@fake.local>2021-04-21 18:19:57 (GMT)
commita80e782f267cd2424d22da23d809c0c6a8ff8761 (patch)
treeca2bdb100ea98d361296a61352679f63a507f955 /src/components/ble/NotificationManager.cpp
parent24d3eea4fba05d774ace794eb8c9b21b8f2aa8c6 (diff)
parentfefb429fb4bf1020553900d9e514d3baa9040325 (diff)
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/components/ble/NotificationManager.cpp')
-rw-r--r--src/components/ble/NotificationManager.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp
index 36abf02..88e83b9 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 {};
+}