subbrute_i.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 SUB_BRUTE_FORCER_VERSION "Sub-GHz BruteForcer 3.D"
  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, /**< Not used */
  40. SubBruteViewMain,
  41. SubBruteViewAttack,
  42. SubBruteViewTextInput,
  43. SubBruteViewDialogEx, /**< Not used */
  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. char text_store[SUBBRUTE_MAX_LEN_NAME]; /**< Text store */
  67. FuriString* file_path;
  68. const SubGhzDevice* radio_device; /**< Radio device */
  69. /** Views */
  70. SubBruteMainView* view_main; /**< Main menu */
  71. SubBruteAttackView* view_attack; /**< View for attack and setup current protocol */
  72. SubBruteView current_view;
  73. SceneManager* scene_manager; /**< Scene manager */
  74. SubBruteDevice* device; /**< SubBruteDevice to get value of transmission */
  75. SubBruteWorker* worker; /**< SubBruteWorker worker for background job */
  76. SubBruteSettings* settings; /**< Last used settings */
  77. };
  78. /**
  79. * @brief Function to show or hide a loading popup.
  80. *
  81. * This function is used to display or hide a loading popup in a user interface.
  82. * The loading popup appears when an action is being performed that may take some time to complete.
  83. *
  84. * @param context A pointer to the context object associated with the loading popup.
  85. * @param show A boolean value indicating whether to display or hide the loading popup.
  86. */
  87. void subbrute_show_loading_popup(void* context, bool show);
  88. /**
  89. * @brief Callback function for text input in the sub-brute module.
  90. *
  91. * This function serves as a callback for handling text input in the sub-brute module.
  92. * It should be registered as a callback function for text input events.
  93. *
  94. * @param context A pointer to additional context data (if any).
  95. *
  96. * @return None
  97. */
  98. void subbrute_text_input_callback(void* context);
  99. /**
  100. * @brief Callback function called when a popup window is closed.
  101. *
  102. * This function is called when a popup window is closed. It can be used to perform
  103. * any necessary cleanup or additional processing after the popup window is closed.
  104. *
  105. * @param context A void pointer to the context data associated with the popup window.
  106. * It can be used to pass any additional information needed by the callback function.
  107. *
  108. * @return void
  109. */
  110. void subbrute_popup_closed_callback(void* context);