2021-05-04 13:21:16 +00:00
|
|
|
#pragma once
|
|
|
|
#include <map>
|
|
|
|
#include <list>
|
|
|
|
#include "lf-rfid-view-manager.h"
|
|
|
|
|
|
|
|
#include "scene/lf-rfid-scene-start.h"
|
|
|
|
#include "scene/lf-rfid-scene-emulate-indala.h"
|
|
|
|
#include "scene/lf-rfid-scene-emulate-hid.h"
|
|
|
|
#include "scene/lf-rfid-scene-emulate-emmarine.h"
|
|
|
|
#include "scene/lf-rfid-scene-read-normal.h"
|
|
|
|
#include "scene/lf-rfid-scene-read-indala.h"
|
|
|
|
#include "scene/lf-rfid-scene-tune.h"
|
2021-05-18 08:37:47 +00:00
|
|
|
#include "scene/lf-rfid-scene-write.h"
|
2021-05-04 13:21:16 +00:00
|
|
|
|
|
|
|
#include "helpers/rfid-reader.h"
|
|
|
|
#include "helpers/rfid-timer-emulator.h"
|
|
|
|
|
|
|
|
class LfrfidApp {
|
|
|
|
public:
|
|
|
|
void run(void);
|
|
|
|
|
|
|
|
LfrfidApp();
|
|
|
|
~LfrfidApp();
|
|
|
|
|
|
|
|
enum class Scene : uint8_t {
|
|
|
|
Exit,
|
|
|
|
Start,
|
|
|
|
ReadNormal,
|
|
|
|
ReadIndala,
|
|
|
|
EmulateIndala,
|
|
|
|
EmulateHID,
|
|
|
|
EmulateEM,
|
|
|
|
Tune,
|
2021-05-18 08:37:47 +00:00
|
|
|
Write,
|
2021-05-04 13:21:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
LfrfidAppViewManager* get_view_manager();
|
|
|
|
void switch_to_next_scene(Scene index);
|
|
|
|
void search_and_switch_to_previous_scene(std::initializer_list<Scene> scenes_list);
|
|
|
|
bool switch_to_previous_scene(uint8_t count = 1);
|
|
|
|
Scene get_previous_scene();
|
|
|
|
|
|
|
|
void notify_init();
|
|
|
|
void notify_green_blink();
|
|
|
|
void notify_green_on();
|
|
|
|
void notify_green_off();
|
|
|
|
|
|
|
|
char* get_text_store();
|
|
|
|
uint8_t get_text_store_size();
|
|
|
|
void set_text_store(const char* text...);
|
|
|
|
|
|
|
|
RfidReader* get_reader();
|
|
|
|
RfidTimerEmulator* get_emulator();
|
2021-05-18 08:37:47 +00:00
|
|
|
RfidWriter* get_writer();
|
2021-05-04 13:21:16 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::list<Scene> previous_scenes_list = {Scene::Exit};
|
|
|
|
Scene current_scene = Scene::Start;
|
|
|
|
LfrfidAppViewManager view;
|
|
|
|
|
|
|
|
std::map<Scene, LfrfidScene*> scenes = {
|
|
|
|
{Scene::Start, new LfrfidSceneStart()},
|
|
|
|
{Scene::ReadNormal, new LfrfidSceneReadNormal()},
|
|
|
|
{Scene::ReadIndala, new LfrfidSceneReadIndala()},
|
|
|
|
{Scene::EmulateIndala, new LfrfidSceneEmulateIndala()},
|
|
|
|
{Scene::EmulateHID, new LfrfidSceneEmulateHID()},
|
|
|
|
{Scene::EmulateEM, new LfrfidSceneEmulateEMMarine()},
|
|
|
|
{Scene::Tune, new LfrfidSceneTune()},
|
2021-05-18 08:37:47 +00:00
|
|
|
{Scene::Write, new LfrfidSceneWrite()},
|
2021-05-04 13:21:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const uint8_t text_store_size = 128;
|
|
|
|
char text_store[text_store_size + 1];
|
|
|
|
|
|
|
|
RfidReader reader;
|
|
|
|
RfidTimerEmulator emulator;
|
2021-05-18 08:37:47 +00:00
|
|
|
RfidWriter writer;
|
2021-05-04 13:21:16 +00:00
|
|
|
};
|