notification.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #pragma once
  2. #include "stdint.h"
  3. #include "stdbool.h"
  4. #include <furi_hal_resources.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. #define RECORD_NOTIFICATION "notification"
  9. typedef struct NotificationApp NotificationApp;
  10. typedef struct {
  11. float frequency;
  12. float volume;
  13. } NotificationMessageDataSound;
  14. typedef struct {
  15. uint8_t value;
  16. } NotificationMessageDataLed;
  17. typedef struct {
  18. bool on;
  19. } NotificationMessageDataVibro;
  20. typedef struct {
  21. uint32_t length;
  22. } NotificationMessageDataDelay;
  23. typedef struct {
  24. float speaker_volume;
  25. bool vibro;
  26. float display_brightness;
  27. } NotificationMessageDataForcedSettings;
  28. typedef struct {
  29. uint16_t on_time;
  30. uint16_t period;
  31. Light color;
  32. } NotificationMessageDataLedBlink;
  33. typedef union {
  34. NotificationMessageDataSound sound;
  35. NotificationMessageDataLed led;
  36. NotificationMessageDataLedBlink led_blink;
  37. NotificationMessageDataVibro vibro;
  38. NotificationMessageDataDelay delay;
  39. NotificationMessageDataForcedSettings forced_settings;
  40. } NotificationMessageData;
  41. typedef enum {
  42. NotificationMessageTypeVibro,
  43. NotificationMessageTypeSoundOn,
  44. NotificationMessageTypeSoundOff,
  45. NotificationMessageTypeLedRed,
  46. NotificationMessageTypeLedGreen,
  47. NotificationMessageTypeLedBlue,
  48. NotificationMessageTypeLedBlinkStart,
  49. NotificationMessageTypeLedBlinkStop,
  50. NotificationMessageTypeLedBlinkColor,
  51. NotificationMessageTypeDelay,
  52. NotificationMessageTypeLedDisplayBacklight,
  53. NotificationMessageTypeLedDisplayBacklightEnforceOn,
  54. NotificationMessageTypeLedDisplayBacklightEnforceAuto,
  55. NotificationMessageTypeDoNotReset,
  56. NotificationMessageTypeForceSpeakerVolumeSetting,
  57. NotificationMessageTypeForceVibroSetting,
  58. NotificationMessageTypeForceDisplayBrightnessSetting,
  59. NotificationMessageTypeLedBrightnessSettingApply,
  60. } NotificationMessageType;
  61. typedef struct {
  62. NotificationMessageType type;
  63. NotificationMessageData data;
  64. } NotificationMessage;
  65. typedef const NotificationMessage* NotificationSequence[];
  66. void notification_message(NotificationApp* app, const NotificationSequence* sequence);
  67. void notification_message_block(NotificationApp* app, const NotificationSequence* sequence);
  68. /**
  69. * @brief Send internal (apply to permanent layer) notification message. Think twice before use.
  70. *
  71. * @param app notification record content
  72. * @param sequence notification sequence
  73. */
  74. void notification_internal_message(NotificationApp* app, const NotificationSequence* sequence);
  75. /**
  76. * @brief Send internal (apply to permanent layer) notification message and wait for notification end. Think twice before use.
  77. *
  78. * @param app notification record content
  79. * @param sequence notification sequence
  80. */
  81. void notification_internal_message_block(
  82. NotificationApp* app,
  83. const NotificationSequence* sequence);
  84. #ifdef __cplusplus
  85. }
  86. #endif