From abfd02fc7233734ffcc3c396efcbedddfba49727 Mon Sep 17 00:00:00 2001 From: ZoRo Date: Wed, 8 Feb 2017 22:39:58 +0000 Subject: Updated command parser. Event loop now support test commands --- agni.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'agni.c') diff --git a/agni.c b/agni.c index 32b3e12..ba35505 100644 --- a/agni.c +++ b/agni.c @@ -664,7 +664,7 @@ int th_event_manager(void *data) int err; int mq_event; //read any command - //mq_cmd *cmd = NULL; + mq_cmd *recv_cmd = NULL; // for recieved cmd from mq struct mq_attr out_attr, *ptr_out_attr=&out_attr; printf("Start event thread\n"); @@ -714,12 +714,35 @@ int th_event_manager(void *data) //if (run == 10) // break; - //applay to recieved command executor //if QUIT then quit the thread + recv_cmd = mq_cmd_creates(out_buf, out_attr.mq_msgsize, -1); + if (recv_cmd != NULL) + { + PNL(); + if (mq_cmd_o_cmp_cmd(recv_cmd,"QUIT") == 0) + { + printf("QUIT recieved lets quit main loop\n"); + break; + } + + if (mq_cmd_o_cmp_cmd(recv_cmd,"CMD1") == 0) + { + printf("Hey dude it works\n"); + } + + if (mq_cmd_o_cmp_cmd(recv_cmd,"CMD2") == 0) + { + printf("Hey dude it works second time\n"); + } + + } + + //applay to recieved command executor + //other command pass to cmd/execution matching table //pass to exec handler //get response if command is immidieate otherwise wait for response in next execution - + } free(out_buf); -- cgit v1.2.3