From 1e846faaec3f5dd19128068fc52c2df5d7ba712a Mon Sep 17 00:00:00 2001 From: Robert Gustafsson Date: Thu, 28 Sep 2017 16:39:28 +0200 Subject: Add new thread for event handling --- broccoli/broevent.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'broccoli/broevent.c') diff --git a/broccoli/broevent.c b/broccoli/broevent.c index 94d06b8..2b3db8d 100644 --- a/broccoli/broevent.c +++ b/broccoli/broevent.c @@ -3,20 +3,22 @@ char *host_default = "127.0.0.1"; char *port_default = "47760"; +Fifo_q * q; static void bro_response(BroConn *conn, void *data, uint64* registers, uint64* uid) { - printf("Received value %"PRIu64" from uid=%"PRIu64"\n",*registers,*uid); + add_to_queue(q,create_sensor_object(*registers,*uid)); + //printf("Received value %"PRIu64" from uid=%"PRIu64"\n",*registers,*uid); conn = NULL; data = NULL; } - void -bro_event_listener() + void * +bro_event_listener(void * args) { - + q = (Fifo_q *) args; int fd = -1; BroConn *bc = NULL; bro_init(NULL); -- cgit v1.2.1