2022-11-04 07:01:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "nfc_magic.h"
|
|
|
|
#include "nfc_magic_worker.h"
|
|
|
|
|
2023-05-25 17:01:02 +00:00
|
|
|
#include "lib/magic/common.h"
|
|
|
|
#include "lib/magic/types.h"
|
|
|
|
#include "lib/magic/classic_gen1.h"
|
|
|
|
#include "lib/magic/gen4.h"
|
2022-11-04 07:01:44 +00:00
|
|
|
|
|
|
|
#include <furi.h>
|
|
|
|
#include <gui/gui.h>
|
|
|
|
#include <gui/view_dispatcher.h>
|
|
|
|
#include <gui/scene_manager.h>
|
|
|
|
#include <notification/notification_messages.h>
|
|
|
|
|
|
|
|
#include <gui/modules/submenu.h>
|
|
|
|
#include <gui/modules/popup.h>
|
|
|
|
#include <gui/modules/loading.h>
|
|
|
|
#include <gui/modules/text_input.h>
|
2023-05-25 17:01:02 +00:00
|
|
|
#include <gui/modules/byte_input.h>
|
2022-11-04 07:01:44 +00:00
|
|
|
#include <gui/modules/widget.h>
|
|
|
|
|
|
|
|
#include <input/input.h>
|
|
|
|
|
|
|
|
#include "scenes/nfc_magic_scene.h"
|
|
|
|
|
|
|
|
#include <storage/storage.h>
|
|
|
|
#include <lib/toolbox/path.h>
|
|
|
|
|
|
|
|
#include <lib/nfc/nfc_device.h>
|
|
|
|
#include "nfc_magic_icons.h"
|
|
|
|
|
2022-12-19 19:57:48 +00:00
|
|
|
#define NFC_APP_FOLDER ANY_PATH("nfc")
|
|
|
|
|
2022-11-04 07:01:44 +00:00
|
|
|
enum NfcMagicCustomEvent {
|
|
|
|
// Reserve first 100 events for button types and indexes, starting from 0
|
|
|
|
NfcMagicCustomEventReserved = 100,
|
|
|
|
|
|
|
|
NfcMagicCustomEventViewExit,
|
|
|
|
NfcMagicCustomEventWorkerExit,
|
|
|
|
NfcMagicCustomEventByteInputDone,
|
|
|
|
NfcMagicCustomEventTextInputDone,
|
|
|
|
};
|
|
|
|
|
2023-05-25 17:01:02 +00:00
|
|
|
struct NfcMagicDevice {
|
|
|
|
MagicType type;
|
|
|
|
uint32_t cuid;
|
2023-06-28 16:35:25 +00:00
|
|
|
uint8_t uid_len;
|
2023-05-25 17:01:02 +00:00
|
|
|
uint32_t password;
|
|
|
|
};
|
|
|
|
|
2022-11-04 07:01:44 +00:00
|
|
|
struct NfcMagic {
|
|
|
|
NfcMagicWorker* worker;
|
|
|
|
ViewDispatcher* view_dispatcher;
|
|
|
|
Gui* gui;
|
|
|
|
NotificationApp* notifications;
|
|
|
|
SceneManager* scene_manager;
|
2023-05-25 17:01:02 +00:00
|
|
|
struct NfcMagicDevice* dev;
|
|
|
|
NfcDevice* source_dev;
|
|
|
|
|
|
|
|
uint32_t new_password;
|
2022-11-04 07:01:44 +00:00
|
|
|
|
|
|
|
FuriString* text_box_store;
|
|
|
|
|
|
|
|
// Common Views
|
|
|
|
Submenu* submenu;
|
|
|
|
Popup* popup;
|
|
|
|
Loading* loading;
|
|
|
|
TextInput* text_input;
|
2023-05-25 17:01:02 +00:00
|
|
|
ByteInput* byte_input;
|
2022-11-04 07:01:44 +00:00
|
|
|
Widget* widget;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
NfcMagicViewMenu,
|
|
|
|
NfcMagicViewPopup,
|
|
|
|
NfcMagicViewLoading,
|
|
|
|
NfcMagicViewTextInput,
|
2023-05-25 17:01:02 +00:00
|
|
|
NfcMagicViewByteInput,
|
2022-11-04 07:01:44 +00:00
|
|
|
NfcMagicViewWidget,
|
|
|
|
} NfcMagicView;
|
|
|
|
|
|
|
|
NfcMagic* nfc_magic_alloc();
|
|
|
|
|
|
|
|
void nfc_magic_text_store_set(NfcMagic* nfc_magic, const char* text, ...);
|
|
|
|
|
|
|
|
void nfc_magic_text_store_clear(NfcMagic* nfc_magic);
|
|
|
|
|
|
|
|
void nfc_magic_blink_start(NfcMagic* nfc_magic);
|
|
|
|
|
|
|
|
void nfc_magic_blink_stop(NfcMagic* nfc_magic);
|
|
|
|
|
|
|
|
void nfc_magic_show_loading_popup(void* context, bool show);
|