void BadgeNotifications::handleMessage(const IncomingRadioMessage& aIncomingRadioMessage) { // parse the radio message content into mBadgeNotification // <3 bytes rgb1> <3 bytes rgb2> <1 byte sound> <text> if (xSemaphoreTake(mNotificationMutex, portMAX_DELAY) == pdTRUE) { mReader.setBuffer((unsigned char*)aIncomingRadioMessage.content(), aIncomingRadioMessage.length()); RGBColor rgb1 = getRGBColor(mReader); RGBColor rgb2 = getRGBColor(mReader); boolean sound = Utils::getBoolean(mReader); uint8_t type = static_cast<uint8_t>(Utils::getInteger(mReader)); char* textChars = Utils::getString(mReader); String text(textChars); delete textChars; debug::log("BADGER NOTIFICATION"); debug::log(text); delete mBadgeNotification; mBadgeNotification = new BadgeNotification(text, rgb1, rgb2, sound, type); xSemaphoreGive(mNotificationMutex); Tilda::openApp(NotificationApp::New); } // start the notification app to start it //mAppManager->open(NotificationApp::New); }
void BadgeNotifications::handleMessage(const IncomingRadioMessage& aIncomingRadioMessage) { // parse the radio message content into mBadgeNotification // <3 bytes rgb1> <3 bytes rgb2> <1 byte sound> <text> mReader.setBuffer((unsigned char*)aIncomingRadioMessage.content(), aIncomingRadioMessage.length()); RGBColor rgb1 = getRGBColor(mReader); RGBColor rgb2 = getRGBColor(mReader); boolean sound = Utils::getBoolean(mReader); uint8_t type = static_cast<uint8_t>(Utils::getInteger(mReader)); char* textChars = Utils::getString(mReader); String text(textChars); delete[] textChars; debug::log("BADGER NOTIFICATION"); debug::log(text); pushNotification(text, rgb1, rgb2, sound, type); }