";
echo "
";
// CSS definitions
?>
\n";
echo "\n";
?>
";
echo "";
echo "";
echo "
";
echo "
";
echo "";
echo "";
}
else {
// Result
$result = "";
// Start
$start = microtime_float();
// Specific customer
$customer = "";
if ((isset($_GET['customer'])) && ($_GET['customer'] != -1)) {
$customer = " AND klant=" . (int)$_GET['customer'];
}
// Specific project
$project = "";
if ((isset($_GET['project'])) && ($_GET['project'] != -1)) {
$project = " AND id=" . (int)$_GET['project'];
}
// Get all released/ready for releas rc projects
$projects = array_sort(db_fetch("project", '*', "(sstatus='vrijgegeven' OR sstatus='verzoek tot vrijgeven') AND type='RC' AND parent IS NULL" . $customer . $project), "naam");
if (is_array($projects)) {
$equip = array();
$equip_id = array();
// Collect all devices
foreach($projects as $project) {
// Retrieve available active equipment on this project
$project_equip = db_fetch_project_lances($project['id'], "", array(array("gsm","gprs"),"kortsluiting schakelen","meting"), 1, array("actief"), array("actief"));
if (is_array($project_equip)) {
foreach($project_equip as $item) {
if (!in_array($item['id'], $equip_id)) {
array_push($equip, $item);
array_push($equip_id, $item['id']);
}
}
}
}
// Get non-cached status
$equip = tcpclient_non_cached_status($equip, FALSE, (2 * TCP_TIMEOUT));
foreach($projects as $project) {
// Retrieve available active equipment on this project
$project_equip = db_fetch_project_lances($project['id'], "", array(array("gsm","gprs"),"kortsluiting schakelen","meting"), 1, array("actief"), array("actief"));
// Get customer info
$project_cust = db_fetch_customer($project['klant'], 1);
$result .= " " . $project['naam'] . " (" . $project_cust['bedrijfsnaam'] . ")
";
if (is_array($project_equip)) {
foreach($project_equip as $item) {
$pos = array_search($item['id'], $equip_id);
if ($pos !== FALSE) {
if ($equip[$pos]['found']) {
// Get measurement
$measurement = ($equip[$pos]['status']['mcu']['status'] & 0x0001) == 0x0001;
// Get switch status (Switch = 1 => Short circuit = 1!!!! (non-inverted))
$switch = $equip[$pos]['status']['switch3000']['on'];
$switchErr = (($equip[$pos]['status']['mcu']['switch3000 status'] & 0xF0) != 0);
// Get key (0: operational, 1: on, 2:off)
$key = ($equip[$pos]['status']['switch3000']['key']['on']) ? 1 : (($equip[$pos]['status']['switch3000']['key']['off']) ? 2 : 0);
// Get battery values
$batt_main = $equip[$pos]['status']['batt']['1']['V'];
$batt_backup = $equip[$pos]['status']['batt']['0']['V'];
// Detection?
switch(($equip[$pos]['status']['detection']['ok']) . $switch) {
case "11":
$detection = 1;
break;
default:
$detection = 0;
break;
}
$result .= " " . $item['idcode'];
$result .= ", " . $item['serienr'];
$result .= ", Measurement: " . (($measurement) ? "ON" : "OFF");
$result .= ", Detection: " . (($detection) ? "OK" : "NOK");
$result .= ", Switch: " . (!$switchErr ? (($switch) ? "ON" : "OFF") : "ERROR" );
$result .= ", Keyswitch: ";
switch($key) {
case 1:
$result .= "On";
break;
case 2:
$result .= "Off";
break;
default:
$result .= "Operational";
break;
}
$result .= ", Battery main: " . $batt_main . " [V]";
$result .= ", Battery backup: " . $batt_backup . " [V]";
$result .= "
";
}
else {
$result .= " " . $item['idcode'] . ": No status response withing 6 secs
";
}
}
else {
$result .= " " . $item['idcode'] . ": Error
";
}
}
}
else {
$result .= " No RC devices on this project
";
}
}
}
else {
$result .= "No released RC projects!!!
";
}
echo "Date/Time: " . date('Y-m-d H:i:s') . "
";
$exec = (microtime_float() - $start);
echo "Execution time: " . $exec . "
";
echo $result;
// Debug info
DBG("Booster Active; Execution time: " . $exec . ", Customer: " . (int)$_GET['customer'] . ", Project: " . (int)$_GET['project']);
}
?>