428 xmlTextWriterStartElement(writer, BAD_CAST "SIMULATORS"); |
448 xmlTextWriterStartElement(writer, BAD_CAST "SIMULATORS"); |
429 for (simulator = Config.simulators; simulator; simulator = simulator->next) { |
449 for (simulator = Config.simulators; simulator; simulator = simulator->next) { |
430 xmlTextWriterStartElement(writer, BAD_CAST "SIMULATOR"); |
450 xmlTextWriterStartElement(writer, BAD_CAST "SIMULATOR"); |
431 xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", simulator->uuid); |
451 xmlTextWriterWriteFormatElement(writer, BAD_CAST "UUID", "%s", simulator->uuid); |
432 xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", simulator->name); |
452 xmlTextWriterWriteFormatElement(writer, BAD_CAST "NAME", "%s", simulator->name); |
|
453 xmlTextWriterWriteFormatElement(writer, BAD_CAST "SIMNO", "%d", simulator->simno); |
433 xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_AIR", "%d", simulator->volume_air); |
454 xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_AIR", "%d", simulator->volume_air); |
434 xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_BEER", "%d", simulator->volume_beer); |
455 xmlTextWriterWriteFormatElement(writer, BAD_CAST "VOLUME_BEER", "%d", simulator->volume_beer); |
|
456 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPADDRESS", "%s", simulator->room_tempaddress); |
435 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPERATURE", "%.1f", simulator->room_temperature); |
457 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPERATURE", "%.1f", simulator->room_temperature); |
|
458 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_HUMADDRESS", "%s", simulator->room_humaddress); |
436 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_HUMIDITY", "%.1f", simulator->room_humidity); |
459 xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_HUMIDITY", "%.1f", simulator->room_humidity); |
|
460 xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_ADDRESS", "%s", simulator->air_address); |
437 xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%f", simulator->air_temperature); |
461 xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%f", simulator->air_temperature); |
|
462 xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_PRESENT", "%s", DEVPRESENT[simulator->air_present]); |
|
463 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_ADDRESS", "%s", simulator->beer_address); |
438 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%f", simulator->beer_temperature); |
464 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%f", simulator->beer_temperature); |
|
465 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_PRESENT", "%s", DEVPRESENT[simulator->beer_present]); |
|
466 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_ADDRESS2", "%s", simulator->beer_address2); |
|
467 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE2", "%f", simulator->beer_temperature2); |
|
468 xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_PRESENT2", "%s", DEVPRESENT[simulator->beer_present2]); |
|
469 xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_ADDRESS", "%s", simulator->chiller_address); |
439 xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_TEMPERATURE", "%f", simulator->chiller_temperature); |
470 xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_TEMPERATURE", "%f", simulator->chiller_temperature); |
|
471 xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_PRESENT", "%s", DEVPRESENT[simulator->chiller_present]); |
|
472 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_ADDRESS", "%s", simulator->cooler_address); |
440 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TEMP", "%f", simulator->cooler_temp); |
473 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TEMP", "%f", simulator->cooler_temp); |
441 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TIME", "%d", simulator->cooler_time); |
474 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TIME", "%d", simulator->cooler_time); |
442 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_SIZE", "%.3f", simulator->cooler_size); |
475 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_SIZE", "%.3f", simulator->cooler_size); |
|
476 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_PRESENT", "%s", DEVPRESENT[simulator->cooler_present]); |
|
477 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_POWER", "%d", simulator->cooler_power); |
|
478 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_ADDRESS", "%s", simulator->heater_address); |
443 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TEMP", "%f", simulator->heater_temp); |
479 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TEMP", "%f", simulator->heater_temp); |
444 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TIME", "%d", simulator->heater_time); |
480 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_TIME", "%d", simulator->heater_time); |
445 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_SIZE", "%.3f", simulator->heater_size); |
481 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_SIZE", "%.3f", simulator->heater_size); |
446 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_STATE", "%d", simulator->heater_state); |
482 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_PRESENT", "%s", DEVPRESENT[simulator->heater_present]); |
447 xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_STATE", "%d", simulator->cooler_state); |
483 xmlTextWriterWriteFormatElement(writer, BAD_CAST "HEATER_POWER", "%d", simulator->heater_power); |
|
484 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_ADDRESS", "%s", simulator->fan_address); |
|
485 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_PRESENT", "%s", DEVPRESENT[simulator->fan_present]); |
|
486 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FAN_POWER", "%d", simulator->fan_power); |
|
487 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_ADDRESS", "%s", simulator->light_address); |
|
488 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_PRESENT", "%s", DEVPRESENT[simulator->light_present]); |
|
489 xmlTextWriterWriteFormatElement(writer, BAD_CAST "LIGHT_POWER", "%d", simulator->light_power); |
448 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIGO_ISOLATION", "%.3f", simulator->frigo_isolation); |
490 xmlTextWriterWriteFormatElement(writer, BAD_CAST "FRIGO_ISOLATION", "%.3f", simulator->frigo_isolation); |
|
491 xmlTextWriterWriteFormatElement(writer, BAD_CAST "TIMESTAMP", "%ld", (long)simulator->timestamp); |
449 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_HEAT", "%f", simulator->s_yeast_heat); |
492 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_HEAT", "%f", simulator->s_yeast_heat); |
450 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_STARTED", "%d", (int)simulator->s_yeast_started); |
493 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_YEAST_STARTED", "%d", (int)simulator->s_yeast_started); |
451 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_TEMP", "%f", simulator->s_cool_temp); |
494 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_TEMP", "%f", simulator->s_cool_temp); |
452 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HEAT_TEMP", "%f", simulator->s_heat_temp); |
495 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_HEAT_TEMP", "%f", simulator->s_heat_temp); |
453 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_CHANGED", "%d", (int)simulator->s_cool_changed); |
496 xmlTextWriterWriteFormatElement(writer, BAD_CAST "S_COOL_CHANGED", "%d", (int)simulator->s_cool_changed); |
1326 #ifdef USE_SIMULATOR |
1369 #ifdef USE_SIMULATOR |
1327 int parseSimulator(xmlDocPtr doc, xmlNodePtr cur) |
1370 int parseSimulator(xmlDocPtr doc, xmlNodePtr cur) |
1328 { |
1371 { |
1329 xmlChar *key; |
1372 xmlChar *key; |
1330 simulator_list *simulator, *tmp; |
1373 simulator_list *simulator, *tmp; |
1331 int ival; |
1374 int ival, i; |
1332 float fval; |
1375 float fval; |
1333 |
1376 |
1334 simulator = (simulator_list *)malloc(sizeof(simulator_list)); |
1377 simulator = (simulator_list *)malloc(sizeof(simulator_list)); |
1335 simulator->next = NULL; |
1378 simulator->next = NULL; |
1336 simulator->uuid = simulator->name = NULL; |
1379 simulator->uuid = simulator->name = NULL; |
1337 simulator->volume_air = simulator->volume_beer = 0; |
1380 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; |
|
1382 simulator->simno = simulator->volume_air = simulator->volume_beer = 0; |
1338 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0; |
1383 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0; |
1339 simulator->chiller_temperature = 1.5; |
1384 simulator->chiller_temperature = 1.5; |
1340 simulator->room_humidity = 49.2; |
1385 simulator->room_humidity = 49.2; |
1341 simulator->cooler_temp = simulator->cooler_size = simulator->heater_temp = simulator->heater_size = simulator->frigo_isolation = 0.0; |
1386 simulator->cooler_temp = simulator->cooler_size = simulator->heater_temp = simulator->heater_size = simulator->frigo_isolation = 0.0; |
1342 simulator->cooler_time = simulator->heater_time = simulator->cooler_state = simulator->heater_state = 0; |
1387 simulator->cooler_time = simulator->heater_time = 0; |
|
1388 simulator->air_present = simulator->beer_present = DEVPRESENT_YES; |
|
1389 simulator->beer_present2 = simulator->chiller_present = simulator->cooler_present = simulator->heater_present = DEVPRESENT_UNDEF; |
1343 simulator->s_yeast_started = simulator->s_cool_changed = simulator->s_heat_changed = (time_t)0; |
1390 simulator->s_yeast_started = simulator->s_cool_changed = simulator->s_heat_changed = (time_t)0; |
1344 simulator->s_yeast_heat = simulator->s_cool_temp = simulator->s_heat_temp = 0.0; |
1391 simulator->s_yeast_heat = simulator->s_cool_temp = simulator->s_heat_temp = 0.0; |
1345 |
1392 |
1346 cur = cur->xmlChildrenNode; |
1393 cur = cur->xmlChildrenNode; |
1347 while (cur != NULL) { |
1394 while (cur != NULL) { |
1361 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1414 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1362 if (sscanf((const char *)key, "%d", &ival) == 1) |
1415 if (sscanf((const char *)key, "%d", &ival) == 1) |
1363 simulator->volume_beer = ival; |
1416 simulator->volume_beer = ival; |
1364 xmlFree(key); |
1417 xmlFree(key); |
1365 } |
1418 } |
|
1419 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_TEMPADDRESS"))) { |
|
1420 simulator->room_tempaddress = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1421 } |
1366 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_TEMPERATURE"))) { |
1422 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_TEMPERATURE"))) { |
1367 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1423 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1368 if (sscanf((const char *)key, "%f", &fval) == 1) |
1424 if (sscanf((const char *)key, "%f", &fval) == 1) |
1369 simulator->room_temperature = fval; |
1425 simulator->room_temperature = fval; |
1370 xmlFree(key); |
1426 xmlFree(key); |
1371 } |
1427 } |
1372 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_GUMIDITY"))) { |
1428 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_HUMADDRESS"))) { |
|
1429 simulator->room_humaddress = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1430 } |
|
1431 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_HUMIDITY"))) { |
1373 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1432 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1374 if (sscanf((const char *)key, "%f", &fval) == 1) |
1433 if (sscanf((const char *)key, "%f", &fval) == 1) |
1375 simulator->room_humidity= fval; |
1434 simulator->room_humidity= fval; |
1376 xmlFree(key); |
1435 xmlFree(key); |
1377 } |
1436 } |
|
1437 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_ADDRESS"))) { |
|
1438 simulator->air_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1439 } |
1378 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_TEMPERATURE"))) { |
1440 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_TEMPERATURE"))) { |
1379 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1441 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1380 if (sscanf((const char *)key, "%f", &fval) == 1) |
1442 if (sscanf((const char *)key, "%f", &fval) == 1) |
1381 simulator->air_temperature = fval; |
1443 simulator->air_temperature = fval; |
1382 xmlFree(key); |
1444 xmlFree(key); |
1383 } |
1445 } |
|
1446 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_PRESENT"))) { |
|
1447 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1448 for (i = 0; i < 4; i++) { |
|
1449 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
|
1450 simulator->air_present = i; |
|
1451 break; |
|
1452 } |
|
1453 } |
|
1454 xmlFree(key); |
|
1455 } |
|
1456 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_ADDRESS"))) { |
|
1457 simulator->beer_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1458 } |
1384 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_TEMPERATURE"))) { |
1459 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_TEMPERATURE"))) { |
1385 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1460 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1386 if (sscanf((const char *)key, "%f", &fval) == 1) |
1461 if (sscanf((const char *)key, "%f", &fval) == 1) |
1387 simulator->beer_temperature = fval; |
1462 simulator->beer_temperature = fval; |
1388 xmlFree(key); |
1463 xmlFree(key); |
1389 } |
1464 } |
|
1465 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_PRESENT"))) { |
|
1466 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1467 for (i = 0; i < 4; i++) { |
|
1468 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
|
1469 simulator->beer_present = i; |
|
1470 break; |
|
1471 } |
|
1472 } |
|
1473 xmlFree(key); |
|
1474 } |
|
1475 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_ADDRESS2"))) { |
|
1476 simulator->beer_address2 = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1477 } |
|
1478 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_TEMPERATURE2"))) { |
|
1479 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1480 if (sscanf((const char *)key, "%f", &fval) == 1) |
|
1481 simulator->beer_temperature2 = fval; |
|
1482 xmlFree(key); |
|
1483 } |
|
1484 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_PRESENT2"))) { |
|
1485 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1486 for (i = 0; i < 4; i++) { |
|
1487 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
|
1488 simulator->beer_present2 = i; |
|
1489 break; |
|
1490 } |
|
1491 } |
|
1492 xmlFree(key); |
|
1493 } |
|
1494 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_ADDRESS"))) { |
|
1495 simulator->chiller_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1496 } |
1390 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_TEMPERATURE"))) { |
1497 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_TEMPERATURE"))) { |
1391 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1498 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1392 if (sscanf((const char *)key, "%f", &fval) == 1) |
1499 if (sscanf((const char *)key, "%f", &fval) == 1) |
1393 simulator->chiller_temperature = fval; |
1500 simulator->chiller_temperature = fval; |
1394 xmlFree(key); |
1501 xmlFree(key); |
1395 } |
1502 } |
|
1503 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_PRESENT"))) { |
|
1504 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1505 for (i = 0; i < 4; i++) { |
|
1506 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
|
1507 simulator->chiller_present = i; |
|
1508 break; |
|
1509 } |
|
1510 } |
|
1511 xmlFree(key); |
|
1512 } |
|
1513 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_ADDRESS"))) { |
|
1514 simulator->cooler_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1515 } |
1396 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_TEMP"))) { |
1516 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_TEMP"))) { |
1397 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1517 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1398 if (sscanf((const char *)key, "%f", &fval) == 1) |
1518 if (sscanf((const char *)key, "%f", &fval) == 1) |
1399 simulator->cooler_temp = fval; |
1519 simulator->cooler_temp = fval; |
1400 xmlFree(key); |
1520 xmlFree(key); |
1427 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1566 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1428 if (sscanf((const char *)key, "%f", &fval) == 1) |
1567 if (sscanf((const char *)key, "%f", &fval) == 1) |
1429 simulator->heater_size = fval; |
1568 simulator->heater_size = fval; |
1430 xmlFree(key); |
1569 xmlFree(key); |
1431 } |
1570 } |
1432 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_STATE"))) { |
1571 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_PRESENT"))) { |
1433 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1572 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1434 if (sscanf((const char *)key, "%d", &ival) == 1) |
1573 for (i = 0; i < 4; i++) { |
1435 simulator->heater_state = ival; |
1574 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
1436 xmlFree(key); |
1575 simulator->heater_present = i; |
1437 } |
1576 break; |
1438 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_STATE"))) { |
1577 } |
1439 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1578 } |
1440 if (sscanf((const char *)key, "%d", &ival) == 1) |
1579 xmlFree(key); |
1441 simulator->cooler_state = ival; |
1580 } |
1442 xmlFree(key); |
1581 if ((!xmlStrcmp(cur->name, (const xmlChar *)"HEATER_POWER"))) { |
1443 } |
1582 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1583 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
1584 simulator->heater_power = ival; |
|
1585 xmlFree(key); |
|
1586 } |
|
1587 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_ADDRESS"))) { |
|
1588 simulator->fan_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1589 } |
|
1590 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_PRESENT"))) { |
|
1591 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1592 for (i = 0; i < 4; i++) { |
|
1593 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
|
1594 simulator->fan_present = i; |
|
1595 break; |
|
1596 } |
|
1597 } |
|
1598 xmlFree(key); |
|
1599 } |
|
1600 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FAN_POWER"))) { |
|
1601 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1602 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
1603 simulator->fan_power = ival; |
|
1604 xmlFree(key); |
|
1605 } |
|
1606 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIGHT_ADDRESS"))) { |
|
1607 simulator->light_address = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1608 } |
|
1609 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIGHT_PRESENT"))) { |
|
1610 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1611 for (i = 0; i < 4; i++) { |
|
1612 if (! xmlStrcmp(key, (const xmlChar *)DEVPRESENT[i])) { |
|
1613 simulator->light_present = i; |
|
1614 break; |
|
1615 } |
|
1616 } |
|
1617 xmlFree(key); |
|
1618 } |
|
1619 if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIGHT_POWER"))) { |
|
1620 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1621 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
1622 simulator->light_power = ival; |
|
1623 xmlFree(key); |
|
1624 } |
1444 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIGO_ISOLATION"))) { |
1625 if ((!xmlStrcmp(cur->name, (const xmlChar *)"FRIGO_ISOLATION"))) { |
1445 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1626 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1446 if (sscanf((const char *)key, "%f", &fval) == 1) |
1627 if (sscanf((const char *)key, "%f", &fval) == 1) |
1447 simulator->frigo_isolation = fval; |
1628 simulator->frigo_isolation = fval; |
1448 xmlFree(key); |
1629 xmlFree(key); |
1449 } |
1630 } |
|
1631 if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMESTAMP"))) { |
|
1632 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1633 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
1634 simulator->timestamp = ival; |
|
1635 xmlFree(key); |
|
1636 } |
1450 |
1637 |
1451 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_YEAST_HEAT"))) { |
1638 if ((!xmlStrcmp(cur->name, (const xmlChar *)"S_YEAST_HEAT"))) { |
1452 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1639 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
1453 if (sscanf((const char *)key, "%f", &fval) == 1) |
1640 if (sscanf((const char *)key, "%f", &fval) == 1) |
1454 simulator->s_yeast_heat = fval; |
1641 simulator->s_yeast_heat = fval; |