]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/blob - mt_rfid.h
doc
[coffee/mt-apps.git] / mt_rfid.h
1 /**
2  * mt_rfid.h
3  * Start your own mt-rfid pthread.
4  */
5
6 #ifndef MT_RFID_H
7 #define MT_RFID_H
8
9 // setup structure
10 // it might tempt you to run multiple instances with one reader, don't.
11 // running each instance with its own reader (port name) should fine.
12 typedef struct {
13     unsigned reader_type;    // 0: auto, 1: 1Mbps, 2,3: slooow
14     char *port_name;         // "COM9", "/dev/ttyUSB0", "" for auto selection
15     unsigned port_interface; // 0: auto, 1: serial, 2: ftdi
16     unsigned beep;           // beep when a card is beeing read
17     unsigned run;            // polling condition
18 } mt_rfid_t;
19
20 // macros for convenience
21 #define READER_TYPE    1 // uFR type (1Mbps)
22 #define PORT_INTERFACE 1 // serial
23 #ifndef PORT_NAME
24 #define PORT_NAME "/dev/ttyUSB0"
25 #endif
26
27 // poll the uFR reader and print JSON formatted card info to stdout.
28 // run it directly or using pthreads.
29 void *mt_rfid_run(void *ptr);
30
31 //example
32 /*
33
34 pthread_t t;
35 mt_rfid_t ufr = {READER_TYPE, PORT_NAME, PORT_INTERFACE, 0, 1};
36
37 if (!pthread_create(&t, NULL, mt_rfid_run, (void *)&ufr)) {
38     getchar();
39     ufr.run = 0;
40     pthread_join(t, NULL);
41 }
42
43 */
44
45 #endif