thermferm/thermferm.c

changeset 43
24e731bb2e08
parent 41
f534ace74eea
child 44
f37d73940699
--- a/thermferm/thermferm.c	Sun May 18 21:27:07 2014 +0200
+++ b/thermferm/thermferm.c	Sun May 18 22:56:43 2014 +0200
@@ -24,6 +24,7 @@
 #include "thermferm.h"
 #include "mosquitto.h"
 #include "sensors.h"
+#include "server.h"
 
 #ifdef HAVE_WIRINGPI_H
 
@@ -35,6 +36,7 @@
 
 bool			my_shutdown = false;
 static pid_t		pgrp, mypid;
+int			clients = 0;
 
 extern bool		debug;
 extern sys_config	Config;
@@ -154,6 +156,9 @@
     if (wiringPiSetup () )
 	return 1;
 
+    if (server_init() )
+	return 1;
+
     if ((rc = initLCD (16, 2))) {
 	fprintf(stderr, "Cannot initialize LCD display, rc=%d\n", rc);
 	return 1;
@@ -258,6 +263,12 @@
 	syslog(LOG_NOTICE, "my_sensors_loop thread didn't start rc=%d", rc);
     }
 
+    rc = piThreadCreate(my_server_loop);
+    if (rc) {
+	fprintf(stderr, "my_server_loop thread didn't start rc=%d\n", rc);
+	syslog(LOG_NOTICE, "my_server_loop thread didn't start rc=%d", rc);
+    }
+
     snprintf(buf, 1023, "tempA,coolerA,tempB,coolerB");
     logger((char *)"thermferm.log", (char *)"thermferm", buf);
 

mercurial