plugin_state.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #pragma once
  2. #include <notification/notification.h>
  3. #include <gui/gui.h>
  4. #include <dialogs/dialogs.h>
  5. #include "../features_config.h"
  6. #include "../ui/totp_scenes_enum.h"
  7. #include "../services/config/config_file_context.h"
  8. #include "../services/idle_timeout/idle_timeout.h"
  9. #include "notification_method.h"
  10. #include "automation_method.h"
  11. #ifdef TOTP_BADBT_TYPE_ENABLED
  12. #include "../workers/bt_type_code/bt_type_code.h"
  13. #endif
  14. #define TOTP_IV_SIZE (16)
  15. /**
  16. * @brief Application state structure
  17. */
  18. typedef struct {
  19. /**
  20. * @brief Application current scene
  21. */
  22. Scene current_scene;
  23. /**
  24. * @brief Application current scene state
  25. */
  26. void* current_scene_state;
  27. /**
  28. * @brief Reference to the firmware notification subsystem
  29. */
  30. NotificationApp* notification_app;
  31. /**
  32. * @brief Reference to the firmware dialogs subsystem
  33. */
  34. DialogsApp* dialogs_app;
  35. /**
  36. * @brief Reference to the firmware GUI subsystem
  37. */
  38. Gui* gui;
  39. /**
  40. * @brief Timezone UTC offset in hours
  41. */
  42. float timezone_offset;
  43. /**
  44. * @brief Config file context
  45. */
  46. ConfigFileContext* config_file_context;
  47. /**
  48. * @brief Encrypted well-known string data
  49. */
  50. uint8_t* crypto_verify_data;
  51. /**
  52. * @brief Encrypted well-known string data length
  53. */
  54. size_t crypto_verify_data_length;
  55. /**
  56. * @brief Whether PIN is set by user or not
  57. */
  58. bool pin_set;
  59. /**
  60. * @brief Initialization vector (IV) to be used for encryption\decryption
  61. */
  62. uint8_t iv[TOTP_IV_SIZE];
  63. /**
  64. * @brief Basic randomly-generated initialization vector (IV)
  65. */
  66. uint8_t base_iv[TOTP_IV_SIZE];
  67. /**
  68. * @brief Notification method
  69. */
  70. NotificationMethod notification_method;
  71. /**
  72. * @brief Main rendering loop mutex
  73. */
  74. FuriMutex* mutex;
  75. /**
  76. * @brief Automation method
  77. */
  78. AutomationMethod automation_method;
  79. #ifdef TOTP_BADBT_TYPE_ENABLED
  80. /**
  81. * @brief Bad-Bluetooth worker context
  82. */
  83. TotpBtTypeCodeWorkerContext* bt_type_code_worker_context;
  84. #endif
  85. /**
  86. * @brief IDLE timeout context
  87. */
  88. IdleTimeoutContext* idle_timeout_context;
  89. /**
  90. * @brief Font index to be used to draw TOTP token
  91. */
  92. uint8_t active_font_index;
  93. } PluginState;