subbrute_i.h 3.7 KB

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