示例#1
0
function updNameAndTimerAfterOnDevice($mac, &$s20Table)
{
    //
    // Updates the name and "switch Off timer" on
    // $s20Table. Information retrieved from table 4.
    //
    subscribe($mac, $s20Table);
    $table = 4;
    $vflag = "17";
    $recTable = getTable($mac, $table, $vflag, $s20Table);
    // Upd Name
    $binTable = hex_str2byte($recTable);
    $name = substr($binTable, 70, 16);
    $s20Table[$mac]['name'] = trim($name);
    // Upd automatic timer switch off after on
    $timerSetString = substr($recTable, 164 * 2, 2);
    $timerValString = substr($recTable, 166 * 2, 4);
    $timerValString = invertEndian($timerValString);
    if ($timerSetString == "00") {
        $timerVal = 0;
    } else {
        $timerVal = hexdec($timerValString);
    }
    if (DEBUG) {
        echo "Timer Set=" . $timerSetString . " Val= " . $timerValString . " dec = " . $timerVal . "\n";
    }
    $s20Table[$mac]['switchOffTimer'] = $timerVal;
}
示例#2
0
文件: orvfms.php 项目: vb2cans/orvfms
function getName($mac, $s20Table)
{
    //
    // Returns the registered name in S20 specified by the mac $mac.
    // Uses previous device information available in $s20Table.
    //
    subscribe($mac, $s20Table);
    $table = 4;
    $vflag = "17";
    $recTable = getTable($mac, $table, $vflag, $s20Table);
    $binTable = hex_str2byte($recTable);
    $name = substr($binTable, 70, 16);
    return trim($name);
}