lfrfid-app.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #pragma once
  2. #include <furi.h>
  3. #include <api-hal.h>
  4. #include <generic-scene.hpp>
  5. #include <scene-controller.hpp>
  6. #include <view-controller.hpp>
  7. #include <record-controller.hpp>
  8. #include <text-store.h>
  9. #include <view-modules/submenu-vm.h>
  10. #include <view-modules/popup-vm.h>
  11. #include <view-modules/dialog-ex-vm.h>
  12. #include <view-modules/text-input-vm.h>
  13. #include <view-modules/byte-input-vm.h>
  14. #include "view/container-vm.h"
  15. #include <notification/notification-messages.h>
  16. #include "helpers/rfid-worker.h"
  17. class LfRfidApp {
  18. public:
  19. enum class EventType : uint8_t {
  20. GENERIC_EVENT_ENUM_VALUES,
  21. Next,
  22. MenuSelected,
  23. };
  24. enum class SceneType : uint8_t {
  25. GENERIC_SCENE_ENUM_VALUES,
  26. Read,
  27. ReadSuccess,
  28. ReadedMenu,
  29. Write,
  30. WriteSuccess,
  31. Emulate,
  32. SaveName,
  33. SaveSuccess,
  34. SelectKey,
  35. SavedKeyMenu,
  36. SaveData,
  37. SaveType,
  38. SavedInfo,
  39. DeleteConfirm,
  40. DeleteSuccess,
  41. };
  42. class Event {
  43. public:
  44. union {
  45. int32_t menu_index;
  46. } payload;
  47. EventType type;
  48. };
  49. SceneController<GenericScene<LfRfidApp>, LfRfidApp> scene_controller;
  50. ViewController<LfRfidApp, SubmenuVM, PopupVM, DialogExVM, TextInputVM, ByteInputVM, ContainerVM>
  51. view_controller;
  52. ~LfRfidApp();
  53. LfRfidApp();
  54. RecordController<NotificationApp> notification;
  55. RfidWorker worker;
  56. TextStore text_store;
  57. void run(void* args);
  58. static const char* app_folder;
  59. static const char* app_extension;
  60. bool save_key(RfidKey* key);
  61. bool load_key_from_file_select(bool need_restore);
  62. bool delete_key(RfidKey* key);
  63. bool load_key_data(const char* path, RfidKey* key);
  64. bool save_key_data(const char* path, RfidKey* key);
  65. void make_app_folder();
  66. };