MIKAI
Library to modify content of a Mykey
reader.h
Go to the documentation of this file.
1 /*
2  * @author Lilz <https://telegram.me/Lilz73>
3  * @copyright 2020-2021 Lilz <https://telegram.me/Lilz73>
4  * @license MIKAI LICENSE
5  *
6  * This file is part of MIKAI.
7  *
8  * MIKAI is free software: you can redistribute it and/or modify
9  * it under the terms of the MIKAI License, as published by
10  * Lilz along with this program and available on "MIKAI Download" Telegram channel
11  * <https://telegram.me/mikaidownload>.
12  *
13  * MIKAI is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY.
15  *
16  * You should have received a copy of the MIKAI License along
17  * with MIKAI.
18  * If not, see <https://telegram.me/mikaidownload>.
19  */
20 
21 #ifndef MIKAI_READER_H
22 #define MIKAI_READER_H
23 
24 #include <stdint.h>
25 #include <mikai-error.h>
26 #include <nfc/nfc.h>
27 
28 #define MAX_DEVICE_COUNT 8
29 #define MAX_TARGET_COUNT 1
30 
34 typedef struct SrixBlock {
36 } SrixBlock;
37 
41 typedef struct NfcReader {
42  nfc_connstring libnfc_readers[MAX_DEVICE_COUNT]; /* readers connstring array */
43  nfc_device *libnfc_reader; /* libnfc reader */
44 } NfcReader;
45 
51 
57 
64 
71 MIKAI_EXPORT char *NfcGetReaderDescription(NfcReader *reader, int selection);
72 
79 MIKAI_EXPORT MikaiError NfcInitReader(NfcReader *reader, int selection);
80 
87 MIKAI_EXPORT MikaiError NfcGetUid(NfcReader *reader, uint8_t uid[const static SRIX_UID_LENGTH]);
88 
96 MIKAI_EXPORT MikaiError NfcReadBlock(NfcReader *reader, SrixBlock *block, uint8_t blockNum);
97 
105 MIKAI_EXPORT MikaiError NfcWriteBlock(NfcReader *reader, SrixBlock *block, uint8_t blockNum);
106 
107 #endif /* MIKAI_READER_H */
SrixBlock
Single SRIX block.
Definition: reader.h:34
NfcWriteBlock
MIKAI_EXPORT MikaiError NfcWriteBlock(NfcReader *reader, SrixBlock *block, uint8_t blockNum)
Write block to SRIX4K.
mikai-error.h
NfcCloseReader
MIKAI_EXPORT void NfcCloseReader(NfcReader *reader)
Close a nfc reader.
NfcReadBlock
MIKAI_EXPORT MikaiError NfcReadBlock(NfcReader *reader, SrixBlock *block, uint8_t blockNum)
Read a specified block from SRIX4K to rx_data array.
MIKAI_EXPORT
#define MIKAI_EXPORT
Definition: mikai-reader.h:35
NfcGetReaderDescription
MIKAI_EXPORT char * NfcGetReaderDescription(NfcReader *reader, int selection)
Get a description of a specific reader.
NfcInitReader
MIKAI_EXPORT MikaiError NfcInitReader(NfcReader *reader, int selection)
Initialize an NFC Reader.
MikaiError
Error structure that contains a description message.
Definition: mikai-error.h:40
SrixBlock
struct SrixBlock SrixBlock
Single SRIX block.
NfcReader
Struct that represents a NFC Reader.
Definition: reader.h:41
SRIX_UID_LENGTH
#define SRIX_UID_LENGTH
Definition: mikai.h:29
NfcReader::libnfc_reader
nfc_device * libnfc_reader
Definition: reader.h:43
SRIX_BLOCK_LENGTH
#define SRIX_BLOCK_LENGTH
Definition: mikai.h:28
MAX_DEVICE_COUNT
#define MAX_DEVICE_COUNT
Definition: reader.h:28
NfcGetUid
MIKAI_EXPORT MikaiError NfcGetUid(NfcReader *reader, uint8_t uid[const static SRIX_UID_LENGTH])
Get UID from Reader as raw byte array.
SrixBlock::block
uint8_t block[SRIX_BLOCK_LENGTH]
Definition: reader.h:35
NfcUpdateReaders
MIKAI_EXPORT size_t NfcUpdateReaders(NfcReader *reader)
Update available readers on NfcReader instance.
NfcReader
struct NfcReader NfcReader
Struct that represents a NFC Reader.
NfcReader::libnfc_readers
nfc_connstring libnfc_readers[8]
Definition: reader.h:42
NfcReaderNew
MIKAI_EXPORT NfcReader * NfcReaderNew()
Allocate a nfc reader and set its default values.
Definition: reader.c:113