]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/blobdiff - mt_rfid.h
async uid + libev
[coffee/mt-apps.git] / mt_rfid.h
index 60c4515ba22fb1555366ed874f0077d760d0241e..5d9596099d5ee6dccec86d2900ee78e771754156 100644 (file)
--- a/mt_rfid.h
+++ b/mt_rfid.h
@@ -20,26 +20,17 @@ typedef struct {
 // 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);
-}
+#define ASYNC_SUFFIX 0
+#define ASYNC_BAUD_RATE 1000000
+#define BASYNC_BAUD_RATE B1000000
 
-*/
+// really simple JSON helpers
+#define JSON_NUM(NAME) printf("\"" #NAME "\": %d", NAME)
+#define JSON_STR(NAME) printf("\"" #NAME "\": \"%s\"", NAME)
+#define JSON_START() printf("{\n")
+#define JSON_NEXT() printf(",\n")
+#define JSON_END() printf("\n}\n")
 
 #endif