subbrute_i.h 3.9 KB

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