283 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", unit->name)) < 0) { |
273 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", unit->name)) < 0) { |
284 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
274 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
285 return 1; |
275 return 1; |
286 } |
276 } |
287 |
277 |
288 if (unit->hlt_sensor_address) { |
278 if (unit->hlt_sensor) { |
289 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_ADDRESS", "%s", unit->hlt_sensor_address)) < 0)) { |
279 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_UUID", "%s", unit->hlt_sensor->uuid)) < 0)) { |
290 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
280 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
291 return 1; |
281 return 1; |
292 } |
282 } |
293 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_STATE", "%d", unit->hlt_sensor_state)) < 0)) { |
283 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_STATE", "%d", unit->hlt_sensor->state)) < 0)) { |
294 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
284 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
295 return 1; |
285 return 1; |
296 } |
286 } |
297 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_VALUE", "%d", unit->hlt_sensor_value)) < 0)) { |
287 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_SENSOR_VALUE", "%d", unit->hlt_sensor->value)) < 0)) { |
298 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
288 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
299 return 1; |
289 return 1; |
300 } |
290 } |
301 } |
291 } |
302 |
292 |
303 if (unit->hlt_heater_address) { |
293 if (unit->hlt_heater) { |
304 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_ADDRESS", "%s", unit->hlt_heater_address)) < 0)) { |
294 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_UUID", "%s", unit->hlt_heater->uuid)) < 0)) { |
305 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
295 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
306 return 1; |
296 return 1; |
307 } |
297 } |
308 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_STATE", "%d", unit->hlt_heater_state)) < 0)) { |
298 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_VALUE", "%d", unit->hlt_heater->value)) < 0)) { |
309 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
299 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
310 return 1; |
300 return 1; |
311 } |
301 } |
312 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_DELAY", "%d", unit->hlt_heater_delay)) < 0)) { |
302 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_DELAY", "%d", unit->hlt_heater->delay)) < 0)) { |
313 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
303 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
314 return 1; |
304 return 1; |
315 } |
305 } |
316 } |
306 } |
317 |
307 |
318 if (unit->mlt_sensor_address) { |
308 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HLT_HEATER_MLTFIRST", "%d", unit->hlt_heater_mltfirst)) < 0)) { |
319 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_ADDRESS", "%s", unit->mlt_sensor_address)) < 0)) { |
309 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
320 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
310 return 1; |
321 return 1; |
311 } |
322 } |
312 |
323 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_STATE", "%d", unit->mlt_sensor_state)) < 0)) { |
313 if (unit->mlt_sensor) { |
324 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
314 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_UUID", "%s", unit->mlt_sensor->uuid)) < 0)) { |
325 return 1; |
315 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
326 } |
316 return 1; |
327 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_VALUE", "%d", unit->mlt_sensor_value)) < 0)) { |
317 } |
328 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
318 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_STATE", "%d", unit->mlt_sensor->state)) < 0)) { |
329 return 1; |
319 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
330 } |
320 return 1; |
331 } |
321 } |
332 |
322 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_SENSOR_VALUE", "%d", unit->mlt_sensor->value)) < 0)) { |
333 if (unit->mlt_heater_address) { |
323 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
334 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_ADDRESS", "%s", unit->mlt_heater_address)) < 0)) { |
324 return 1; |
335 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
325 } |
336 return 1; |
326 } |
337 } |
327 |
338 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_STATE", "%d", unit->mlt_heater_state)) < 0)) { |
328 if (unit->mlt_heater) { |
339 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
329 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_UUID", "%s", unit->mlt_heater->uuid)) < 0)) { |
340 return 1; |
330 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
341 } |
331 return 1; |
342 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_DELAY", "%d", unit->mlt_heater_delay)) < 0)) { |
332 } |
343 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
333 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_VALUE", "%d", unit->mlt_heater->value)) < 0)) { |
344 return 1; |
334 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
345 } |
335 return 1; |
346 } |
336 } |
347 |
337 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_HEATER_DELAY", "%d", unit->mlt_heater->delay)) < 0)) { |
348 if (unit->mlt_pump_address) { |
338 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
349 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_ADDRESS", "%s", unit->mlt_pump_address)) < 0)) { |
339 return 1; |
350 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
340 } |
351 return 1; |
341 } |
352 } |
342 |
353 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_STATE", "%d", unit->mlt_pump_state)) < 0)) { |
343 if (unit->mlt_pump) { |
354 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
344 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_UUID", "%s", unit->mlt_pump->uuid)) < 0)) { |
355 return 1; |
345 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
356 } |
346 return 1; |
357 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_DELAY", "%d", unit->mlt_pump_delay)) < 0)) { |
347 } |
358 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
348 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_VALUE", "%d", unit->mlt_pump->value)) < 0)) { |
359 return 1; |
349 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
360 } |
350 return 1; |
361 } |
351 } |
|
352 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MLT_PUMP_DELAY", "%d", unit->mlt_pump->delay)) < 0)) { |
|
353 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
354 return 1; |
|
355 } |
|
356 } |
|
357 |
|
358 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_CYCLE", "%d", unit->pump_cycle)) < 0)) { |
|
359 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
360 return 1; |
|
361 } |
|
362 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_REST", "%d", unit->pump_rest)) < 0)) { |
|
363 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
364 return 1; |
|
365 } |
|
366 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_PREMASH", "%d", unit->pump_premash)) < 0)) { |
|
367 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
368 return 1; |
|
369 } |
|
370 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_ONMASH", "%d", unit->pump_onmash)) < 0)) { |
|
371 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
372 return 1; |
|
373 } |
|
374 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_MASHOUT", "%d", unit->pump_mashout)) < 0)) { |
|
375 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
376 return 1; |
|
377 } |
|
378 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_ONBOIL", "%d", unit->pump_onboil)) < 0)) { |
|
379 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
380 return 1; |
|
381 } |
|
382 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PUMP_STOP", "%d", unit->pump_stop)) < 0)) { |
|
383 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
384 return 1; |
|
385 } |
|
386 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP_ADD", "%d", unit->skip_add)) < 0)) { |
|
387 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
388 return 1; |
|
389 } |
|
390 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP_REMOVE", "%d", unit->skip_remove)) < 0)) { |
|
391 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
392 return 1; |
|
393 } |
|
394 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "SKIP_IODINE", "%d", unit->skip_iodine)) < 0)) { |
|
395 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
396 return 1; |
|
397 } |
|
398 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "IODINE_TIME", "%d", unit->iodine_time)) < 0)) { |
|
399 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
400 return 1; |
|
401 } |
|
402 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "WHIRLPOOL", "%s", WHIRLPOOL_TYPE[unit->whirlpool])) < 0)) { |
|
403 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
404 return 1; |
|
405 } |
362 |
406 |
363 if (unit->PID_hlt) { |
407 if (unit->PID_hlt) { |
364 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_IMAX", "%.2f", unit->PID_hlt->iMax)) < 0) { |
408 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_HLT_IMAX", "%.2f", unit->PID_hlt->iMax)) < 0) { |
365 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
409 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
366 return 1; |
410 return 1; |
733 } |
788 } |
734 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { |
789 if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAME"))) { |
735 unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
790 unit->name = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
736 } |
791 } |
737 |
792 |
738 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_ADDRESS"))) { |
793 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_UUID"))) { |
739 unit->hlt_sensor_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
794 if (unit->hlt_sensor == NULL) { |
|
795 unit->hlt_sensor = (sensor_var *)malloc(sizeof(sensor_var)); |
|
796 unit->hlt_sensor->uuid[0] = '\0'; |
|
797 unit->hlt_sensor->state = 1; // missing |
|
798 unit->hlt_sensor->value = 0; |
|
799 } |
|
800 snprintf(unit->hlt_sensor->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); |
740 } |
801 } |
741 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_STATE"))) { |
802 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_STATE"))) { |
742 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
803 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
743 if (sscanf((const char *)key, "%d", &ival) == 1) |
804 if (sscanf((const char *)key, "%d", &ival) == 1) |
744 unit->hlt_sensor_state = ival; |
805 unit->hlt_sensor->state = ival; |
745 xmlFree(key); |
806 xmlFree(key); |
746 } |
807 } |
747 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_VALUE"))) { |
808 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_SENSOR_VALUE"))) { |
748 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
809 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
749 if (sscanf((const char *)key, "%d", &ival) == 1) |
810 if (sscanf((const char *)key, "%d", &ival) == 1) |
750 unit->hlt_sensor_value = ival; |
811 unit->hlt_sensor->value = ival; |
751 xmlFree(key); |
812 xmlFree(key); |
752 } |
813 } |
753 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_ADDRESS"))) { |
814 |
754 unit->hlt_heater_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
815 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_UUID"))) { |
755 } |
816 if (unit->hlt_heater == NULL) { |
|
817 unit->hlt_heater = (switch_var *)malloc(sizeof(switch_var)); |
|
818 unit->hlt_heater->uuid[0] = '\0'; |
|
819 unit->hlt_heater->value = 0; |
|
820 unit->hlt_heater->delay = 1; // 15 seconds |
|
821 } |
|
822 snprintf(unit->hlt_heater->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); |
|
823 } |
|
824 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_VALUE"))) { |
|
825 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
826 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
827 unit->hlt_heater->value = ival; |
|
828 xmlFree(key); |
|
829 } |
756 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_DELAY"))) { |
830 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_DELAY"))) { |
757 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
831 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
758 if (sscanf((const char *)key, "%d", &ival) == 1) |
832 if (sscanf((const char *)key, "%d", &ival) == 1) |
759 unit->hlt_heater_delay = ival; |
833 unit->hlt_heater->delay = ival; |
760 xmlFree(key); |
834 xmlFree(key); |
761 } |
835 } |
762 |
836 |
763 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_ADDRESS"))) { |
837 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HLT_HEATER_MLTFIRST"))) { |
764 unit->mlt_sensor_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
838 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
839 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
840 unit->hlt_heater_mltfirst = ival; |
|
841 xmlFree(key); |
|
842 } |
|
843 |
|
844 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_UUID"))) { |
|
845 if (unit->mlt_sensor == NULL) { |
|
846 unit->mlt_sensor = (sensor_var *)malloc(sizeof(sensor_var)); |
|
847 unit->mlt_sensor->uuid[0] = '\0'; |
|
848 unit->mlt_sensor->state = 1; // missing |
|
849 unit->mlt_sensor->value = 0; |
|
850 } |
|
851 snprintf(unit->mlt_sensor->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); |
765 } |
852 } |
766 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_STATE"))) { |
853 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_STATE"))) { |
767 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
854 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
768 if (sscanf((const char *)key, "%d", &ival) == 1) |
855 if (sscanf((const char *)key, "%d", &ival) == 1) |
769 unit->mlt_sensor_state = ival; |
856 unit->mlt_sensor->state = ival; |
770 xmlFree(key); |
857 xmlFree(key); |
771 } |
858 } |
772 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_VALUE"))) { |
859 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_SENSOR_VALUE"))) { |
773 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
860 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
774 if (sscanf((const char *)key, "%d", &ival) == 1) |
861 if (sscanf((const char *)key, "%d", &ival) == 1) |
775 unit->mlt_sensor_value = ival; |
862 unit->mlt_sensor->value = ival; |
776 xmlFree(key); |
863 xmlFree(key); |
777 } |
864 } |
778 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_ADDRESS"))) { |
865 |
779 unit->mlt_heater_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
866 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_UUID"))) { |
780 } |
867 if (unit->mlt_heater == NULL) { |
|
868 unit->mlt_heater = (switch_var *)malloc(sizeof(switch_var)); |
|
869 unit->mlt_heater->uuid[0] = '\0'; |
|
870 unit->mlt_heater->value = 0; |
|
871 unit->mlt_heater->delay = 1; // 15 seconds |
|
872 } |
|
873 snprintf(unit->mlt_heater->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); |
|
874 } |
|
875 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_VALUE"))) { |
|
876 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
877 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
878 unit->mlt_heater->value = ival; |
|
879 xmlFree(key); |
|
880 } |
781 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_DELAY"))) { |
881 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_HEATER_DELAY"))) { |
782 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
882 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
783 if (sscanf((const char *)key, "%d", &ival) == 1) |
883 if (sscanf((const char *)key, "%d", &ival) == 1) |
784 unit->mlt_heater_delay = ival; |
884 unit->mlt_heater->delay = ival; |
785 xmlFree(key); |
885 xmlFree(key); |
786 } |
886 } |
787 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_ADDRESS"))) { |
887 |
788 unit->mlt_pump_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
888 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_UUID"))) { |
789 } |
889 if (unit->mlt_pump == NULL) { |
|
890 unit->mlt_pump = (switch_var *)malloc(sizeof(switch_var)); |
|
891 unit->mlt_pump->uuid[0] = '\0'; |
|
892 unit->mlt_pump->value = 0; |
|
893 unit->mlt_pump->delay = 1; // 15 seconds |
|
894 } |
|
895 snprintf(unit->mlt_pump->uuid, 36, "%s", xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); |
|
896 } |
|
897 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_VALUE"))) { |
|
898 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
899 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
900 unit->mlt_pump->value = ival; |
|
901 xmlFree(key); |
|
902 } |
790 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_DELAY"))) { |
903 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MLT_PUMP_DELAY"))) { |
791 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
904 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
792 if (sscanf((const char *)key, "%d", &ival) == 1) |
905 if (sscanf((const char *)key, "%d", &ival) == 1) |
793 unit->mlt_pump_delay = ival; |
906 unit->mlt_pump->delay = ival; |
794 xmlFree(key); |
907 xmlFree(key); |
795 } |
908 } |
|
909 |
|
910 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_CYCLE"))) { |
|
911 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
912 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
913 unit->pump_cycle = ival; |
|
914 xmlFree(key); |
|
915 } |
|
916 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_REST"))) { |
|
917 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
918 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
919 unit->pump_rest = ival; |
|
920 xmlFree(key); |
|
921 } |
|
922 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_PREMASH"))) { |
|
923 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
924 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
925 unit->pump_premash = ival; |
|
926 xmlFree(key); |
|
927 } |
|
928 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONMASH"))) { |
|
929 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
930 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
931 unit->pump_onmash = ival; |
|
932 xmlFree(key); |
|
933 } |
|
934 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_MASHOUT "))) { |
|
935 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
936 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
937 unit->pump_mashout = ival; |
|
938 xmlFree(key); |
|
939 } |
|
940 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_ONBOIL"))) { |
|
941 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
942 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
943 unit->pump_onboil = ival; |
|
944 xmlFree(key); |
|
945 } |
|
946 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUMP_STOP"))) { |
|
947 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
948 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
949 unit->pump_stop = ival; |
|
950 xmlFree(key); |
|
951 } |
|
952 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_ADD"))) { |
|
953 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
954 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
955 unit->skip_add = ival; |
|
956 xmlFree(key); |
|
957 } |
|
958 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_REMOVE"))) { |
|
959 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
960 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
961 unit->skip_remove = ival; |
|
962 xmlFree(key); |
|
963 } |
|
964 if ((!xmlStrcmp(cur->name, (const xmlChar *)"SKIP_IODINE"))) { |
|
965 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
966 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
967 unit->skip_iodine = ival; |
|
968 xmlFree(key); |
|
969 } |
|
970 if ((!xmlStrcmp(cur->name, (const xmlChar *)"IODINE_TIME"))) { |
|
971 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
972 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
973 unit->iodine_time = ival; |
|
974 xmlFree(key); |
|
975 } |
|
976 if ((!xmlStrcmp(cur->name, (const xmlChar *)"WHIRLPOOL"))) { |
|
977 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
978 for (i = 0; i < 2; i++) { |
|
979 if (! xmlStrcmp(key, (const xmlChar *)WHIRLPOOL_TYPE[i])) { |
|
980 unit->whirlpool = i; |
|
981 break; |
|
982 } |
|
983 } |
|
984 xmlFree(key); |
|
985 } |
796 |
986 |
797 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_IMAX"))) { |
987 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_HLT_IMAX"))) { |
798 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
988 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
799 if (sscanf((const char *)key, "%f", &val) == 1) |
989 if (sscanf((const char *)key, "%f", &val) == 1) |
800 unit->PID_hlt->iMax = val; |
990 unit->PID_hlt->iMax = val; |