diff options
| author | JF <jf@codingfield.com> | 2021-04-21 18:19:57 (GMT) |
|---|---|---|
| committer | Gitea <gitea@fake.local> | 2021-04-21 18:19:57 (GMT) |
| commit | a80e782f267cd2424d22da23d809c0c6a8ff8761 (patch) | |
| tree | ca2bdb100ea98d361296a61352679f63a507f955 /src/components/ble/NotificationManager.cpp | |
| parent | 24d3eea4fba05d774ace794eb8c9b21b8f2aa8c6 (diff) | |
| parent | fefb429fb4bf1020553900d9e514d3baa9040325 (diff) | |
Merge branch 'develop' of JF/PineTime into master
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 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 {}; +} |
