thermferm/rdconfig.c

changeset 716
5c30c8ef83a8
parent 714
24749c296a50
equal deleted inserted replaced
715:f5d85af156ab 716:5c30c8ef83a8
172 free(simulator->heater_address); 172 free(simulator->heater_address);
173 if (simulator->fan_address) 173 if (simulator->fan_address)
174 free(simulator->fan_address); 174 free(simulator->fan_address);
175 if (simulator->light_address) 175 if (simulator->light_address)
176 free(simulator->light_address); 176 free(simulator->light_address);
177 if (simulator->door_address)
178 free(simulator->door_address);
179 if (simulator->psu_address)
180 free(simulator->psu_address);
177 free(simulator); 181 free(simulator);
178 } 182 }
179 Config.simulators = NULL; 183 Config.simulators = NULL;
180 #endif 184 #endif
181 185
485 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_PRESENT", "%s", DEVPRESENT[simulator->fan_present]); 489 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_PRESENT", "%s", DEVPRESENT[simulator->fan_present]);
486 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_POWER", "%d", simulator->fan_power); 490 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_POWER", "%d", simulator->fan_power);
487 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_ADDRESS", "%s", simulator->light_address); 491 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_ADDRESS", "%s", simulator->light_address);
488 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_PRESENT", "%s", DEVPRESENT[simulator->light_present]); 492 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_PRESENT", "%s", DEVPRESENT[simulator->light_present]);
489 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_POWER", "%d", simulator->light_power); 493 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_POWER", "%d", simulator->light_power);
494 xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_ADDRESS", "%s", simulator->door_address);
495 xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_PRESENT", "%s", DEVPRESENT[simulator->door_present]);
496 xmlTextWriterWriteFormatElement(writer, BAD_CAST "DOOR_VALUE", "%d", simulator->door_value);
497 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_ADDRESS", "%s", simulator->psu_address);
498 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_PRESENT", "%s", DEVPRESENT[simulator->psu_present]);
499 xmlTextWriterWriteFormatElement(writer, BAD_CAST "PSU_VALUE", "%d", simulator->psu_value);
490 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIGO_ISOLATION", "%.3f", simulator->frigo_isolation); 500 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIGO_ISOLATION", "%.3f", simulator->frigo_isolation);
491 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TIMESTAMP", "%ld", (long)simulator->timestamp); 501 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TIMESTAMP", "%ld", (long)simulator->timestamp);
492 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_HEAT", "%f", simulator->s_yeast_heat); 502 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_HEAT", "%f", simulator->s_yeast_heat);
493 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_STARTED", "%d", (int)simulator->s_yeast_started); 503 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_STARTED", "%d", (int)simulator->s_yeast_started);
494 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_TEMP", "%f", simulator->s_cool_temp); 504 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_TEMP", "%f", simulator->s_cool_temp);
1377 simulator = (simulator_list *)malloc(sizeof(simulator_list)); 1387 simulator = (simulator_list *)malloc(sizeof(simulator_list));
1378 simulator->next = NULL; 1388 simulator->next = NULL;
1379 simulator->uuid = simulator->name = NULL; 1389 simulator->uuid = simulator->name = NULL;
1380 simulator->room_tempaddress = simulator->room_humaddress = simulator->air_address = simulator->beer_address = simulator->beer_address2 = NULL; 1390 simulator->room_tempaddress = simulator->room_humaddress = simulator->air_address = simulator->beer_address = simulator->beer_address2 = NULL;
1381 simulator->chiller_address = simulator->cooler_address = simulator->heater_address = simulator->fan_address = simulator->light_address = NULL; 1391 simulator->chiller_address = simulator->cooler_address = simulator->heater_address = simulator->fan_address = simulator->light_address = NULL;
1392 simulator->door_address = simulator->psu_address = NULL;
1382 simulator->simno = simulator->volume_air = simulator->volume_beer = 0; 1393 simulator->simno = simulator->volume_air = simulator->volume_beer = 0;
1383 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0; 1394 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0;
1384 simulator->chiller_temperature = 1.5; 1395 simulator->chiller_temperature = 1.5;
1385 simulator->room_humidity = 49.2; 1396 simulator->room_humidity = 49.2;
1386 simulator->cooler_temp = simulator->cooler_size = simulator->heater_temp = simulator->heater_size = simulator->frigo_isolation = 0.0; 1397 simulator->cooler_temp = simulator->cooler_size = simulator->heater_temp = simulator->heater_size = simulator->frigo_isolation = 0.0;
1620 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1631 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1621 if (sscanf((const char *)key, "%d", &ival) == 1) 1632 if (sscanf((const char *)key, "%d", &ival) == 1)
1622 simulator->light_power = ival; 1633 simulator->light_power = ival;
1623 xmlFree(key); 1634 xmlFree(key);
1624 } 1635 }
1636 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_ADDRESS"))) {
1637 simulator->door_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1638 }
1639 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_PRESENT"))) {
1640 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1641 for (i = 0; i < 4; i++) {
1642 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) {
1643 simulator->door_present = i;
1644 break;
1645 }
1646 }
1647 xmlFree(key);
1648 }
1649 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DOOR_VALUE"))) {
1650 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1651 if (sscanf((const char *)key, "%d", &ival) == 1)
1652 simulator->door_value = ival;
1653 xmlFree(key);
1654 }
1655 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PSU_ADDRESS"))) {
1656 simulator->psu_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1657 }
1658 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PSU_PRESENT"))) {
1659 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1660 for (i = 0; i < 4; i++) {
1661 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) {
1662 simulator->psu_present = i;
1663 break;
1664 }
1665 }
1666 xmlFree(key);
1667 }
1668 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PSU_VALUE"))) {
1669 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1670 if (sscanf((const char *)key, "%d", &ival) == 1)
1671 simulator->psu_value = ival;
1672 xmlFree(key);
1673 }
1625 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIGO_ISOLATION"))) { 1674 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIGO_ISOLATION"))) {
1626 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1675 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1627 if (sscanf((const char *)key, "%f", &fval) == 1) 1676 if (sscanf((const char *)key, "%f", &fval) == 1)
1628 simulator->frigo_isolation = fval; 1677 simulator->frigo_isolation = fval;
1629 xmlFree(key); 1678 xmlFree(key);

mercurial