#ifndef _ACR120_H
#define _ACR120_H
#include <termios.h>
#define ACR120_SUCCESS 0
#define ACR120_ERROR -1
#define ACR120_REGISTER_STATIONID 0x4
#define ACR120_REGISTER_PROTOCOL 0x5
#define ACR120_REGISTER_BAUDRATE 0x6
#define ACR120_REGISTER_LED 0x7
#define ACR120_REGISTER_BUZZER 0x8
typedef enum {
MIFARE_KEY_AA =0,
MIFARE_KEY_BB,
MIFARE_KEY_FF
} mifare_key;
struct acr120_conn {
int fd;
int error;
unsigned char proto_mode;
};
extern int acr120_errno;
const char* acr120_strerror(void);
int acr120_open(const char *dev, unsigned char sid, speed_t speed);
int acr120_close(int fd);
int acr120_reset(int fd, unsigned char sid, int reply, int timeout);
int acr120_get_id(int fd, unsigned char *id, int timeout);
int acr120_select(int fd, unsigned char sid, unsigned int *uid, int timeout);
int acr120_login(int fd, unsigned char sid, unsigned char sector,
mifare_key type, unsigned char *key, int timeout);
int acr120_write_block(int fd, unsigned char sid, unsigned char block,
unsigned char *data, int timeout);
int acr120_write_value(int fd, unsigned char sid, unsigned char block,
unsigned int value, int timeout);
int acr120_write_register(int fd, unsigned char sid, unsigned char reg,
unsigned char value, int timeout);
int acr120_read_block(int fd, unsigned char sid, unsigned char block,
unsigned char *data, int timeout);
int acr120_read_value(int fd, unsigned char sid, unsigned char block,
unsigned int *value, int timeout);
int acr120_read_register(int fd, unsigned char sid, unsigned char reg,
unsigned char *value, int timeout);
int acr120_copy_block(int fd, unsigned char sid, unsigned char source,
unsigned char dest, int timeout);
int acr120_inc_value(int fd, unsigned char sid, unsigned char block,
unsigned int inc, int timeout);
int acr120_dec_value(int fd, unsigned char sid, unsigned char block,
unsigned int dec, int timeout);
int acr120_power_on(int fd, unsigned char sid, int timeout);
int acr120_power_off(int fd, unsigned char sid, int timeout);
#endif
Tidak ada komentar:
Posting Komentar