summaryrefslogtreecommitdiff
path: root/src/Components/Ble/BleController.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-03-28 18:05:28 (GMT)
committerJF <jf@codingfield.com>2020-03-28 18:05:28 (GMT)
commitbaca0fc3e59e88420d6c7983ad133fe63c794ec0 (patch)
treee817de0b040712bb95129520fcc51eae59ecc161 /src/Components/Ble/BleController.cpp
parent68240704c7a60534342cfc0157564f11cf82d9d8 (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.cpp24
1 files changed, 0 insertions, 24 deletions
diff --git a/src/Components/Ble/BleController.cpp b/src/Components/Ble/BleController.cpp
index fd40589..5fa5168 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;
-}
-