diff options
| author | JF <jf@codingfield.com> | 2020-10-22 08:43:42 (GMT) |
|---|---|---|
| committer | JF <jf@codingfield.com> | 2020-10-22 08:43:42 (GMT) |
| commit | 07b6812f61cf5b7726fbf6015c2c60caa12c7f20 (patch) | |
| tree | 1dc7a0e6c2dbf9760437e61b38602f87a5537ec9 /src/components/ble/ImmediateAlertService.cpp | |
| parent | cabf1168d429db84b0985e25881ead86d80dde3c (diff) | |
Notifications : Fix copy when the messages is spread across multiple os_mbuf.
Diffstat (limited to 'src/components/ble/ImmediateAlertService.cpp')
| -rw-r--r-- | src/components/ble/ImmediateAlertService.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/components/ble/ImmediateAlertService.cpp b/src/components/ble/ImmediateAlertService.cpp index 3b7f47b..e2cee30 100644 --- a/src/components/ble/ImmediateAlertService.cpp +++ b/src/components/ble/ImmediateAlertService.cpp @@ -1,4 +1,5 @@ #include <systemtask/SystemTask.h> +#include <cstring> #include "ImmediateAlertService.h" #include "AlertNotificationService.h" @@ -67,7 +68,12 @@ int ImmediateAlertService::OnAlertLevelChanged(uint16_t connectionHandle, uint16 if(context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { auto alertLevel = static_cast<Levels>(context->om->om_data[0]); auto* alertString = ToString(alertLevel); - notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, alertString, strlen(alertString)); + + NotificationManager::Notification notif; + std::memcpy(notif.message.data(), alertString, strlen(alertString)); + notif.category = Pinetime::Controllers::NotificationManager::Categories::SimpleAlert; + notificationManager.Push(std::move(notif)); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); } } |
