diff options
| author | JF <jf@codingfield.com> | 2020-03-28 19:05:28 +0100 |
|---|---|---|
| committer | JF <jf@codingfield.com> | 2020-03-28 19:05:28 +0100 |
| commit | baca0fc3e59e88420d6c7983ad133fe63c794ec0 (patch) | |
| tree | e817de0b040712bb95129520fcc51eae59ecc161 /src/Components/Ble/BleController.cpp | |
| parent | 68240704c7a60534342cfc0157564f11cf82d9d8 (diff) | |
Encapsulate Notification management in NotificationManager. It implement a static array of notifications to avoid dynamic allocation.
Diffstat (limited to 'src/Components/Ble/BleController.cpp')
| -rw-r--r-- | src/Components/Ble/BleController.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/Components/Ble/BleController.cpp b/src/Components/Ble/BleController.cpp index fd405896..5fa51688 100644 --- a/src/Components/Ble/BleController.cpp +++ b/src/Components/Ble/BleController.cpp @@ -4,10 +4,6 @@ using namespace Pinetime::Controllers; -Ble::Ble() { - notificationQueue = xQueueCreate(10, sizeof(NotificationMessage)); -} - void Ble::Connect() { isConnected = true; } @@ -16,24 +12,4 @@ void Ble::Disconnect() { isConnected = false; } -void Ble::PushNotification(const char *message, uint8_t size) { - char* messageCopy = static_cast<char *>(malloc(sizeof(char) * size)); - std::memcpy(messageCopy, message, size); - NotificationMessage msg; - msg.size = size; - msg.message = messageCopy; - - BaseType_t xHigherPriorityTaskWoken; - xHigherPriorityTaskWoken = pdFALSE; - xQueueSendFromISR(notificationQueue, &msg, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { - /* Actual macro used here is port specific. */ - // TODO : should I do something here? - } -} - -bool Ble::PopNotification(Ble::NotificationMessage& msg) { - return xQueueReceive(notificationQueue, &msg, 0) != 0; -} - |
