notification.h 2.8 KB

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