thermferm/rdconfig.c

changeset 270
df81d583c2c3
parent 268
dda91dfa4aa8
child 284
9e6fb5aed618
equal deleted inserted replaced
269:dc88583a068d 270:df81d583c2c3
348 } 348 }
349 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_STATE", "%d", tmp3->heater_state)) < 0)) { 349 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_STATE", "%d", tmp3->heater_state)) < 0)) {
350 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 350 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
351 return 1; 351 return 1;
352 } 352 }
353 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_DELAY", "%d", tmp3->heater_delay)) < 0)) {
354 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
355 return 1;
356 }
353 } 357 }
354 if (tmp3->cooler_address) { 358 if (tmp3->cooler_address) {
355 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_ADDRESS", "%s", tmp3->cooler_address)) < 0)) { 359 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_ADDRESS", "%s", tmp3->cooler_address)) < 0)) {
356 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 360 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
357 return 1; 361 return 1;
358 } 362 }
359 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_STATE", "%d", tmp3->cooler_state)) < 0)) { 363 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_STATE", "%d", tmp3->cooler_state)) < 0)) {
360 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 364 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
361 return 1; 365 return 1;
362 } 366 }
367 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_DELAY", "%d", tmp3->cooler_delay)) < 0)) {
368 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
369 return 1;
370 }
363 } 371 }
364 if (tmp3->fan_address) { 372 if (tmp3->fan_address) {
365 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_ADDRESS", "%s", tmp3->fan_address)) < 0)) { 373 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_ADDRESS", "%s", tmp3->fan_address)) < 0)) {
366 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 374 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
367 return 1; 375 return 1;
368 } 376 }
369 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_STATE", "%d", tmp3->fan_state)) < 0)) { 377 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_STATE", "%d", tmp3->fan_state)) < 0)) {
370 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 378 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
371 return 1; 379 return 1;
380 }
381 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_DELAY", "%d", tmp3->fan_delay)) < 0)) {
382 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
383 return 1;
372 } 384 }
373 } 385 }
374 if (tmp3->door_address) { 386 if (tmp3->door_address) {
375 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_ADDRESS", "%s", tmp3->door_address)) < 0)) { 387 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_ADDRESS", "%s", tmp3->door_address)) < 0)) {
376 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 388 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
835 unit->cooler_address = unit->fan_address = unit->door_address = unit->profile = NULL; 847 unit->cooler_address = unit->fan_address = unit->door_address = unit->profile = NULL;
836 unit->volume = 0.0; 848 unit->volume = 0.0;
837 unit->air_temperature = unit->beer_temperature = unit->beer_set = unit->fridge_set = 20.0; 849 unit->air_temperature = unit->beer_temperature = unit->beer_set = unit->fridge_set = 20.0;
838 unit->air_state = unit->beer_state = 1; // missing 850 unit->air_state = unit->beer_state = 1; // missing
839 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0; 851 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0;
852 unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */
853 unit->heater_wait = unit->cooler_wait = unit->fan_wait = 0;
840 unit->temp_set_min = 1.0; 854 unit->temp_set_min = 1.0;
841 unit->temp_set_max = 30.0; 855 unit->temp_set_max = 30.0;
842 unit->idle_rangeH = 1.0; 856 unit->idle_rangeH = 1.0;
843 unit->idle_rangeL = -1.0; 857 unit->idle_rangeL = -1.0;
844 unit->prof_started = unit->prof_paused = (time_t)0; 858 unit->prof_started = unit->prof_paused = (time_t)0;
898 xmlFree(key); 912 xmlFree(key);
899 } 913 }
900 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_ADDRESS"))) { 914 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_ADDRESS"))) {
901 unit->heater_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 915 unit->heater_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
902 } 916 }
917 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_DELAY"))) {
918 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
919 if (sscanf((const char *)key, "%d", &ival) == 1)
920 unit->heater_delay = ival;
921 xmlFree(key);
922 }
903 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_ADDRESS"))) { 923 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_ADDRESS"))) {
904 unit->cooler_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 924 unit->cooler_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
905 } 925 }
926 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_DELAY"))) {
927 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
928 if (sscanf((const char *)key, "%d", &ival) == 1)
929 unit->cooler_delay = ival;
930 xmlFree(key);
931 }
906 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_ADDRESS"))) { 932 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_ADDRESS"))) {
907 unit->fan_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 933 unit->fan_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
934 }
935 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_DELAY"))) {
936 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
937 if (sscanf((const char *)key, "%d", &ival) == 1)
938 unit->fan_delay = ival;
939 xmlFree(key);
908 } 940 }
909 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_ADDRESS"))) { 941 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_ADDRESS"))) {
910 unit->door_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 942 unit->door_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
911 } 943 }
912 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MODE"))) { 944 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MODE"))) {

mercurial