diff options
| author | Jean-François Milants <jf@codingfield.com> | 2021-04-09 18:47:39 (GMT) |
|---|---|---|
| committer | Jean-François Milants <jf@codingfield.com> | 2021-04-09 18:47:39 (GMT) |
| commit | 4560e9ed60aeacbd7d1c7c1221fe8fdc4d1bb130 (patch) | |
| tree | b8ee17d8bfdc57c3b80b7c918f3431d198939856 /src/components/ble/NotificationManager.cpp | |
| parent | 9096d1db4c6be9f4a2cc8af99a994c219f25108c (diff) | |
| parent | 63584b6561cbc31095354b06e356f700dcf0e32b (diff) | |
Merge branch 'notification-title' into develop
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 {}; +} |
