7 typedef struct ev_io_ufr {
9 char uid_data[24]; // store uid here (uid is 10 bytes max)
10 char *uid; // current position in uid_data
11 int fd; // PORT_NAME file descriptor
14 typedef struct mt_rfid_t {
15 ev_io_ufr w; // reader watcher
16 int fd; // print JSON output here
19 // reader open parameters, see uFR manual
20 #define UFR_READER_TYPE 1 // uFR type (1Mbps)
21 #define UFR_PORT_INTERFACE 1 // serial; auto->ftdi->FAIL
22 #define UFR_PORT_NAME "/dev/ttyUSB0" // reader device
23 #define UFR_ASYNC_BAUD_RATE 1000000 // 1Mbps, otherwise UFR_COMMUNICATION_BREAK
25 #define UFR_BEEP // define this to annoy people
27 // connect to the reader, add self to loop and make it write to fd
28 // return 0 on success, negative number otherwise
29 int mt_rfid_init(mt_rfid_t *self, struct ev_loop *loop, int fd);
31 // disconnect from reader
32 void mt_rfid_deinit(mt_rfid_t *self);
36 #define mt_rfid_init(self, loop, fd) 0
37 #define mt_rfid_deinit(self) 0