thermferm/server.c

changeset 715
f5d85af156ab
parent 714
24749c296a50
child 716
5c30c8ef83a8
equal deleted inserted replaced
714:24749c296a50 715:f5d85af156ab
1282 for (i = 0; i < 4; i++) { 1282 for (i = 0; i < 4; i++) {
1283 if (strcmp(val, DEVPRESENT[i]) == 0) { 1283 if (strcmp(val, DEVPRESENT[i]) == 0) {
1284 if (simulator->air_present != i) 1284 if (simulator->air_present != i)
1285 syslog(LOG_NOTICE, "Simulator %s air_present %s to %s", simulator->uuid, DEVPRESENT[simulator->air_present], DEVPRESENT[i]); 1285 syslog(LOG_NOTICE, "Simulator %s air_present %s to %s", simulator->uuid, DEVPRESENT[simulator->air_present], DEVPRESENT[i]);
1286 simulator->air_present = i; 1286 simulator->air_present = i;
1287 device_present(simulator->air_address, i);
1287 break; 1288 break;
1288 } 1289 }
1289 } 1290 }
1290 1291
1291 } else if (strcmp(kwd, (char *)"BEER_TEMPERATURE") == 0) { 1292 } else if (strcmp(kwd, (char *)"BEER_TEMPERATURE") == 0) {
1299 for (i = 0; i < 4; i++) { 1300 for (i = 0; i < 4; i++) {
1300 if (strcmp(val, DEVPRESENT[i]) == 0) { 1301 if (strcmp(val, DEVPRESENT[i]) == 0) {
1301 if (simulator->beer_present != i) 1302 if (simulator->beer_present != i)
1302 syslog(LOG_NOTICE, "Simulator %s beer_present %s to %s", simulator->uuid, DEVPRESENT[simulator->beer_present], DEVPRESENT[i]); 1303 syslog(LOG_NOTICE, "Simulator %s beer_present %s to %s", simulator->uuid, DEVPRESENT[simulator->beer_present], DEVPRESENT[i]);
1303 simulator->beer_present = i; 1304 simulator->beer_present = i;
1305 device_present(simulator->beer_address, i);
1304 break; 1306 break;
1305 } 1307 }
1306 } 1308 }
1307 1309
1308 } else if (strcmp(kwd, (char *)"BEER_TEMPERATURE2") == 0) { 1310 } else if (strcmp(kwd, (char *)"BEER_TEMPERATURE2") == 0) {
1316 for (i = 0; i < 4; i++) { 1318 for (i = 0; i < 4; i++) {
1317 if (strcmp(val, DEVPRESENT[i]) == 0) { 1319 if (strcmp(val, DEVPRESENT[i]) == 0) {
1318 if (simulator->beer_present2 != i) 1320 if (simulator->beer_present2 != i)
1319 syslog(LOG_NOTICE, "Simulator %s beer_present2 %s to %s", simulator->uuid, DEVPRESENT[simulator->beer_present2], DEVPRESENT[i]); 1321 syslog(LOG_NOTICE, "Simulator %s beer_present2 %s to %s", simulator->uuid, DEVPRESENT[simulator->beer_present2], DEVPRESENT[i]);
1320 simulator->beer_present2 = i; 1322 simulator->beer_present2 = i;
1323 device_present(simulator->beer_address2, i);
1321 break; 1324 break;
1322 } 1325 }
1323 } 1326 }
1324 1327
1325 } else if (strcmp(kwd, (char *)"CHILLER_TEMPERATURE") == 0) { 1328 } else if (strcmp(kwd, (char *)"CHILLER_TEMPERATURE") == 0) {
1333 for (i = 0; i < 4; i++) { 1336 for (i = 0; i < 4; i++) {
1334 if (strcmp(val, DEVPRESENT[i]) == 0) { 1337 if (strcmp(val, DEVPRESENT[i]) == 0) {
1335 if (simulator->chiller_present != i) 1338 if (simulator->chiller_present != i)
1336 syslog(LOG_NOTICE, "Simulator %s chiller_present %s to %s", simulator->uuid, DEVPRESENT[simulator->chiller_present], DEVPRESENT[i]); 1339 syslog(LOG_NOTICE, "Simulator %s chiller_present %s to %s", simulator->uuid, DEVPRESENT[simulator->chiller_present], DEVPRESENT[i]);
1337 simulator->chiller_present = i; 1340 simulator->chiller_present = i;
1341 device_present(simulator->chiller_address, i);
1338 break; 1342 break;
1339 } 1343 }
1340 } 1344 }
1341 1345
1342 } else if (strcmp(kwd, (char *)"COOLER_TEMP") == 0) { 1346 } else if (strcmp(kwd, (char *)"COOLER_TEMP") == 0) {
1364 for (i = 0; i < 4; i++) { 1368 for (i = 0; i < 4; i++) {
1365 if (strcmp(val, DEVPRESENT[i]) == 0) { 1369 if (strcmp(val, DEVPRESENT[i]) == 0) {
1366 if (simulator->cooler_present != i) 1370 if (simulator->cooler_present != i)
1367 syslog(LOG_NOTICE, "Simulator %s cooler_present %s to %s", simulator->uuid, DEVPRESENT[simulator->cooler_present], DEVPRESENT[i]); 1371 syslog(LOG_NOTICE, "Simulator %s cooler_present %s to %s", simulator->uuid, DEVPRESENT[simulator->cooler_present], DEVPRESENT[i]);
1368 simulator->cooler_present = i; 1372 simulator->cooler_present = i;
1373 device_present(simulator->cooler_address, i);
1369 break; 1374 break;
1370 } 1375 }
1371 } 1376 }
1372 1377
1373 } else if (strcmp(kwd, (char *)"COOLER_POWER") == 0) { 1378 } else if (strcmp(kwd, (char *)"COOLER_POWER") == 0) {
1402 for (i = 0; i < 4; i++) { 1407 for (i = 0; i < 4; i++) {
1403 if (strcmp(val, DEVPRESENT[i]) == 0) { 1408 if (strcmp(val, DEVPRESENT[i]) == 0) {
1404 if (simulator->heater_present != i) 1409 if (simulator->heater_present != i)
1405 syslog(LOG_NOTICE, "Simulator %s heater_present %s to %s", simulator->uuid, DEVPRESENT[simulator->heater_present], DEVPRESENT[i]); 1410 syslog(LOG_NOTICE, "Simulator %s heater_present %s to %s", simulator->uuid, DEVPRESENT[simulator->heater_present], DEVPRESENT[i]);
1406 simulator->heater_present = i; 1411 simulator->heater_present = i;
1412 device_present(simulator->heater_address, i);
1407 break; 1413 break;
1408 } 1414 }
1409 } 1415 }
1410 1416
1411 } else if (strcmp(kwd, (char *)"HEATER_POWER") == 0) { 1417 } else if (strcmp(kwd, (char *)"HEATER_POWER") == 0) {
1419 for (i = 0; i < 4; i++) { 1425 for (i = 0; i < 4; i++) {
1420 if (strcmp(val, DEVPRESENT[i]) == 0) { 1426 if (strcmp(val, DEVPRESENT[i]) == 0) {
1421 if (simulator->fan_present != i) 1427 if (simulator->fan_present != i)
1422 syslog(LOG_NOTICE, "Simulator %s fan_present %s to %s", simulator->uuid, DEVPRESENT[simulator->fan_present], DEVPRESENT[i]); 1428 syslog(LOG_NOTICE, "Simulator %s fan_present %s to %s", simulator->uuid, DEVPRESENT[simulator->fan_present], DEVPRESENT[i]);
1423 simulator->fan_present = i; 1429 simulator->fan_present = i;
1430 device_present(simulator->fan_address, i);
1424 break; 1431 break;
1425 } 1432 }
1426 } 1433 }
1427 1434
1428 } else if (strcmp(kwd, (char *)"FAN_POWER") == 0) { 1435 } else if (strcmp(kwd, (char *)"FAN_POWER") == 0) {
1436 for (i = 0; i < 4; i++) { 1443 for (i = 0; i < 4; i++) {
1437 if (strcmp(val, DEVPRESENT[i]) == 0) { 1444 if (strcmp(val, DEVPRESENT[i]) == 0) {
1438 if (simulator->light_present != i) 1445 if (simulator->light_present != i)
1439 syslog(LOG_NOTICE, "Simulator %s light_present %s to %s", simulator->uuid, DEVPRESENT[simulator->light_present], DEVPRESENT[i]); 1446 syslog(LOG_NOTICE, "Simulator %s light_present %s to %s", simulator->uuid, DEVPRESENT[simulator->light_present], DEVPRESENT[i]);
1440 simulator->light_present = i; 1447 simulator->light_present = i;
1448 device_present(simulator->light_address, i);
1441 break; 1449 break;
1442 } 1450 }
1443 } 1451 }
1444 1452
1445 } else if (strcmp(kwd, (char *)"LIGHT_POWER") == 0) { 1453 } else if (strcmp(kwd, (char *)"LIGHT_POWER") == 0) {

mercurial