[FL-1499] NFC App: save and load from SD card (#560)
* nfc: add save name and save success scenes * applications: increase nfc app stack size to 4k * nfc: move nfc device data to separate file * nfc: add nfc device save to SD card * nfc: add file select scene * nfc: add saved key menu scene * nfc: add manual SAK, ATQA, UID enter * nfc: add manual enter * nfc scenes: remove typedef in SubmenuIndex enu * nfc_device: close file_worker after load data Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
55
applications/nfc/nfc_device.h
Normal file
55
applications/nfc/nfc_device.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define NFC_DEV_NAME_MAX_LEN 22
|
||||
#define NFC_FILE_NAME_MAX_LEN 120
|
||||
|
||||
typedef enum {
|
||||
NfcDeviceNfca,
|
||||
NfcDeviceNfcb,
|
||||
NfcDeviceNfcf,
|
||||
NfcDeviceNfcv,
|
||||
} NfcDeviceType;
|
||||
|
||||
typedef enum {
|
||||
NfcDeviceProtocolUnknown,
|
||||
NfcDeviceProtocolEMV,
|
||||
NfcDeviceProtocolMfUltralight,
|
||||
} NfcProtocol;
|
||||
|
||||
typedef struct {
|
||||
uint8_t uid_len;
|
||||
uint8_t uid[10];
|
||||
uint8_t atqa[2];
|
||||
uint8_t sak;
|
||||
NfcDeviceType device;
|
||||
NfcProtocol protocol;
|
||||
} NfcDeviceData;
|
||||
|
||||
typedef struct {
|
||||
NfcDeviceData nfc_data;
|
||||
char name[32];
|
||||
uint8_t number[8];
|
||||
} NfcEmvData;
|
||||
|
||||
typedef struct {
|
||||
NfcDeviceData nfc_data;
|
||||
uint8_t man_block[12];
|
||||
uint8_t otp[4];
|
||||
} NfcMifareUlData;
|
||||
|
||||
typedef struct {
|
||||
NfcDeviceData data;
|
||||
char dev_name[NFC_DEV_NAME_MAX_LEN];
|
||||
char file_name[NFC_FILE_NAME_MAX_LEN];
|
||||
} NfcDevice;
|
||||
|
||||
void nfc_device_set_name(NfcDevice* dev, const char* name);
|
||||
|
||||
bool nfc_device_save(NfcDevice* dev, const char* dev_name);
|
||||
|
||||
bool nfc_device_load(NfcDevice* dev, const char* dev_name);
|
||||
|
||||
bool nfc_file_select(NfcDevice* dev);
|
Reference in New Issue
Block a user