Exemple #1
0
 public function shouldDestroy()
 {
     if (!$this->oHTTPClient && time() - $this->iHTTPDisconnected > 10) {
         AirD::Log(AirD::LOGTYPE_IRC, "Disconnected IRC session or abandoned IRC session (TS: " . $this->iHTTPDisconnected . ")");
         $this->Destroy();
         return true;
     }
     return parent::shouldDestroy();
 }
<?php

require './lib/socket.class.php';
require './lib/socketClient.class.php';
$socket = new socketClient('127.0.0.1', 54321);
$packet = array('controller' => 'index', 'action' => 'index', 'subaction' => '', 'subaction_id' => '', 'time' => time(), 'ip' => $_SERVER['SERVER_ADDR']);
$response = $socket->send(json_encode($packet));
$socket->report();
//echo $response;
//echo '<pre>'.print_r($socket, true).'</pre>';
Exemple #3
0
<?php

require './socket.php';
require './socketClient.php';
$socket = new socketClient('179.156.26.52', 8001);
//$packet = array('Pablo'    => 'Muito VIADO',
//                );
//$response = $socket->send(json_encode($packet));
//
$packet1 = array('comando' => '0', 'sp' => true, 'pv' => true, 'mv' => true);
print_r($socket->send(json_encode($packet1)));
//$packet2 = array('OP' => '1',
//    'sensor' => '1',
//);
//$response .= $socket->send(json_encode($packet2));
//
//$packet3 = array('OP' => '2',
//    'tanque' => '2',
//    'altura' => '20',
//);
//$response .= $socket->send(json_encode($packet3));
//
//$packet4 = array('OP' => '0',
//    'tensao' => '8.0',
//);
//$response .= $socket->send(json_encode($packet4));
//print_r($conn->comandar("{'OP': '0', 'tensao':'2.3'}"));
//print_r($conn->comandar("{'OP': '1', 'sensor':'1'}"));
//print_r($conn->comandar("{'OP': '2', 'tanque':'2', 'altura':'20'}"));
//print_r($conn->comandar("{'OP': '0', 'tensao':'8.0'}"));
//print_r($conn->comandar("{'OP': '1', 'sensor':'2'}"));
Exemple #4
0
<?php

require './socket.php';
require './socketClient.php';
//$socket = new socketClient('10.13.100.68', 8001);
$socket = new socketClient('179.156.26.52', 8002);
//
//if (isset($_GET['sensor'])) {
//    echo 'ok';
////    $packet = array('OP' => '1','sensor' => '1',);
////    echo $socket->send(json_encode($packet));
//}
//
////setando valor de tensão para a bomba
//if (isset($_GET['bomba'])) {
//    if (isset($_GET['tensao'])) {
//        $setPoint = $_GET['tensao'];
//
//        //enviando o comando para o servidor
//        $packet = array(
//            'OP' => '0',
//            'tensao' => '' . $setPoint . '',
//        );
//        $socket->send(json_encode($packet));
//        echo json_encode(floatval($setPoint));
//    }
//}
//
//if (isset($_GET['tanque'])) {
//    if (isset($_GET['nivel'])) {
//        $setPoint = $_GET['nivel'];