2021-06-28 17:42:30 +03:00
|
|
|
#pragma once
|
|
|
|
#include <furi.h>
|
2021-08-08 21:03:25 +03:00
|
|
|
#include <furi-hal.h>
|
2021-06-28 17:42:30 +03:00
|
|
|
|
|
|
|
#include <generic-scene.hpp>
|
|
|
|
#include <scene-controller.hpp>
|
|
|
|
#include <view-controller.hpp>
|
|
|
|
#include <record-controller.hpp>
|
|
|
|
#include <text-store.h>
|
|
|
|
|
|
|
|
#include <view-modules/submenu-vm.h>
|
|
|
|
#include <view-modules/popup-vm.h>
|
|
|
|
#include <view-modules/dialog-ex-vm.h>
|
|
|
|
#include <view-modules/text-input-vm.h>
|
|
|
|
#include <view-modules/byte-input-vm.h>
|
|
|
|
#include "view/container-vm.h"
|
|
|
|
|
|
|
|
#include <notification/notification-messages.h>
|
2021-10-06 12:40:28 +03:00
|
|
|
#include <storage/storage.h>
|
|
|
|
#include <dialogs/dialogs.h>
|
2021-06-28 17:42:30 +03:00
|
|
|
|
|
|
|
#include "helpers/rfid-worker.h"
|
|
|
|
|
|
|
|
class LfRfidApp {
|
|
|
|
public:
|
|
|
|
enum class EventType : uint8_t {
|
|
|
|
GENERIC_EVENT_ENUM_VALUES,
|
|
|
|
Next,
|
|
|
|
MenuSelected,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class SceneType : uint8_t {
|
|
|
|
GENERIC_SCENE_ENUM_VALUES,
|
|
|
|
Read,
|
|
|
|
ReadSuccess,
|
|
|
|
ReadedMenu,
|
|
|
|
Write,
|
|
|
|
WriteSuccess,
|
|
|
|
Emulate,
|
|
|
|
SaveName,
|
2021-06-30 15:02:46 +03:00
|
|
|
SaveSuccess,
|
|
|
|
SelectKey,
|
|
|
|
SavedKeyMenu,
|
|
|
|
SaveData,
|
|
|
|
SaveType,
|
|
|
|
SavedInfo,
|
|
|
|
DeleteConfirm,
|
|
|
|
DeleteSuccess,
|
2021-06-28 17:42:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class Event {
|
|
|
|
public:
|
|
|
|
union {
|
|
|
|
int32_t menu_index;
|
|
|
|
} payload;
|
|
|
|
|
|
|
|
EventType type;
|
|
|
|
};
|
|
|
|
|
|
|
|
SceneController<GenericScene<LfRfidApp>, LfRfidApp> scene_controller;
|
|
|
|
ViewController<LfRfidApp, SubmenuVM, PopupVM, DialogExVM, TextInputVM, ByteInputVM, ContainerVM>
|
|
|
|
view_controller;
|
|
|
|
|
|
|
|
~LfRfidApp();
|
|
|
|
LfRfidApp();
|
|
|
|
|
|
|
|
RecordController<NotificationApp> notification;
|
2021-10-06 12:40:28 +03:00
|
|
|
RecordController<Storage> storage;
|
|
|
|
RecordController<DialogsApp> dialogs;
|
2021-06-28 17:42:30 +03:00
|
|
|
|
|
|
|
RfidWorker worker;
|
|
|
|
|
|
|
|
TextStore text_store;
|
2021-06-30 15:02:46 +03:00
|
|
|
|
|
|
|
void run(void* args);
|
|
|
|
|
|
|
|
static const char* app_folder;
|
|
|
|
static const char* app_extension;
|
2021-10-06 12:40:28 +03:00
|
|
|
static const char* app_filetype;
|
2021-06-30 15:02:46 +03:00
|
|
|
|
|
|
|
bool save_key(RfidKey* key);
|
|
|
|
bool load_key_from_file_select(bool need_restore);
|
|
|
|
bool delete_key(RfidKey* key);
|
|
|
|
|
|
|
|
bool load_key_data(const char* path, RfidKey* key);
|
|
|
|
bool save_key_data(const char* path, RfidKey* key);
|
|
|
|
|
|
|
|
void make_app_folder();
|
2021-06-28 17:42:30 +03:00
|
|
|
};
|