Loading...
Searching...
No Matches
mf_plus.h
1#pragma once
2
3#include <lib/nfc/protocols/iso14443_4a/iso14443_4a.h>
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define MF_PLUS_UID_SIZE_MAX (7)
10#define MF_PLUS_BATCH_SIZE (5)
11
12#define MF_PLUS_CMD_GET_VERSION (0x60)
13
14typedef enum {
15 MfPlusErrorNone,
16 MfPlusErrorUnknown,
17 MfPlusErrorNotPresent,
18 MfPlusErrorProtocol,
19 MfPlusErrorAuth,
20 MfPlusErrorPartialRead,
21 MfPlusErrorTimeout,
22} MfPlusError;
23
24typedef enum {
25 MfPlusTypePlus,
26 MfPlusTypeEV1,
27 MfPlusTypeEV2,
28 MfPlusTypeS,
29 MfPlusTypeSE,
30 MfPlusTypeX,
31
32 MfPlusTypeUnknown,
33 MfPlusTypeNum,
34} MfPlusType;
35
36typedef enum {
37 MfPlusSize1K,
38 MfPlusSize2K,
39 MfPlusSize4K,
40
41 MfPlusSizeUnknown,
42 MfPlusSizeNum,
43} MfPlusSize;
44
45typedef enum {
46 MfPlusSecurityLevel0,
47 MfPlusSecurityLevel1,
48 MfPlusSecurityLevel2,
49 MfPlusSecurityLevel3,
50
51 MfPlusSecurityLevelUnknown,
52 MfPlusSecurityLevelNum,
53} MfPlusSecurityLevel;
54
55typedef struct {
56 uint8_t hw_vendor;
57 uint8_t hw_type;
58 uint8_t hw_subtype;
59 uint8_t hw_major;
60 uint8_t hw_minor;
61 uint8_t hw_storage;
62 uint8_t hw_proto;
63
64 uint8_t sw_vendor;
65 uint8_t sw_type;
66 uint8_t sw_subtype;
67 uint8_t sw_major;
68 uint8_t sw_minor;
69 uint8_t sw_storage;
70 uint8_t sw_proto;
71
72 uint8_t uid[MF_PLUS_UID_SIZE_MAX];
73 uint8_t batch[MF_PLUS_BATCH_SIZE];
74 uint8_t prod_week;
75 uint8_t prod_year;
77
78typedef struct {
79 Iso14443_4aData* iso14443_4a_data;
80 MfPlusVersion version;
81 MfPlusType type;
82 MfPlusSize size;
83 MfPlusSecurityLevel security_level;
84 FuriString* device_name;
86
87extern const NfcDeviceBase nfc_device_mf_plus;
88
89MfPlusData* mf_plus_alloc(void);
90
91void mf_plus_free(MfPlusData* data);
92
93void mf_plus_reset(MfPlusData* data);
94
95void mf_plus_copy(MfPlusData* data, const MfPlusData* other);
96
97bool mf_plus_verify(MfPlusData* data, const FuriString* device_type);
98
99bool mf_plus_load(MfPlusData* data, FlipperFormat* ff, uint32_t version);
100
101bool mf_plus_save(const MfPlusData* data, FlipperFormat* ff);
102
103bool mf_plus_is_equal(const MfPlusData* data, const MfPlusData* other);
104
105const char* mf_plus_get_device_name(const MfPlusData* data, NfcDeviceNameType name_type);
106
107const uint8_t* mf_plus_get_uid(const MfPlusData* data, size_t* uid_len);
108
109bool mf_plus_set_uid(MfPlusData* data, const uint8_t* uid, size_t uid_len);
110
111Iso14443_4aData* mf_plus_get_base_data(const MfPlusData* data);
112
113#ifdef __cplusplus
114}
115#endif
NfcDeviceNameType
Verbosity level of the displayed NFC device name.
Definition nfc_device_base.h:14
Definition flipper_format.c:12
Definition string.c:4
Definition iso14443_4a.h:42
Definition mf_plus.h:78
Definition mf_plus.h:55
Generic NFC device interface.
Definition nfc_device_base_i.h:142