Esempio n. 1
0
#!/usr/bin/php -q
<?php 
DEFINE('CONTEXT', dirname($_SERVER['SCRIPT_FILENAME']));
include CONTEXT . '/core/_includes/eib-functions.php';
$groupaddr = $argv[1];
$dpt = $argv[2];
if (count($argv) == 4) {
    $rendu = true;
} else {
    $rendu = false;
}
$hexa = exec('eibread -s 127.0.0.1 ' . $groupaddr);
$data = hexdec($hexa);
if (!$rendu) {
    print dptSelectDecode($dpt, $data) . "\n";
} else {
    print decodeState($dpt, $data) . "\n";
}
Esempio n. 2
0
test si equipement déja connu doit etre suivi
*/
$req_sel_eq = "SELECT group_addr,name,dpt FROM knx_equipement where knx_type_equipement_id=2";
//System_Daemon::info("Requete SQL -> ".$req_sel_eq);
$knx_eq = mysql_query($req_sel_eq) or die(mysql_error());
$sniffed = array();
/*
Mise en forme des données dans un tableau pour les manipuler facilement
*/
//System_Daemon::notice("A");
while ($data = mysql_fetch_array($knx_eq)) {
    $sniffed[$data['group_addr']] = array("name" => $data['name'], "dpt" => $data['dpt'], "value" => "", "unite" => getDptUnite($data['dpt']));
}
var_dump($sniffed);
var_dump(json_encode($sniffed, JSON_UNESCAPED_SLASHES));
var_dump(decodeState('9.017', 1447));
echo ":::::::<br>";
echo "<br>";
/* DPT 1 */
echo 'DPT  1.xxx - OK -';
//$data = 0x0; //-> bin : 0 -> Off
$data = 0x80;
//-> bin 1 -> on
echo ' Decode : ' . $data . " - binaire : " . decbin($data) . " - ";
$res = $data;
var_dump($res);
echo dptSelectDecode('1.000', $data);
/* DPT 2 */
echo 'DPT  2.xxx - OK -';
// control type
//$data = 0x2; //-> bin : 10 -> Off