X-Git-Url: https://rtime.felk.cvut.cz/gitweb/coffee/mt-apps.git/blobdiff_plain/f37388d7dcc4c9b2b8e0bef508c36929d38e716c..HEAD:/mt_aio.c diff --git a/mt_aio.c b/mt_aio.c index b6805a9..076d49d 100644 --- 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; }