73 free(Config.mqtt_username); |
73 free(Config.mqtt_username); |
74 Config.mqtt_username = NULL; |
74 Config.mqtt_username = NULL; |
75 if (Config.mqtt_password) |
75 if (Config.mqtt_password) |
76 free(Config.mqtt_password); |
76 free(Config.mqtt_password); |
77 Config.mqtt_password = NULL; |
77 Config.mqtt_password = NULL; |
|
78 if (Config.uuid) |
|
79 free(Config.uuid); |
|
80 Config.uuid = NULL; |
78 |
81 |
79 for (tmp2 = Config.units; tmp2; tmp2 = tmp2->next) { |
82 for (tmp2 = Config.units; tmp2; tmp2 = tmp2->next) { |
80 if (tmp2->uuid) |
83 if (tmp2->uuid) |
81 free(tmp2->uuid); |
84 free(tmp2->uuid); |
82 if (tmp2->name) |
85 if (tmp2->name) |
214 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) { |
217 if ((rc = xmlTextWriterWriteElement(writer, BAD_CAST "VERSION", BAD_CAST "1")) < 0) { |
215 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
218 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); |
216 return 1; |
219 return 1; |
217 } |
220 } |
218 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", Config.name)) < 0) { |
221 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", Config.name)) < 0) { |
|
222 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
223 return 1; |
|
224 } |
|
225 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", Config.uuid)) < 0) { |
219 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
226 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
220 return 1; |
227 return 1; |
221 } |
228 } |
222 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LISTEN_PORT", "%d", Config.my_port)) < 0) { |
229 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "LISTEN_PORT", "%d", Config.my_port)) < 0) { |
223 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
230 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
2217 Config.mqtt_username = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
2224 Config.mqtt_username = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
2218 } |
2225 } |
2219 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MQTT_PASS"))) { |
2226 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MQTT_PASS"))) { |
2220 Config.mqtt_password = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
2227 Config.mqtt_password = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
2221 } |
2228 } |
|
2229 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { |
|
2230 Config.uuid= (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
2231 } |
2222 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCDS"))) { |
2232 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LCDS"))) { |
2223 parseLCDs(doc, cur); |
2233 parseLCDs(doc, cur); |
2224 } |
2234 } |
2225 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FERMENTERS"))) { |
2235 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FERMENTERS"))) { |
2226 parseFermenters(doc, cur); |
2236 parseFermenters(doc, cur); |