Loading...
Searching...
No Matches
nfc_device_base_i.h File Reference

Abstract interface definitions for the NFC device system. More...

#include "nfc_device_base.h"
#include <flipper_format.h>

Go to the source code of this file.

Data Structures

struct  NfcDeviceBase
 Generic NFC device interface. More...
 

Typedefs

typedef NfcDeviceData *(* NfcDeviceAlloc) (void)
 Allocate the protocol-specific NFC device data instance.
 
typedef void(* NfcDeviceFree) (NfcDeviceData *data)
 Delete the protocol-specific NFC device data instance.
 
typedef void(* NfcDeviceReset) (NfcDeviceData *data)
 Reset the NFC device data instance.
 
typedef void(* NfcDeviceCopy) (NfcDeviceData *data, const NfcDeviceData *other)
 Copy source instance's data into the destination so that they become equal.
 
typedef bool(* NfcDeviceVerify) (NfcDeviceData *data, const FuriString *device_type)
 Deprecated.
 
typedef bool(* NfcDeviceLoad) (NfcDeviceData *data, FlipperFormat *ff, uint32_t version)
 Load NFC device data from a FlipperFormat file.
 
typedef bool(* NfcDeviceSave) (const NfcDeviceData *data, FlipperFormat *ff)
 Save NFC device data to a FlipperFormat file.
 
typedef bool(* NfcDeviceEqual) (const NfcDeviceData *data, const NfcDeviceData *other)
 Compare two NFC device data instances.
 
typedef const char *(* NfcDeviceGetName) (const NfcDeviceData *data, NfcDeviceNameType name_type)
 Get a protocol-specific stateful NFC device name.
 
typedef const uint8_t *(* NfcDeviceGetUid) (const NfcDeviceData *data, size_t *uid_len)
 Get the NFC device's unique identifier (UID).
 
typedef bool(* NfcDeviceSetUid) (NfcDeviceData *data, const uint8_t *uid, size_t uid_len)
 Set the NFC device's unique identifier (UID).
 
typedef NfcDeviceData *(* NfcDeviceGetBaseData) (const NfcDeviceData *data)
 Get the NFC device data associated with the parent protocol.
 

Detailed Description

Abstract interface definitions for the NFC device system.

This file is an implementation detail. It must not be included in any public API-related headers.

Typedef Documentation

◆ NfcDeviceAlloc

typedef NfcDeviceData *(* NfcDeviceAlloc) (void)

Allocate the protocol-specific NFC device data instance.

Returns
pointer to the allocated instance.

◆ NfcDeviceCopy

typedef void(* NfcDeviceCopy) (NfcDeviceData *data, const NfcDeviceData *other)

Copy source instance's data into the destination so that they become equal.

Parameters
[in,out]datapointer to the destination instance.
[in]otherpointer to the source instance.

◆ NfcDeviceEqual

typedef bool(* NfcDeviceEqual) (const NfcDeviceData *data, const NfcDeviceData *other)

Compare two NFC device data instances.

Parameters
[in]datapointer to the first instance to be compared.
[in]otherpointer to the second instance to be compared.
Returns
true if instances are equal, false otherwise.

◆ NfcDeviceFree

typedef void(* NfcDeviceFree) (NfcDeviceData *data)

Delete the protocol-specific NFC device data instance.

Parameters
[in,out]datapointer to the instance to be deleted.

◆ NfcDeviceGetBaseData

typedef NfcDeviceData *(* NfcDeviceGetBaseData) (const NfcDeviceData *data)

Get the NFC device data associated with the parent protocol.

The protocol the instance's data is associated with must have a parent.

Parameters
[in]datapointer to the instance to be queried.
Returns
pointer to the data instance associated with the parent protocol.

◆ NfcDeviceGetName

typedef const char *(* NfcDeviceGetName) (const NfcDeviceData *data, NfcDeviceNameType name_type)

Get a protocol-specific stateful NFC device name.

The return value may change depending on the instance's internal state and the name_type parameter.

Parameters
[in]datapointer to the instance to be queried.
[in]name_typetype of the name to be displayed.
Returns
pointer to a statically allocated character string containing the appropriate name.

◆ NfcDeviceGetUid

typedef const uint8_t *(* NfcDeviceGetUid) (const NfcDeviceData *data, size_t *uid_len)

Get the NFC device's unique identifier (UID).

The UID length is protocol-dependent. Additionally, a particular protocol might support several UID lengths.

Parameters
[in]datapointer to the instance to be queried.
[out]uid_lenpointer to the variable to contain the UID length.
Returns
pointer to the byte array containing the device's UID.

◆ NfcDeviceLoad

typedef bool(* NfcDeviceLoad) (NfcDeviceData *data, FlipperFormat *ff, uint32_t version)

Load NFC device data from a FlipperFormat file.

The FlipperFormat file structure must be initialised and open by the calling code.

Parameters
[in,out]datapointer to the instance to be loaded into.
[in]ffpointer to the FlipperFormat file instance.
[in]versionfile format version to use when loading.
Returns
true if loaded successfully, false otherwise.

◆ NfcDeviceReset

typedef void(* NfcDeviceReset) (NfcDeviceData *data)

Reset the NFC device data instance.

The behaviour is protocol-specific. Usually, required fields are zeroed or set to their initial values.

Parameters
[in,out]datapointer to the instance to be reset.

◆ NfcDeviceSave

typedef bool(* NfcDeviceSave) (const NfcDeviceData *data, FlipperFormat *ff)

Save NFC device data to a FlipperFormat file.

The FlipperFormat file structure must be initialised and open by the calling code.

Parameters
[in]datapointer to the instance to be saved.
[in]ffpointer to the FlipperFormat file instance.
Returns
true if saved successfully, false otherwise.

◆ NfcDeviceSetUid

typedef bool(* NfcDeviceSetUid) (NfcDeviceData *data, const uint8_t *uid, size_t uid_len)

Set the NFC device's unique identifier (UID).

The UID length must be supported by the protocol in question.

Parameters
[in,out]datapointer to the instance to be modified.
[in]uidpointer to the byte array containing the new UID.
[in]uid_lenlength of the UID.
Returns
true if the UID was valid and set, false otherwise.

◆ NfcDeviceVerify

typedef bool(* NfcDeviceVerify) (NfcDeviceData *data, const FuriString *device_type)

Deprecated.

Do not use in new protocols.

Deprecated
do not use in new protocols.
Parameters
[in,out]datapointer to the instance to be tested.
[in]device_typepointer to a FuriString containing a device type identifier.
Returns
true if data was verified, false otherwise.