brewco/rdconfig.c

changeset 441
bde74a8f2ad7
parent 438
7d1ec160d751
child 445
3ec477cda546
--- a/brewco/rdconfig.c	Sat Nov 28 13:47:00 2015 +0100
+++ b/brewco/rdconfig.c	Sat Nov 28 20:15:38 2015 +0100
@@ -263,6 +263,14 @@
                 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
                 return 1;
             }
+	    if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NUMBER", "%d", unit->number)) < 0)) {
+		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		return 1;
+	    }
+	    if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ACTIVE", "%d", unit->active)) < 0)) {
+		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
+		return 1;
+	    }
 
             if (unit->hlt_sensor) {
                 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_UUID", "%s", unit->hlt_sensor->uuid)) < 0)) {
@@ -773,6 +781,8 @@
     unit->next = NULL;
     unit->version = 1;
     unit->uuid = unit->name = NULL;
+    unit->number = 0;
+    unit->active = 0;
     unit->hlt_sensor = unit->mlt_sensor = NULL;
     unit->hlt_heater = unit->mlt_heater = unit->mlt_pump = NULL;
     unit->hlt_heater_mltfirst = 0;
@@ -787,7 +797,7 @@
     unit->skip_remove = 0;
     unit->skip_iodine = 0;
     unit->iodine_time = 90;
-    unit->whirlpool = 0;
+    unit->whirlpool = 1;
     unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var));
     unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var));
     InitPID(unit->PID_hlt);
@@ -810,6 +820,18 @@
         if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
             unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
         }
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMBER"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->number = ival;
+	    xmlFree(key);
+	}
+	if ((!xmlStrcmp(cur->name, (const xmlChar *)"ACTIVE"))) {
+	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	    if (sscanf((const char *)key, "%d", &ival) == 1)
+		unit->active = ival;
+	    xmlFree(key);
+	}
 
         if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_UUID"))) {
 	    if (unit->hlt_sensor == NULL) {

mercurial