12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- /*
- * Module_RFID.h
- *
- * Created on: 2019¦~10¤ë24¤é
- * Author: Eason Yang
- */
- #ifndef LIB_RFID_H_
- #define LIB_RFID_H_
- #include <sys/time.h>
- #include <sys/timeb.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <sys/socket.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <sys/shm.h>
- #include <sys/mman.h>
- #include <linux/wireless.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <stdio.h> /* Standard input/output definitions */
- #include <stdlib.h>
- #include <unistd.h> /* UNIX standard function definitions */
- #include <fcntl.h> /* File control definitions */
- #include <termios.h> /* POSIX terminal control definitions */
- #include <errno.h> /* Error number definitions */
- #include <string.h> /* String function definitions */
- #include <time.h>
- #include <ctype.h>
- #include <ifaddrs.h>
- #include <stdbool.h>
- typedef struct Rfid
- {
- uint8_t snType; // 4 bytes or 6 bytes or 7 bytes or 10 bytes
- uint8_t cardType; // 0: NONE 1: ISO14443A 2: ISO14443B 4: FELICA
- uint8_t currentCard[32]; // Current charging cycle start card number
- uint8_t targetBlock; // RFID read/write target block
- uint8_t keyType; // 0: Key-A 1: Key-B
- uint8_t data_Block[32]; // RFID operation block data
- }RFID;
- //==================================
- // Card Length
- //==================================
- #define RFID_SN_TYPE_4BYTE 4
- #define RFID_SN_TYPE_6BYTE 6
- #define RFID_SN_TYPE_7BYTE 7
- #define RFID_SN_TYPE_10BYTE 10
- //==================================
- // Card Type
- //==================================
- #define NONE 0
- #define ISO14443A 1
- #define IS014443B 2
- #define FELICA 3
- char ClaCheckSum(unsigned char *buffer, int len);
- int system_command(int uart, unsigned char* cmd,int length, unsigned char* rx);
- bool getRequestCardSN(int Fd, int moduleType,RFID *rfid);
- bool ISO14443A_REQUEST_SN(int Fd, int moduleType, unsigned char *serialNumber);
- bool ISO14443B_REQUEST_SN(int Fd, int moduleType, unsigned char *serialNumber);
- bool FELICA_REQUEST_SN(int Fd, int moduleType, unsigned char *serialNumber);
- bool getBlockRead(int Fd, int moduleType,int block, unsigned char keyid, unsigned char *data);
- bool setBlockWrite(int Fd, int moduleType,int block, unsigned char keyid, unsigned char *data);
- void setBuzzer(int Fd, int moduleType, unsigned char time);
- void sethaltCard(int Fd, int moduleType);
- #endif
|