thermferm/rdconfig.c

changeset 564
3fc61dd28656
parent 562
119129969d37
child 565
3593b18486d7
equal deleted inserted replaced
563:ca2fafcf3294 564:3fc61dd28656
31 31
32 #define MY_ENCODING "utf-8" 32 #define MY_ENCODING "utf-8"
33 33
34 const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" }; 34 const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" };
35 const char UNITMODE[5][8] = { "OFF", "NONE", "FRIDGE", "BEER", "PROFILE" }; 35 const char UNITMODE[5][8] = { "OFF", "NONE", "FRIDGE", "BEER", "PROFILE" };
36 const char UNITSTAGE[3][10] = { "PRIMARY", "SECONDARY", "TERTIARY" };
36 const char PROFSTATE[5][6] = { "OFF", "PAUSE", "RUN", "DONE", "ABORT" }; 37 const char PROFSTATE[5][6] = { "OFF", "PAUSE", "RUN", "DONE", "ABORT" };
37 const char DEVTYPE[8][6] = { "NA", "W1", "GPIO", "RC433", "DHT", "I2C", "SPI", "SIM" }; 38 const char DEVTYPE[8][6] = { "NA", "W1", "GPIO", "RC433", "DHT", "I2C", "SPI", "SIM" };
38 const char DEVPRESENT[4][6] = { "UNDEF", "NO", "YES", "ERROR" }; 39 const char DEVPRESENT[4][6] = { "UNDEF", "NO", "YES", "ERROR" };
39 const char DEVDIR[7][11] = { "UNDEF", "IN_BIN", "OUT_BIN", "IN_ANALOG", "OUT_ANALOG", "OUT_PWM", "INTERN" }; 40 const char DEVDIR[7][11] = { "UNDEF", "IN_BIN", "OUT_BIN", "IN_ANALOG", "OUT_ANALOG", "OUT_PWM", "INTERN" };
40 const char PIDMODE[3][5] = { "NONE", "AUTO", "BOO" }; 41 const char PIDMODE[3][5] = { "NONE", "AUTO", "BOO" };
561 } 562 }
562 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MODE", "%s", UNITMODE[tmp3->mode] )) < 0) { 563 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "MODE", "%s", UNITMODE[tmp3->mode] )) < 0) {
563 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 564 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
564 return 1; 565 return 1;
565 } 566 }
567 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "STAGE", "%s", UNITSTAGE[tmp3->stage] )) < 0) {
568 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
569 return 1;
570 }
566 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_SET", "%.1f", tmp3->beer_set)) < 0) { 571 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_SET", "%.1f", tmp3->beer_set)) < 0) {
567 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 572 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
568 return 1; 573 return 1;
569 } 574 }
570 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_SET", "%.1f", tmp3->fridge_set)) < 0) { 575 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIDGE_SET", "%.1f", tmp3->fridge_set)) < 0) {
1143 unit->light_address = unit->psu_address = unit->profile = NULL; 1148 unit->light_address = unit->psu_address = unit->profile = NULL;
1144 unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0; 1149 unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0;
1145 unit->air_temperature = unit->beer_temperature = unit->chiller_temperature = unit->beer_set = unit->fridge_set = 20.0; 1150 unit->air_temperature = unit->beer_temperature = unit->chiller_temperature = unit->beer_set = unit->fridge_set = 20.0;
1146 unit->air_state = unit->beer_state = unit->chiller_state = 1; // missing 1151 unit->air_state = unit->beer_state = unit->chiller_state = 1; // missing
1147 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = \ 1152 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = \
1148 unit->light_state = unit->psu_state = unit->mode = unit->prof_state = 0; 1153 unit->light_state = unit->psu_state = unit->mode = unit->prof_state = unit->stage = 0;
1149 unit->air_idx = unit->beer_idx = unit->chiller_idx = unit->heater_idx = unit->cooler_idx = unit->fan_idx = \ 1154 unit->air_idx = unit->beer_idx = unit->chiller_idx = unit->heater_idx = unit->cooler_idx = unit->fan_idx = \
1150 unit->door_idx = unit->light_idx = unit->psu_idx = 0; 1155 unit->door_idx = unit->light_idx = unit->psu_idx = 0;
1151 unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */ 1156 unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */
1152 unit->light_delay = 1; /* 15 seconds delay */ 1157 unit->light_delay = 1; /* 15 seconds delay */
1153 unit->heater_wait = unit->cooler_wait = unit->fan_wait = unit->light_wait = 0; 1158 unit->heater_wait = unit->cooler_wait = unit->fan_wait = unit->light_wait = 0;
1379 break; 1384 break;
1380 } 1385 }
1381 } 1386 }
1382 xmlFree(key); 1387 xmlFree(key);
1383 } 1388 }
1389 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STAGE"))) {
1390 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1391 for (i = 0; i < 3; i++) {
1392 if (! xmlStrcmp(key, (const xmlChar *)UNITSTAGE[i])) {
1393 unit->stage = i;
1394 break;
1395 }
1396 }
1397 xmlFree(key);
1398 }
1384 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_SET"))) { 1399 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_SET"))) {
1385 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1400 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1386 if (sscanf((const char *)key, "%f", &val) == 1) 1401 if (sscanf((const char *)key, "%f", &val) == 1)
1387 unit->beer_set = val; 1402 unit->beer_set = val;
1388 xmlFree(key); 1403 xmlFree(key);

mercurial