uhf_app_i.h 2.6 KB

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