unleashed-firmware/lib/nfc/protocols/iso14443_4a/iso14443_4a.h
gornekich d92b0a82cc
NFC refactoring (#3050)
"A long time ago in a galaxy far, far away...." we started NFC subsystem refactoring.

Starring:

- @gornekich - NFC refactoring project lead, architect, senior developer
- @gsurkov - architect, senior developer
- @RebornedBrain - senior developer

Supporting roles:

- @skotopes, @DrZlo13, @hedger - general architecture advisors, code review
- @Astrrra, @doomwastaken, @Hellitron, @ImagineVagon333 - quality assurance

Special thanks:

@bettse, @pcunning, @nxv, @noproto, @AloneLiberty and everyone else who has been helping us all this time and contributing valuable knowledges, ideas and source code.
2023-10-24 12:08:09 +09:00

74 lines
2.1 KiB
C

#pragma once
#include <nfc/protocols/iso14443_3a/iso14443_3a.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
Iso14443_4aErrorNone,
Iso14443_4aErrorNotPresent,
Iso14443_4aErrorProtocol,
Iso14443_4aErrorTimeout,
} Iso14443_4aError;
typedef enum {
Iso14443_4aBitRateBoth106Kbit,
Iso14443_4aBitRatePiccToPcd212Kbit,
Iso14443_4aBitRatePiccToPcd424Kbit,
Iso14443_4aBitRatePiccToPcd848Kbit,
Iso14443_4aBitRatePcdToPicc212Kbit,
Iso14443_4aBitRatePcdToPicc424Kbit,
Iso14443_4aBitRatePcdToPicc848Kbit,
} Iso14443_4aBitRate;
typedef enum {
Iso14443_4aFrameOptionNad,
Iso14443_4aFrameOptionCid,
} Iso14443_4aFrameOption;
typedef struct Iso14443_4aData Iso14443_4aData;
// Virtual methods
Iso14443_4aData* iso14443_4a_alloc();
void iso14443_4a_free(Iso14443_4aData* data);
void iso14443_4a_reset(Iso14443_4aData* data);
void iso14443_4a_copy(Iso14443_4aData* data, const Iso14443_4aData* other);
bool iso14443_4a_verify(Iso14443_4aData* data, const FuriString* device_type);
bool iso14443_4a_load(Iso14443_4aData* data, FlipperFormat* ff, uint32_t version);
bool iso14443_4a_save(const Iso14443_4aData* data, FlipperFormat* ff);
bool iso14443_4a_is_equal(const Iso14443_4aData* data, const Iso14443_4aData* other);
const char* iso14443_4a_get_device_name(const Iso14443_4aData* data, NfcDeviceNameType name_type);
const uint8_t* iso14443_4a_get_uid(const Iso14443_4aData* data, size_t* uid_len);
bool iso14443_4a_set_uid(Iso14443_4aData* data, const uint8_t* uid, size_t uid_len);
Iso14443_3aData* iso14443_4a_get_base_data(const Iso14443_4aData* data);
// Getters & Tests
uint16_t iso14443_4a_get_frame_size_max(const Iso14443_4aData* data);
uint32_t iso14443_4a_get_fwt_fc_max(const Iso14443_4aData* data);
const uint8_t* iso14443_4a_get_historical_bytes(const Iso14443_4aData* data, uint32_t* count);
bool iso14443_4a_supports_bit_rate(const Iso14443_4aData* data, Iso14443_4aBitRate bit_rate);
bool iso14443_4a_supports_frame_option(const Iso14443_4aData* data, Iso14443_4aFrameOption option);
#ifdef __cplusplus
}
#endif