2021-06-28 14:42:30 +00:00
|
|
|
#pragma once
|
2022-05-27 11:19:21 +00:00
|
|
|
#include "m-string.h"
|
2021-06-28 14:42:30 +00:00
|
|
|
#include <furi.h>
|
2022-01-05 16:10:18 +00:00
|
|
|
#include <furi_hal.h>
|
|
|
|
|
|
|
|
#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 09:40:28 +00:00
|
|
|
#include <storage/storage.h>
|
|
|
|
#include <dialogs/dialogs.h>
|
2021-06-28 14:42:30 +00:00
|
|
|
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "helpers/rfid_worker.h"
|
2022-07-04 13:09:46 +00:00
|
|
|
#include "rpc/rpc_app.h"
|
2021-06-28 14:42:30 +00:00
|
|
|
|
|
|
|
class LfRfidApp {
|
|
|
|
public:
|
|
|
|
enum class EventType : uint8_t {
|
|
|
|
GENERIC_EVENT_ENUM_VALUES,
|
|
|
|
Next,
|
|
|
|
MenuSelected,
|
2022-04-14 12:03:47 +00:00
|
|
|
Stay,
|
|
|
|
Retry,
|
2022-07-04 13:09:46 +00:00
|
|
|
Exit,
|
|
|
|
EmulateStart,
|
2021-06-28 14:42:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class SceneType : uint8_t {
|
|
|
|
GENERIC_SCENE_ENUM_VALUES,
|
|
|
|
Read,
|
|
|
|
ReadSuccess,
|
2022-04-14 12:03:47 +00:00
|
|
|
RetryConfirm,
|
|
|
|
ExitConfirm,
|
|
|
|
ReadKeyMenu,
|
2021-06-28 14:42:30 +00:00
|
|
|
Write,
|
|
|
|
WriteSuccess,
|
|
|
|
Emulate,
|
|
|
|
SaveName,
|
2021-06-30 12:02:46 +00:00
|
|
|
SaveSuccess,
|
|
|
|
SelectKey,
|
|
|
|
SavedKeyMenu,
|
|
|
|
SaveData,
|
|
|
|
SaveType,
|
|
|
|
SavedInfo,
|
|
|
|
DeleteConfirm,
|
|
|
|
DeleteSuccess,
|
2022-07-04 13:09:46 +00:00
|
|
|
Rpc,
|
2021-06-28 14:42:30 +00: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 09:40:28 +00:00
|
|
|
RecordController<Storage> storage;
|
|
|
|
RecordController<DialogsApp> dialogs;
|
2021-06-28 14:42:30 +00:00
|
|
|
|
|
|
|
RfidWorker worker;
|
|
|
|
|
|
|
|
TextStore text_store;
|
2021-06-30 12:02:46 +00:00
|
|
|
|
2022-05-27 11:19:21 +00:00
|
|
|
string_t file_path;
|
|
|
|
|
2022-07-04 13:09:46 +00:00
|
|
|
RpcAppSystem* rpc_ctx;
|
|
|
|
|
2021-06-30 12:02:46 +00:00
|
|
|
void run(void* args);
|
|
|
|
|
|
|
|
static const char* app_folder;
|
|
|
|
static const char* app_extension;
|
2021-10-06 09:40:28 +00:00
|
|
|
static const char* app_filetype;
|
2021-06-30 12:02:46 +00:00
|
|
|
|
|
|
|
bool save_key(RfidKey* key);
|
|
|
|
bool load_key_from_file_select(bool need_restore);
|
|
|
|
bool delete_key(RfidKey* key);
|
|
|
|
|
2022-07-04 13:09:46 +00:00
|
|
|
bool load_key_data(string_t path, RfidKey* key, bool show_dialog);
|
2022-05-27 11:19:21 +00:00
|
|
|
bool save_key_data(string_t path, RfidKey* key);
|
2021-06-30 12:02:46 +00:00
|
|
|
|
|
|
|
void make_app_folder();
|
2022-07-04 13:09:46 +00:00
|
|
|
//bool rpc_command_callback(RpcAppSystemEvent event, const char* arg, void* context);
|
2022-01-05 16:10:18 +00:00
|
|
|
};
|