uhf_app_i.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #pragma once
  2. #include "uhf_app.h"
  3. #include "uhf_worker.h"
  4. #include <furi.h>
  5. #include <gui/gui.h>
  6. #include <gui/view_dispatcher.h>
  7. #include <gui/scene_manager.h>
  8. #include <notification/notification_messages.h>
  9. #include <gui/modules/submenu.h>
  10. #include <gui/modules/popup.h>
  11. #include <gui/modules/loading.h>
  12. #include <gui/modules/text_input.h>
  13. #include <gui/modules/widget.h>
  14. #include <input/input.h>
  15. #include "scenes/uhf_scene.h"
  16. #include <storage/storage.h>
  17. #include <lib/toolbox/path.h>
  18. // #include <uhf_icons.h>
  19. #define UHF_TEXT_STORE_SIZE 128
  20. enum UHFCustomEvent {
  21. // Reserve first 100 events for button types and indexes, starting from 0
  22. UHFCustomEventReserved = 100,
  23. UHFCustomEventViewExit,
  24. UHFCustomEventWorkerExit,
  25. UHFCustomEventByteInputDone,
  26. UHFCustomEventTextInputDone,
  27. UHFCustomEventDictAttackSkip,
  28. };
  29. typedef enum {
  30. EventTypeTick,
  31. EventTypeKey,
  32. } EventType;
  33. struct UHFApp {
  34. UHFWorker* worker;
  35. ViewDispatcher* view_dispatcher;
  36. Gui* gui;
  37. NotificationApp* notifications;
  38. SceneManager* scene_manager;
  39. // UHFDevice* dev;
  40. char text_store[UHF_TEXT_STORE_SIZE + 1];
  41. FuriString* text_box_store;
  42. // Common Views
  43. Submenu* submenu;
  44. Popup* popup;
  45. Loading* loading;
  46. TextInput* text_input;
  47. Widget* widget;
  48. };
  49. typedef enum {
  50. UHFViewMenu,
  51. UHFViewPopup,
  52. UHFViewLoading,
  53. UHFViewTextInput,
  54. UHFViewWidget,
  55. } UHFView;
  56. UHFApp* uhf_app_alloc();
  57. void uhf_text_store_set(UHFApp* uhf, const char* text, ...);
  58. void uhf_text_store_clear(UHFApp* uhf);
  59. void uhf_blink_start(UHFApp* uhf);
  60. void uhf_blink_stop(UHFApp* uhf);
  61. void uhf_show_loading_popup(void* context, bool show);
  62. /** Check if memory is set to pattern
  63. *
  64. * @warning zero size will return false
  65. *
  66. * @param[in] data Pointer to the byte array
  67. * @param[in] pattern The pattern
  68. * @param[in] size The byte array size
  69. *
  70. * @return True if memory is set to pattern, false otherwise
  71. */
  72. bool uhf_is_memset(const uint8_t* data, const uint8_t pattern, size_t size);