notification_app_api.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <furi.h>
  2. #include <furi_hal.h>
  3. #include "notification.h"
  4. #include "notification_messages.h"
  5. #include "notification_app.h"
  6. void notification_message(NotificationApp* app, const NotificationSequence* sequence) {
  7. NotificationAppMessage m = {
  8. .type = NotificationLayerMessage, .sequence = sequence, .back_event = NULL};
  9. furi_check(osMessageQueuePut(app->queue, &m, 0, osWaitForever) == osOK);
  10. };
  11. void notification_internal_message(NotificationApp* app, const NotificationSequence* sequence) {
  12. NotificationAppMessage m = {
  13. .type = InternalLayerMessage, .sequence = sequence, .back_event = NULL};
  14. furi_check(osMessageQueuePut(app->queue, &m, 0, osWaitForever) == osOK);
  15. };
  16. void notification_message_block(NotificationApp* app, const NotificationSequence* sequence) {
  17. NotificationAppMessage m = {
  18. .type = NotificationLayerMessage,
  19. .sequence = sequence,
  20. .back_event = osEventFlagsNew(NULL)};
  21. furi_check(osMessageQueuePut(app->queue, &m, 0, osWaitForever) == osOK);
  22. osEventFlagsWait(m.back_event, NOTIFICATION_EVENT_COMPLETE, osFlagsWaitAny, osWaitForever);
  23. osEventFlagsDelete(m.back_event);
  24. };
  25. void notification_internal_message_block(
  26. NotificationApp* app,
  27. const NotificationSequence* sequence) {
  28. NotificationAppMessage m = {
  29. .type = InternalLayerMessage, .sequence = sequence, .back_event = osEventFlagsNew(NULL)};
  30. furi_check(osMessageQueuePut(app->queue, &m, 0, osWaitForever) == osOK);
  31. osEventFlagsWait(m.back_event, NOTIFICATION_EVENT_COMPLETE, osFlagsWaitAny, osWaitForever);
  32. osEventFlagsDelete(m.back_event);
  33. };