2021-05-24 13:44:14 +00:00
|
|
|
#include <furi.h>
|
2022-01-05 16:10:18 +00:00
|
|
|
#include <furi_hal.h>
|
2021-05-24 13:44:14 +00:00
|
|
|
#include "notification.h"
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "notification_messages.h"
|
|
|
|
#include "notification_app.h"
|
2021-05-24 13:44:14 +00:00
|
|
|
|
|
|
|
void notification_message(NotificationApp* app, const NotificationSequence* sequence) {
|
2024-03-19 14:43:52 +00:00
|
|
|
furi_check(app);
|
|
|
|
furi_check(sequence);
|
|
|
|
|
2021-05-24 13:44:14 +00:00
|
|
|
NotificationAppMessage m = {
|
|
|
|
.type = NotificationLayerMessage, .sequence = sequence, .back_event = NULL};
|
2022-07-20 10:56:33 +00:00
|
|
|
furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk);
|
2021-05-24 13:44:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void notification_internal_message(NotificationApp* app, const NotificationSequence* sequence) {
|
2024-03-19 14:43:52 +00:00
|
|
|
furi_check(app);
|
|
|
|
furi_check(sequence);
|
|
|
|
|
2021-05-24 13:44:14 +00:00
|
|
|
NotificationAppMessage m = {
|
|
|
|
.type = InternalLayerMessage, .sequence = sequence, .back_event = NULL};
|
2022-07-20 10:56:33 +00:00
|
|
|
furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk);
|
2021-05-24 13:44:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void notification_message_block(NotificationApp* app, const NotificationSequence* sequence) {
|
2024-03-19 14:43:52 +00:00
|
|
|
furi_check(app);
|
|
|
|
furi_check(sequence);
|
|
|
|
|
2021-05-24 13:44:14 +00:00
|
|
|
NotificationAppMessage m = {
|
|
|
|
.type = NotificationLayerMessage,
|
|
|
|
.sequence = sequence,
|
2022-07-20 10:56:33 +00:00
|
|
|
.back_event = furi_event_flag_alloc()};
|
|
|
|
furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk);
|
|
|
|
furi_event_flag_wait(
|
|
|
|
m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever);
|
|
|
|
furi_event_flag_free(m.back_event);
|
2021-05-24 13:44:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void notification_internal_message_block(
|
|
|
|
NotificationApp* app,
|
|
|
|
const NotificationSequence* sequence) {
|
2024-03-19 14:43:52 +00:00
|
|
|
furi_check(app);
|
|
|
|
furi_check(sequence);
|
|
|
|
|
2021-05-24 13:44:14 +00:00
|
|
|
NotificationAppMessage m = {
|
2022-07-20 10:56:33 +00:00
|
|
|
.type = InternalLayerMessage, .sequence = sequence, .back_event = furi_event_flag_alloc()};
|
|
|
|
furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk);
|
|
|
|
furi_event_flag_wait(
|
|
|
|
m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever);
|
|
|
|
furi_event_flag_free(m.back_event);
|
2022-05-06 13:37:10 +00:00
|
|
|
};
|