261 } |
261 } |
262 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", unit->name)) < 0) { |
262 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", unit->name)) < 0) { |
263 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
263 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
264 return 1; |
264 return 1; |
265 } |
265 } |
|
266 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NUMBER", "%d", unit->number)) < 0)) { |
|
267 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
268 return 1; |
|
269 } |
|
270 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ACTIVE", "%d", unit->active)) < 0)) { |
|
271 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
272 return 1; |
|
273 } |
266 |
274 |
267 if (unit->hlt_sensor) { |
275 if (unit->hlt_sensor) { |
268 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_UUID", "%s", unit->hlt_sensor->uuid)) < 0)) { |
276 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_UUID", "%s", unit->hlt_sensor->uuid)) < 0)) { |
269 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
277 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
270 return 1; |
278 return 1; |
771 |
779 |
772 unit = (units_list *)malloc(sizeof(units_list)); |
780 unit = (units_list *)malloc(sizeof(units_list)); |
773 unit->next = NULL; |
781 unit->next = NULL; |
774 unit->version = 1; |
782 unit->version = 1; |
775 unit->uuid = unit->name = NULL; |
783 unit->uuid = unit->name = NULL; |
|
784 unit->number = 0; |
|
785 unit->active = 0; |
776 unit->hlt_sensor = unit->mlt_sensor = NULL; |
786 unit->hlt_sensor = unit->mlt_sensor = NULL; |
777 unit->hlt_heater = unit->mlt_heater = unit->mlt_pump = NULL; |
787 unit->hlt_heater = unit->mlt_heater = unit->mlt_pump = NULL; |
778 unit->hlt_heater_mltfirst = 0; |
788 unit->hlt_heater_mltfirst = 0; |
779 unit->pump_cycle = 7; |
789 unit->pump_cycle = 7; |
780 unit->pump_rest = 2; |
790 unit->pump_rest = 2; |
785 unit->pump_stop = 90; |
795 unit->pump_stop = 90; |
786 unit->skip_add = 0; |
796 unit->skip_add = 0; |
787 unit->skip_remove = 0; |
797 unit->skip_remove = 0; |
788 unit->skip_iodine = 0; |
798 unit->skip_iodine = 0; |
789 unit->iodine_time = 90; |
799 unit->iodine_time = 90; |
790 unit->whirlpool = 0; |
800 unit->whirlpool = 1; |
791 unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var)); |
801 unit->PID_hlt = (pid_var *)malloc(sizeof(pid_var)); |
792 unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var)); |
802 unit->PID_mlt = (pid_var *)malloc(sizeof(pid_var)); |
793 InitPID(unit->PID_hlt); |
803 InitPID(unit->PID_hlt); |
794 InitPID(unit->PID_mlt); |
804 InitPID(unit->PID_mlt); |
795 |
805 |
808 unit->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
818 unit->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
809 } |
819 } |
810 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { |
820 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { |
811 unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
821 unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
812 } |
822 } |
|
823 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMBER"))) { |
|
824 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
825 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
826 unit->number = ival; |
|
827 xmlFree(key); |
|
828 } |
|
829 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ACTIVE"))) { |
|
830 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
831 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
832 unit->active = ival; |
|
833 xmlFree(key); |
|
834 } |
813 |
835 |
814 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_UUID"))) { |
836 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_UUID"))) { |
815 if (unit->hlt_sensor == NULL) { |
837 if (unit->hlt_sensor == NULL) { |
816 unit->hlt_sensor = (sensor_var *)malloc(sizeof(sensor_var)); |
838 unit->hlt_sensor = (sensor_var *)malloc(sizeof(sensor_var)); |
817 unit->hlt_sensor->uuid[0] = '\0'; |
839 unit->hlt_sensor->uuid[0] = '\0'; |