Added profile state ABORT

Mon, 11 Aug 2014 12:34:05 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 11 Aug 2014 12:34:05 +0200
changeset 217
2922d439ff63
parent 216
d734255e66a0
child 218
311a293b3e46

Added profile state ABORT

thermferm/rdconfig.c file | annotate | diff | comparison | revisions
thermferm/server.c file | annotate | diff | comparison | revisions
--- a/thermferm/rdconfig.c	Mon Aug 11 11:50:23 2014 +0200
+++ b/thermferm/rdconfig.c	Mon Aug 11 12:34:05 2014 +0200
@@ -34,7 +34,7 @@
 const char	TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" };
 const char      UNITMODE[5][8]	= { "OFF", "NONE", "FRIDGE", "BEER", "PROFILE" };
 const char	UNITmode[5]  = { 'o', 'n', 'f', 'b', 'p' };
-const char	PROFSTATE[4][6]	= { "OFF", "PAUSE", "RUN", "DONE" };
+const char	PROFSTATE[5][6]	= { "OFF", "PAUSE", "RUN", "DONE", "ABORT" };
 const char	DEVTYPE[7][6] = { "NA", "W1", "GPIO", "RC433", "DHT", "I2C", "SPI" };
 const char	DEVPRESENT[4][6] = { "UNDEF", "NO", "YES", "ERROR" };
 const char	DEVDIR[7][11] = { "UNDEF", "IN_BIN", "OUT_BIN", "IN_ANALOG", "OUT_ANALOG", "OUT_PWM", "INTERN" };
@@ -835,7 +835,7 @@
 	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_STATE"))) {
 	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	    for (i = 0; i < 4; i++) {
+	    for (i = 0; i < 5; i++) {
 		if (! xmlStrcmp(key, (const xmlChar *)PROFSTATE[i])) {
 		    unit->prof_state = i;
 		    break;
--- a/thermferm/server.c	Mon Aug 11 11:50:23 2014 +0200
+++ b/thermferm/server.c	Mon Aug 11 12:34:05 2014 +0200
@@ -41,7 +41,7 @@
 extern const char	DEVTYPE[7][6];
 extern const char	DEVPRESENT[4][6];
 extern const char	DEVDIR[7][11];
-extern const char	PROFSTATE[4][6];
+extern const char	PROFSTATE[5][6];
 
 
 int			s;		/* connected socket			*/
@@ -1075,11 +1075,9 @@
 		srv_send((char *)"FRIDGE_SET,%.1f", unit->fridge_set);
 		srv_send((char *)"BEER_SET,%.1f", unit->beer_set);
 		srv_send((char *)"PROFILE,%s", unit->profile);
-		if (unit->profile) {
-		    srv_send((char *)"PROF_STARTED,%d", (int)unit->prof_started);
-		    srv_send((char *)"PROF_STATE,%s", PROFSTATE[unit->prof_state]);
-		    srv_send((char *)"PROF_TARGET,%.3f", unit->prof_target);
-		}
+		srv_send((char *)"PROF_STARTED,%d", (int)unit->prof_started);
+		srv_send((char *)"PROF_STATE,%s", PROFSTATE[unit->prof_state]);
+		srv_send((char *)"PROF_TARGET,%.3f", unit->prof_target);
 		srv_send((char *)"TEMP_SET_MIN,%.1f", unit->temp_set_min);
 		srv_send((char *)"TEMP_SET_MAX,%.1f", unit->temp_set_max);
 		srv_send((char *)"IDLE_RANGE_L,%.1f", unit->idle_rangeL);
@@ -1268,7 +1266,7 @@
 				}
 
 			    } else if (val && (strcmp(kwd, (char *)"PROF_STATE") == 0)) {
-				for (i = 0; i < 4; i++) {
+				for (i = 0; i < 5; i++) {
 				    if (strcmp(val, PROFSTATE[i]) == 0) {
 					unit->prof_state = i;
 					break;

mercurial