]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/blobdiff - mt_aio.c
mt_server: Use "%s" format string in syslog()
[coffee/mt-apps.git] / mt_aio.c
index b6805a9bee795bf8547a1b8be9214e86344e4d09..076d49d44138c328cc1433695b30b7e8c2836140 100644 (file)
--- a/mt_aio.c
+++ b/mt_aio.c
@@ -1,13 +1,17 @@
 // merica terminal all in one
 #include "mt_rfid.h"
+#include "mt_keys.h"
 #include "mt_server.h"
 #include "signal_exit.h"
+#include "mt_blank.h"
+#include "mt_sim.h"
 
 int main(int argc, char **argv)
 {
     struct ev_loop *loop = EV_DEFAULT;
     int pipefd[2]; // read <- write
     mt_rfid_t rfid;
+    mt_keys_t keys;
     mt_server_t server;
 
     if (pipe(pipefd) == -1) {
@@ -17,10 +21,24 @@ int main(int argc, char **argv)
 
     set_signal_exit(loop);
 
+#if !defined(SIM)
     if (mt_rfid_init(&rfid, loop, pipefd[1]) != 0) {
         return -1;
     }
 
+    if (mt_keys_init(&keys, loop, pipefd[1]) != 0) {
+        return -1;
+    }
+
+    if (mt_blank_init(loop) != 0) {
+        return -3;
+    }
+#else
+    if (mt_sim_init(loop, pipefd[1]) != 0) {
+        return -1;
+    }
+#endif
+
     if (mt_server_init(&server, loop, pipefd[0]) != 0) {
         return -2;
     }
@@ -28,7 +46,13 @@ int main(int argc, char **argv)
     ev_run(loop, 0);
 
     mt_server_deinit(&server);
+#if !defined(SIM)
+    mt_keys_deinit(&keys);
     mt_rfid_deinit(&rfid);
+#else
+    mt_sim_deinit();
+#endif
+    ev_loop_destroy(loop);
 
     return 0;
 }