MIKAI
Library to modify content of a Mykey
Data Structures | Macros | Typedefs | Functions
reader.h File Reference
#include <stdint.h>
#include <mikai-error.h>
#include <nfc/nfc.h>

Go to the source code of this file.

Data Structures

struct  SrixBlock
 Single SRIX block. More...
 
struct  NfcReader
 Struct that represents a NFC Reader. More...
 

Macros

#define MAX_DEVICE_COUNT   8
 
#define MAX_TARGET_COUNT   1
 

Typedefs

typedef struct SrixBlock SrixBlock
 Single SRIX block. More...
 
typedef struct NfcReader NfcReader
 Struct that represents a NFC Reader. More...
 

Functions

MIKAI_EXPORT NfcReaderNfcReaderNew ()
 Allocate a nfc reader and set its default values. More...
 
MIKAI_EXPORT void NfcCloseReader (NfcReader *reader)
 Close a nfc reader. More...
 
MIKAI_EXPORT size_t NfcUpdateReaders (NfcReader *reader)
 Update available readers on NfcReader instance. More...
 
MIKAI_EXPORT char * NfcGetReaderDescription (NfcReader *reader, int selection)
 Get a description of a specific reader. More...
 
MIKAI_EXPORT MikaiError NfcInitReader (NfcReader *reader, int selection)
 Initialize an NFC Reader. More...
 
MIKAI_EXPORT MikaiError NfcGetUid (NfcReader *reader, uint8_t uid[const static SRIX_UID_LENGTH])
 Get UID from Reader as raw byte array. More...
 
MIKAI_EXPORT MikaiError NfcReadBlock (NfcReader *reader, SrixBlock *block, uint8_t blockNum)
 Read a specified block from SRIX4K to rx_data array. More...
 
MIKAI_EXPORT MikaiError NfcWriteBlock (NfcReader *reader, SrixBlock *block, uint8_t blockNum)
 Write block to SRIX4K. More...
 

Macro Definition Documentation

◆ MAX_DEVICE_COUNT

#define MAX_DEVICE_COUNT   8

Definition at line 28 of file reader.h.

◆ MAX_TARGET_COUNT

#define MAX_TARGET_COUNT   1

Definition at line 29 of file reader.h.

Typedef Documentation

◆ NfcReader

typedef struct NfcReader NfcReader

Struct that represents a NFC Reader.

◆ SrixBlock

typedef struct SrixBlock SrixBlock

Single SRIX block.

Function Documentation

◆ NfcCloseReader()

MIKAI_EXPORT void NfcCloseReader ( NfcReader reader)

Close a nfc reader.

Parameters
readerreader instance where reader is saved

◆ NfcGetReaderDescription()

MIKAI_EXPORT char* NfcGetReaderDescription ( NfcReader reader,
int  selection 
)

Get a description of a specific reader.

Parameters
readerpointer to a NfcReader instance
selectionindex of reader to get
Returns
pointer to reader description string

◆ NfcGetUid()

MIKAI_EXPORT MikaiError NfcGetUid ( NfcReader reader,
uint8_t  uid[const static SRIX_UID_LENGTH] 
)

Get UID from Reader as raw byte array.

Parameters
readerpointer to Reader struct
uidarray where save the UID data
Returns
MikaiError result

◆ NfcInitReader()

MIKAI_EXPORT MikaiError NfcInitReader ( NfcReader reader,
int  selection 
)

Initialize an NFC Reader.

Parameters
readerpointer to Reader struct
selectionid of Reader to initialize
Returns
MikaiError result

◆ NfcReadBlock()

MIKAI_EXPORT MikaiError NfcReadBlock ( NfcReader reader,
SrixBlock block,
uint8_t  blockNum 
)

Read a specified block from SRIX4K to rx_data array.

Parameters
readernfc reader to send command
blockarray to save read block
blockNumblock to read from SRIX
Returns
MikaiError result

◆ NfcReaderNew()

MIKAI_EXPORT NfcReader* NfcReaderNew ( )

Allocate a nfc reader and set its default values.

Returns
null if there is an error, else an nfc reader pointer

Definition at line 113 of file reader.c.

◆ NfcUpdateReaders()

MIKAI_EXPORT size_t NfcUpdateReaders ( NfcReader reader)

Update available readers on NfcReader instance.

Parameters
readerpointer to NfcReader
Returns
number of readers currently available and saved on instance

◆ NfcWriteBlock()

MIKAI_EXPORT MikaiError NfcWriteBlock ( NfcReader reader,
SrixBlock block,
uint8_t  blockNum 
)

Write block to SRIX4K.

Parameters
readernfc reader to send command
blockarray of data to write to block
blockNumblock to write to SRIX
Returns
MikaiError result