Loading...
Searching...
No Matches
type_4_tag.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 TYPE_4_TAG_MF_DESFIRE_NDEF_SIZE (2048U - sizeof(uint16_t))
10
11typedef enum {
12 Type4TagErrorNone,
13 Type4TagErrorNotPresent,
14 Type4TagErrorProtocol,
15 Type4TagErrorTimeout,
16 Type4TagErrorWrongFormat,
17 Type4TagErrorNotSupported,
18 Type4TagErrorApduFailed,
19 Type4TagErrorCardUnformatted,
20 Type4TagErrorCardLocked,
21 Type4TagErrorCustomCommand,
22} Type4TagError;
23
24typedef enum {
25 Type4TagPlatformUnknown,
26 Type4TagPlatformNtag4xx,
27 Type4TagPlatformMfDesfire,
28} Type4TagPlatform;
29
30typedef struct {
31 Iso14443_4aData* iso14443_4a_data;
32 FuriString* device_name;
33 // Tag specific data
34 bool is_tag_specific;
35 Type4TagPlatform platform;
36 FuriString* platform_name;
37 union {
38 struct {
39 uint8_t minor : 4;
40 uint8_t major : 4;
41 };
42 uint8_t value;
43 } t4t_version;
44 uint16_t chunk_max_read;
45 uint16_t chunk_max_write;
46 uint16_t ndef_file_id;
47 uint16_t ndef_max_len;
48 uint8_t ndef_read_lock;
49 uint8_t ndef_write_lock;
50 // Data contained, not tag specific
51 SimpleArray* ndef_data;
53
54extern const NfcDeviceBase nfc_device_type_4_tag;
55
56// Virtual methods
57
58Type4TagData* type_4_tag_alloc(void);
59
60void type_4_tag_free(Type4TagData* data);
61
62void type_4_tag_reset(Type4TagData* data);
63
64void type_4_tag_copy(Type4TagData* data, const Type4TagData* other);
65
66bool type_4_tag_verify(Type4TagData* data, const FuriString* device_type);
67
68bool type_4_tag_load(Type4TagData* data, FlipperFormat* ff, uint32_t version);
69
70bool type_4_tag_save(const Type4TagData* data, FlipperFormat* ff);
71
72bool type_4_tag_is_equal(const Type4TagData* data, const Type4TagData* other);
73
74const char* type_4_tag_get_device_name(const Type4TagData* data, NfcDeviceNameType name_type);
75
76const uint8_t* type_4_tag_get_uid(const Type4TagData* data, size_t* uid_len);
77
78bool type_4_tag_set_uid(Type4TagData* data, const uint8_t* uid, size_t uid_len);
79
80Iso14443_4aData* type_4_tag_get_base_data(const Type4TagData* data);
81
82#ifdef __cplusplus
83}
84#endif
NfcDeviceNameType
Verbosity level of the displayed NFC device name.
Definition nfc_device_base.h:14
Definition flipper_format.c:17
Definition string.c:4
Definition iso14443_4a.h:42
Generic NFC device interface.
Definition nfc_device_base_i.h:142
Definition simple_array.c:5
Definition type_4_tag.h:30