thermferm/rdconfig.c

changeset 165
e97829d0f8f9
parent 162
6fc9e3f7962f
child 166
c31ea86fec43
--- a/thermferm/rdconfig.c	Thu Jul 31 23:39:11 2014 +0200
+++ b/thermferm/rdconfig.c	Thu Jul 31 23:57:04 2014 +0200
@@ -43,7 +43,6 @@
 
 void killconfig(void)
 {
-    w1_therm		*tmp1;
     units_list		*tmp2;
     profiles_list	*tmp3;
     prof_step		*tmp4;
@@ -53,16 +52,6 @@
 	free(Config.name);
     Config.name = NULL;
 
-    for (tmp1 = Config.w1therms; tmp1; tmp1 = tmp1->next) {
-	if (tmp1->master)
-	    free(tmp1->master);
-	if (tmp1->name)
-	    free(tmp1->name);
-	if (tmp1->alias)
-	    free(tmp1->alias);
-	free(tmp1);
-    }
-    Config.w1therms = NULL;
     Config.my_port = 6554;
     Config.tempFormat = 'C';
     if (Config.air_address)
@@ -131,7 +120,6 @@
     FILE		*fp;
     xmlTextWriterPtr	writer;
     xmlBufferPtr	buf;
-    w1_therm    	*tmp1;
     units_list		*tmp3;
     profiles_list	*tmp4;
     prof_step		*tmp5;
@@ -259,50 +247,6 @@
 #endif
 
     /*
-     * For backwards compatibility, the old setup
-     */
-    if (Config.w1therms) {
-	if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "W1THERMS")) < 0) {
-	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
-	    return 1;
-	}
-	for (tmp1 = Config.w1therms; tmp1; tmp1 = tmp1->next) {
-	    if ((rc = xmlTextWriterStartElement(writer, BAD_CAST "W1THERM")) < 0) {
-		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterStartElement");
-		return 1;
-	    }
-	    if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) {
-		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
-		return 1;
-	    }
-	    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MASTER", "%s", tmp1->master)) < 0) {
-		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
-		return 1;
-	    }
-	    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BUS", "%d", tmp1->bus)) < 0) {
-		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
-		return 1;
-	    }
-	    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", tmp1->name)) < 0) {
-		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
-		return 1;
-	    }
-	    if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ALIAS", "%s", tmp1->alias)) < 0) {
-		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
-		return 1;
-	    }
-	    if ((rc = xmlTextWriterEndElement(writer)) < 0) {
-		syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
-		return 1;
-	    }
-	}
-	if ((rc = xmlTextWriterEndElement(writer)) < 0) {
-	    syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterEndElement");
-	    return 1;
-	}
-    }
-
-    /*
      * Fermenter units
      */
     if (Config.units) {
@@ -676,75 +620,6 @@
 
 
 
-int parseW1therm(xmlDocPtr doc, xmlNodePtr cur)
-{
-    xmlChar     *key;
-    int         ival;
-    w1_therm	*w1therm, *tmp;
-
-    w1therm = (w1_therm *)malloc(sizeof(w1_therm));
-    w1therm->next = NULL;
-    w1therm->master = w1therm->name = w1therm->alias = NULL;
-    w1therm->bus = w1therm->present = w1therm->lastval = w1therm->update = 0;
-
-    cur = cur->xmlChildrenNode;
-    while (cur != NULL) {
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
-	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	    if (xmlStrcmp(key, (const xmlChar *)"1")) {
-		xmlFree(key);
-		return 1;
-	    }
-	    xmlFree(key);
-	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"MASTER"))) {
-	    w1therm->master = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"BUS"))) {
-	    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	    if (sscanf((const char *)key, "%d", &ival) == 1)
-		w1therm->bus = ival;
-	    xmlFree(key);
-	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) {
-	    w1therm->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	}
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"ALIAS"))) {
-	    w1therm->alias = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
-	}
-	cur = cur->next;
-    }
-
-    if (Config.w1therms == NULL) {
-	Config.w1therms = w1therm;
-    } else {
-	for (tmp = Config.w1therms; tmp; tmp = tmp->next) {
-	    if (tmp->next == NULL) {
-		tmp->next = w1therm;
-		break;
-	    }
-	}
-    }
-
-    return 0;
-}
-
-
-
-int parseW1therms(xmlDocPtr doc, xmlNodePtr cur)
-{
-    cur = cur->xmlChildrenNode;
-    while (cur != NULL) {
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"W1THERM"))) {
-	    parseW1therm(doc, cur);
-	}
-	cur = cur->next;
-    }
-    return 0;
-}
-
-
-
 /*
  * Parse a fermenter unit
  */
@@ -1307,9 +1182,6 @@
 	    parseLCDs(doc, cur);
 	}
 #endif
-	if ((!xmlStrcmp(cur->name, (const xmlChar *)"W1THERMS"))) {
-	    parseW1therms(doc, cur);
-	}
 	if ((!xmlStrcmp(cur->name, (const xmlChar *)"FERMENTERS"))) {
 	    parseFermenters(doc, cur);
 	}

mercurial