subbrute_i.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. #include <input/input.h>
  5. #include <notification/notification.h>
  6. #include <notification/notification_messages.h>
  7. #include <gui/gui.h>
  8. #include <gui/view_dispatcher.h>
  9. #include <gui/view_stack.h>
  10. #include <gui/scene_manager.h>
  11. #include <gui/modules/text_input.h>
  12. #include <gui/modules/popup.h>
  13. #include <gui/modules/widget.h>
  14. #include <gui/modules/loading.h>
  15. #include <gui/modules/variable_item_list.h>
  16. #include "subghz_bruteforcer_icons.h"
  17. #include <assets_icons.h>
  18. #include <dialogs/dialogs.h>
  19. #include <notification/notification.h>
  20. #include <notification/notification_messages.h>
  21. #include "subbrute.h"
  22. #include "subbrute_device.h"
  23. #include "subbrute_settings.h"
  24. #include "helpers/subbrute_worker.h"
  25. #include "views/subbrute_attack_view.h"
  26. #include "views/subbrute_main_view.h"
  27. #define SUBBRUTEFORCER_VER "Sub-GHz BruteForcer 3.C"
  28. #ifdef FURI_DEBUG
  29. //#define SUBBRUTE_FAST_TRACK false
  30. #endif
  31. /**
  32. * @enum SubBruteView
  33. * @brief An enumeration representing the different views of the SubBrute application
  34. *
  35. * This enumeration represents the possible views that the SubBrute application can have. Each view
  36. * corresponds to a specific screen or UI element in the application.
  37. */
  38. typedef enum {
  39. SubBruteViewNone,
  40. SubBruteViewMain,
  41. SubBruteViewAttack,
  42. SubBruteViewTextInput,
  43. SubBruteViewDialogEx,
  44. SubBruteViewPopup,
  45. SubBruteViewWidget,
  46. SubBruteViewStack,
  47. SubBruteViewVarList,
  48. } SubBruteView;
  49. /**
  50. * @class SubBruteState
  51. * @brief Represents the state of a SubBrute application.
  52. *
  53. * This class contains the various elements and variables necessary for the functioning of a SubBrute application.
  54. */
  55. struct SubBruteState {
  56. // GUI elements
  57. NotificationApp* notifications;
  58. Gui* gui;
  59. ViewDispatcher* view_dispatcher;
  60. ViewStack* view_stack;
  61. TextInput* text_input;
  62. Popup* popup;
  63. Widget* widget;
  64. VariableItemList* var_list;
  65. DialogsApp* dialogs;
  66. const SubGhzDevice* radio_device;
  67. // Text store
  68. char text_store[SUBBRUTE_MAX_LEN_NAME];
  69. FuriString* file_path;
  70. // Views
  71. SubBruteMainView* view_main;
  72. SubBruteAttackView* view_attack;
  73. SubBruteView current_view;
  74. // Scene
  75. SceneManager* scene_manager;
  76. // SubBruteDevice
  77. SubBruteDevice* device;
  78. // SubBruteWorker
  79. SubBruteWorker* worker;
  80. // Last used settings
  81. SubBruteSettings* settings;
  82. };
  83. /**
  84. * @brief Function to show or hide a loading popup.
  85. *
  86. * This function is used to display or hide a loading popup in a user interface.
  87. * The loading popup appears when an action is being performed that may take some time to complete.
  88. *
  89. * @param context A pointer to the context object associated with the loading popup.
  90. * @param show A boolean value indicating whether to display or hide the loading popup.
  91. */
  92. void subbrute_show_loading_popup(void* context, bool show);
  93. /**
  94. * @brief Callback function for text input in the sub-brute module.
  95. *
  96. * This function serves as a callback for handling text input in the sub-brute module.
  97. * It should be registered as a callback function for text input events.
  98. *
  99. * @param context A pointer to additional context data (if any).
  100. *
  101. * @return None
  102. */
  103. void subbrute_text_input_callback(void* context);
  104. /**
  105. * @brief Callback function called when a popup window is closed.
  106. *
  107. * This function is called when a popup window is closed. It can be used to perform
  108. * any necessary cleanup or additional processing after the popup window is closed.
  109. *
  110. * @param context A void pointer to the context data associated with the popup window.
  111. * It can be used to pass any additional information needed by the callback function.
  112. *
  113. * @return void
  114. */
  115. void subbrute_popup_closed_callback(void* context);