+/**
+ * mt_rfid.h
+ * Start your own mt-rfid pthread.
+ */
+
#ifndef MT_RFID_H
#define MT_RFID_H
+// setup structure
+// it might tempt you to run multiple instances with one reader, don't.
+// running each instance with its own reader (port name) should fine.
typedef struct {
- unsigned reader_type;
- char *port_name;
- unsigned port_interface;
- unsigned beep;
- unsigned run;
+ unsigned reader_type; // 0: auto, 1: 1Mbps, 2,3: slooow
+ char *port_name; // "COM9", "/dev/ttyUSB0", "" for auto selection
+ unsigned port_interface; // 0: auto, 1: serial, 2: ftdi
+ unsigned beep; // beep when a card is beeing read
+ unsigned run; // polling condition
} mt_rfid_t;
+// macros for convenience
+#define READER_TYPE 1 // uFR type (1Mbps)
+#define PORT_INTERFACE 1 // serial
+#ifndef PORT_NAME
+#define PORT_NAME "/dev/ttyUSB0"
+#endif
+
+// poll the uFR reader and print JSON formatted card info to stdout.
+// run it directly or using pthreads.
void *mt_rfid_run(void *ptr);
+//example
+/*
+
+pthread_t t;
+mt_rfid_t ufr = {READER_TYPE, PORT_NAME, PORT_INTERFACE, 0, 1};
+
+if (!pthread_create(&t, NULL, mt_rfid_run, (void *)&ufr)) {
+ getchar();
+ ufr.run = 0;
+ pthread_join(t, NULL);
+}
+
+*/
+
#endif