コード例 #1
0
 private function setAttatched($attatched)
 {
     $this->_isAttatched = $attatched;
     if ($this->_isAttatched) {
         echo "Attatched to xPL-network\n";
         //			timer->setInterval( 60000 ); //Once a minute
         $message = new xPLMessage(xPLMessage::xplcmnd);
         $message->setTarget("*");
         $message->setSource($this->_thisDevice->deviceName());
         $message->setMessageSchemeIdentifier('hbeat.request');
         $message->addBodyItem('command', 'request');
         $this->sendMessage($message);
         $this->attatchedToNetwork();
     }
 }
コード例 #2
0
 public static function createMessageFromString($message)
 {
     $lines = explode("\n", $message);
     $row = 0;
     $i = 0;
     if ($lines[$row] == 'xpl-cmnd') {
         $i = self::xplcmnd;
     } else {
         if ($lines[$row] == 'xpl-stat') {
             $i = self::xplstat;
         } else {
             if ($lines[$row] == 'xpl-trig') {
                 $i = self::xpltrig;
             } else {
                 return 0;
             }
         }
     }
     ++$row;
     if ($lines[$row] != '{') {
         return 0;
     }
     ++$row;
     $msg = new xPLMessage($i);
     for (; $row < count($lines) && $lines[$row] != '}'; ++$row) {
         list($name, $value) = explode('=', $lines[$row]);
         $msg->addHeadItem($name, $value);
     }
     if ($row >= count($lines)) {
         return 0;
     }
     ++$row;
     $msg->setMessageSchemeIdentifier($lines[$row]);
     ++$row;
     if ($lines[$row] != '{') {
         return 0;
     }
     ++$row;
     for (; $row < count($lines) && $lines[$row] != '}'; ++$row) {
         list($name, $value) = explode('=', $lines[$row]);
         $msg->addBodyItem($name, $value);
     }
     return $msg;
 }
コード例 #3
0
 private function scnInfo($message)
 {
     $msg = new xPLMessage(xPLMessage::xplstat);
     $msg->setMessageSchemeIdentifier('lighting.scninfo');
     $msg->addBodyItem('network', $message->bodyItem('network'));
     $msg->addBodyItem('scene', $message->bodyItem('scene'));
     $msg->setTarget('*');
     $msg->setSource($this->_thisDevice->deviceName());
     $msg->addBodyItem('status', 'not-found');
     $this->sendMessage($msg);
     return true;
 }