thermferm/rdconfig.c

changeset 293
881b1ae75468
parent 289
d810df0df36a
child 306
97602274eb58
equal deleted inserted replaced
292:138d5e15be01 293:881b1ae75468
356 } 356 }
357 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_DELAY", "%d", tmp3->heater_delay)) < 0)) { 357 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_DELAY", "%d", tmp3->heater_delay)) < 0)) {
358 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 358 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
359 return 1; 359 return 1;
360 } 360 }
361 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_USAGE", "%d", tmp3->heater_usage)) < 0)) {
362 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
363 return 1;
364 }
361 } 365 }
362 if (tmp3->cooler_address) { 366 if (tmp3->cooler_address) {
363 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_ADDRESS", "%s", tmp3->cooler_address)) < 0)) { 367 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_ADDRESS", "%s", tmp3->cooler_address)) < 0)) {
364 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 368 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
365 return 1; 369 return 1;
370 } 374 }
371 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_DELAY", "%d", tmp3->cooler_delay)) < 0)) { 375 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_DELAY", "%d", tmp3->cooler_delay)) < 0)) {
372 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 376 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
373 return 1; 377 return 1;
374 } 378 }
379 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_USAGE", "%d", tmp3->cooler_usage)) < 0)) {
380 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
381 return 1;
382 }
375 } 383 }
376 if (tmp3->fan_address) { 384 if (tmp3->fan_address) {
377 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_ADDRESS", "%s", tmp3->fan_address)) < 0)) { 385 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_ADDRESS", "%s", tmp3->fan_address)) < 0)) {
378 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 386 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
379 return 1; 387 return 1;
381 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_STATE", "%d", tmp3->fan_state)) < 0)) { 389 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_STATE", "%d", tmp3->fan_state)) < 0)) {
382 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 390 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
383 return 1; 391 return 1;
384 } 392 }
385 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_DELAY", "%d", tmp3->fan_delay)) < 0)) { 393 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_DELAY", "%d", tmp3->fan_delay)) < 0)) {
394 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
395 return 1;
396 }
397 if (((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_USAGE", "%d", tmp3->fan_usage)) < 0)) {
386 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 398 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
387 return 1; 399 return 1;
388 } 400 }
389 } 401 }
390 if (tmp3->door_address) { 402 if (tmp3->door_address) {
865 unit->air_temperature = unit->beer_temperature = unit->beer_set = unit->fridge_set = 20.0; 877 unit->air_temperature = unit->beer_temperature = unit->beer_set = unit->fridge_set = 20.0;
866 unit->air_state = unit->beer_state = 1; // missing 878 unit->air_state = unit->beer_state = 1; // missing
867 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0; 879 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0;
868 unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */ 880 unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */
869 unit->heater_wait = unit->cooler_wait = unit->fan_wait = 0; 881 unit->heater_wait = unit->cooler_wait = unit->fan_wait = 0;
882 unit->heater_usage = unit->cooler_usage = unit->fan_usage = 0;
870 unit->temp_set_min = 1.0; 883 unit->temp_set_min = 1.0;
871 unit->temp_set_max = 30.0; 884 unit->temp_set_max = 30.0;
872 unit->idle_rangeH = 1.0; 885 unit->idle_rangeH = 1.0;
873 unit->idle_rangeL = -1.0; 886 unit->idle_rangeL = -1.0;
874 unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0; 887 unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0;
935 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 948 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
936 if (sscanf((const char *)key, "%d", &ival) == 1) 949 if (sscanf((const char *)key, "%d", &ival) == 1)
937 unit->heater_delay = ival; 950 unit->heater_delay = ival;
938 xmlFree(key); 951 xmlFree(key);
939 } 952 }
953 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_USAGE"))) {
954 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
955 if (sscanf((const char *)key, "%d", &ival) == 1)
956 unit->heater_usage = ival;
957 xmlFree(key);
958 }
940 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_ADDRESS"))) { 959 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_ADDRESS"))) {
941 unit->cooler_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 960 unit->cooler_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
942 } 961 }
943 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_DELAY"))) { 962 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_DELAY"))) {
944 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 963 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
945 if (sscanf((const char *)key, "%d", &ival) == 1) 964 if (sscanf((const char *)key, "%d", &ival) == 1)
946 unit->cooler_delay = ival; 965 unit->cooler_delay = ival;
947 xmlFree(key); 966 xmlFree(key);
948 } 967 }
968 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_USAGE"))) {
969 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
970 if (sscanf((const char *)key, "%d", &ival) == 1)
971 unit->cooler_usage = ival;
972 xmlFree(key);
973 }
949 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_ADDRESS"))) { 974 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_ADDRESS"))) {
950 unit->fan_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 975 unit->fan_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
951 } 976 }
952 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_DELAY"))) { 977 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_DELAY"))) {
953 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 978 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
954 if (sscanf((const char *)key, "%d", &ival) == 1) 979 if (sscanf((const char *)key, "%d", &ival) == 1)
955 unit->fan_delay = ival; 980 unit->fan_delay = ival;
956 xmlFree(key); 981 xmlFree(key);
982 }
983 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_USAGE"))) {
984 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
985 if (sscanf((const char *)key, "%d", &ival) == 1)
986 unit->fan_usage = ival;
987 xmlFree(key);
957 } 988 }
958 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_ADDRESS"))) { 989 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_ADDRESS"))) {
959 unit->door_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 990 unit->door_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
960 } 991 }
961 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MODE"))) { 992 if ((!xmlStrcmp(cur->name, (const xmlChar *)"MODE"))) {

mercurial