Exemplo n.º 1
0
        $keep = 0;
    }
    $debug = 1;
    $s = enumerate_w1_sensors(0, $keep);
    passthru("cat " . SENSORMAPFILE);
    exit(0);
}
$ltt = time() - SENSORPOLLTIME - 1;
$minmax = array();
xap_connect();
while (1) {
    if ($must_exit) {
        break;
    }
    //send xAP heartbeat periodically
    $t = floor(xap_check_send_heartbeat());
    //and return time in secs
    if ($t - $ltt >= SENSORPOLLTIME) {
        $tsent = send_data();
        $ltt = $t;
    }
    if ($must_exit) {
        break;
    }
    sleep(1);
    if ($must_exit) {
        break;
    }
    sleep(1);
    if ($must_exit) {
        break;
Exemplo n.º 2
0
xap_connect();
//use this to set up the listener and register with the hub
$b = '';
$os = '';
$is = '';
$ip = '';
$il = '';
$di = '';
$do1 = '';
$do2 = '';
while (1) {
    if ($must_exit) {
        break;
    }
    //send xAP heartbeat periodically
    $t = xap_check_send_heartbeat(array(XAPUID_IO_IN, XAPUID_IO_OUT, XAPUID_DMX_IN1, XAPUID_DMX_OUT1, XAPUID_DMX_OUT2), array(XAPSRC_IO_IN, XAPSRC_IO_OUT, XAPSRC_DMX_IN1, XAPSRC_DMX_OUT1, XAPSRC_DMX_OUT2));
    io_read_shared_memory($io_shm_id, $out_states, $in_states, $in_programs, $in_levels);
    dmx_read_shared_memory($dmx_shm_id, $dmx_inputs, $dmx_outputs1, $dmx_outputs2);
    if ($xap = xap_listen($b)) {
        if ($debug & MSG_DEBUG_ID) {
            print_r($xap);
        }
        $c = process_xap_msgs($xap);
    }
    if ($os . $is . $ip . $il != $out_states . $in_states . $in_programs . $in_levels) {
        if ($debug & IO_DEBUG_ID) {
            logformat("Current IO State:\n");
            logformat(sprintf("Out States :%s\n", $out_states));
            logformat(sprintf("In States  :%s\n", $in_states));
            logformat(sprintf("In Programs:%s\n", $in_programs));
            logformat(sprintf("In Levels  :%s\n", $in_levels));