[FL-1448], [FL-1529] Introducing Scene Manager, NFC App refactoring and bug fixes (#575)
* gui: refactore ViewNavigator -> SceneManager * view_dispatcher: remove scene controller, add custom and navigation cb * scene_manager: rework scene controller, move AppScene from lib * nfc: rework nfc scenes with new scene controller API * view_dispatcher: crash on free if not all views were freed * nfc: introduce scene declaration * scene_manager: allocate and configure application scenes * nfc: rework nfc with new Scene Manager API * scene_manager: remove dublicated scene handlers allocation * nfc: rework nfc app with new scene manager API * view_dispatcher: add tick event * scene_manager: add tick event type and handler * nfc: rework notifications with tick event * scene_manager: remove scene id from scene structure * scene_manager: rename array -> stack, add documentation * api-hal-nfc: remove listen activation processing * nfc_scene_start: shorter submenu call * nfc: fix nfc file name * nfc: fix Retry in mifare ul success read * nfc_cli: fix read timeout in nfc_detect CLI command Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include <cli/cli.h>
|
||||
#include <notification/notification-messages.h>
|
||||
|
||||
@@ -20,43 +21,20 @@
|
||||
#include <gui/modules/byte_input.h>
|
||||
#include <gui/modules/text_box.h>
|
||||
|
||||
#include <nfc/scenes/nfc_scene.h>
|
||||
|
||||
#include "views/nfc_detect.h"
|
||||
#include "views/nfc_emulate.h"
|
||||
#include "views/nfc_emv.h"
|
||||
#include "views/nfc_mifare_ul.h"
|
||||
|
||||
#include "scenes/nfc_scene_start.h"
|
||||
#include "scenes/nfc_scene_read_card.h"
|
||||
#include "scenes/nfc_scene_read_card_success.h"
|
||||
#include "scenes/nfc_scene_card_menu.h"
|
||||
#include "scenes/nfc_scene_emulate_uid.h"
|
||||
#include "scenes/nfc_scene_not_implemented.h"
|
||||
#include "scenes/nfc_scene_save_name.h"
|
||||
#include "scenes/nfc_scene_save_success.h"
|
||||
#include "scenes/nfc_scene_file_select.h"
|
||||
#include "scenes/nfc_scene_saved_menu.h"
|
||||
#include "scenes/nfc_scene_set_type.h"
|
||||
#include "scenes/nfc_scene_set_sak.h"
|
||||
#include "scenes/nfc_scene_set_atqa.h"
|
||||
#include "scenes/nfc_scene_set_uid.h"
|
||||
#include "scenes/nfc_scene_scripts_menu.h"
|
||||
#include "scenes/nfc_scene_read_mifare_ul.h"
|
||||
#include "scenes/nfc_scene_read_mifare_ul_success.h"
|
||||
#include "scenes/nfc_scene_mifare_ul_menu.h"
|
||||
|
||||
// TODO delete debug scenes
|
||||
#include "scenes/nfc_scene_debug_menu.h"
|
||||
#include "scenes/nfc_scene_debug_detect.h"
|
||||
#include "scenes/nfc_scene_debug_emulate.h"
|
||||
#include "scenes/nfc_scene_debug_read_emv.h"
|
||||
#include "scenes/nfc_scene_debug_read_mifare_ul.h"
|
||||
|
||||
#define NFC_TEXT_STORE_SIZE 128
|
||||
|
||||
struct Nfc {
|
||||
NfcCommon nfc_common;
|
||||
Gui* gui;
|
||||
NotificationApp* notifications;
|
||||
SceneManager* scene_manager;
|
||||
NfcDevice device;
|
||||
|
||||
char text_store[NFC_TEXT_STORE_SIZE + 1];
|
||||
@@ -75,33 +53,6 @@ struct Nfc {
|
||||
TextInput* text_input;
|
||||
ByteInput* byte_input;
|
||||
TextBox* text_box;
|
||||
|
||||
// Scenes
|
||||
AppScene* scene_start;
|
||||
AppScene* scene_read_card;
|
||||
AppScene* scene_read_card_success;
|
||||
AppScene* scene_card_menu;
|
||||
AppScene* scene_not_implemented;
|
||||
AppScene* scene_emulate_uid;
|
||||
AppScene* scene_save_name;
|
||||
AppScene* scene_save_success;
|
||||
AppScene* scene_file_select;
|
||||
AppScene* scene_saved_menu;
|
||||
AppScene* scene_set_type;
|
||||
AppScene* scene_set_sak;
|
||||
AppScene* scene_set_atqa;
|
||||
AppScene* scene_set_uid;
|
||||
AppScene* scene_scripts_menu;
|
||||
AppScene* scene_read_mifare_ul;
|
||||
AppScene* scene_read_mifare_ul_success;
|
||||
AppScene* scene_mifare_ul_menu;
|
||||
|
||||
// TODO delete debug scenes
|
||||
AppScene* scene_debug_menu;
|
||||
AppScene* scene_debug_detect;
|
||||
AppScene* scene_debug_emulate;
|
||||
AppScene* scene_debug_read_emv;
|
||||
AppScene* scene_debug_read_mifare_ul;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@@ -117,34 +68,10 @@ typedef enum {
|
||||
NfcViewMifareUl,
|
||||
} NfcView;
|
||||
|
||||
typedef enum {
|
||||
NfcSceneStart,
|
||||
NfcSceneReadCard,
|
||||
NfcSceneReadCardSuccess,
|
||||
NfcSceneCardMenu,
|
||||
NfcSceneEmulateUID,
|
||||
NfcSceneNotImplemented,
|
||||
NfcSceneDebugMenu,
|
||||
NfcSceneDebugDetect,
|
||||
NfcSceneDebugEmulate,
|
||||
NfcSceneDebugReadEmv,
|
||||
NfcSceneDebugReadMifareUl,
|
||||
NfcSceneSaveName,
|
||||
NfcSceneSaveSuccess,
|
||||
NfcSceneFileSelect,
|
||||
NfcSceneSavedMenu,
|
||||
NfcSceneSetType,
|
||||
NfcSceneSetSak,
|
||||
NfcSceneSetAtqa,
|
||||
NfcSceneSetUid,
|
||||
NfcSceneScriptsMenu,
|
||||
NfcSceneReadMifareUl,
|
||||
NfcSceneReadMifareUlSuccess,
|
||||
NfcSceneReadMifareUlMenu,
|
||||
} NfcScene;
|
||||
|
||||
Nfc* nfc_alloc();
|
||||
|
||||
int32_t nfc_task(void* p);
|
||||
|
||||
void nfc_set_text_store(Nfc* nfc, const char* text, ...);
|
||||
void nfc_text_store_set(Nfc* nfc, const char* text, ...);
|
||||
|
||||
void nfc_text_store_clear(Nfc* nfc);
|
||||
|
Reference in New Issue
Block a user