]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/blob - mt_rfid.h
almost ready
[coffee/mt-apps.git] / mt_rfid.h
1 /**
2  * mt_rfid.h
3  */
4
5 #ifndef MT_RFID_H
6 #define MT_RFID_H
7
8 #include <ev.h>
9
10 // reader open parameters, see uFR manual
11 #define READER_TYPE    1 // uFR type (1Mbps)
12 #define PORT_INTERFACE 1 // serial, auto -> ftdi -> FAIL (some shity drivers missing)
13 #define PORT_NAME "/dev/ttyUSB0"
14
15 // async uid sending parameters
16 #define ASYNC_SUFFIX            0 // keep it zero: + separates uids, + terminates strings
17 #define ASYNC_BAUD_RATE   1000000 // 1Mbps, otherwise UFR_COMMUNICATION_BREAK
18
19 //#define UFR_BEEP // define this to annoy people
20
21 typedef struct ev_io_ufr {
22     ev_io w;
23     char uid_data[24]; // this is enough (10 bytes max)
24     char *uid;
25     int fd;
26 } ev_io_ufr;
27
28 typedef struct mt_rfid_t {
29     ev_io_ufr w;
30     int fd;
31 } mt_rfid_t;
32
33 int mt_rfid_init(mt_rfid_t *self, struct ev_loop *loop, int fd);
34 void mt_rfid_deinit(mt_rfid_t *self);
35
36 #endif