uhf_app_i.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 <gui/canvas_i.h>
  7. #include <notification/notification_messages.h>
  8. #include <gui/modules/submenu.h>
  9. #include <gui/modules/popup.h>
  10. #include <gui/modules/loading.h>
  11. #include <gui/modules/text_input.h>
  12. #include <gui/modules/widget.h>
  13. #include <input/input.h>
  14. #include "scenes/uhf_scene.h"
  15. #include <storage/storage.h>
  16. #include <lib/toolbox/path.h>
  17. #include "uhf_app.h"
  18. #include "uhf_worker.h"
  19. #include <uhf_rfid_icons.h>
  20. #define UHF_TEXT_STORE_SIZE 128
  21. enum UHFCustomEvent {
  22. // Reserve first 100 events for button types and indexes, starting from 0
  23. UHFCustomEventReserved = 100,
  24. UHFCustomEventViewExit,
  25. UHFCustomEventWorkerExit,
  26. UHFCustomEventByteInputDone,
  27. UHFCustomEventTextInputDone,
  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);
  73. char* convertToHexString(const uint8_t* array, size_t length);