예제 #1
0
 protected function SendDataToParent($Data)
 {
     $DataArray = Array(
         "DataID" => "{79827379-F36E-4ADA-8A95-5F8D1DC92FA9}",
         "Buffer" => utf8_encode($Data)    // Rohdaten müssen noch mit utf8_encode kodiert werden.
         );
     $JSONString = json_encode($DataArray);
     IPS_SendDataToParent($this->InstanceID, $JSONString);
 }
예제 #2
0
 protected function SendDataToParent($LSQData)
 {
     $LSQData->Address = $this->ReadPropertyString('Address');
     // Sende Lock setzen
     if (!$this->lock("ToParent")) {
         throw new Exception("Can not send to LMS-Splitter");
     }
     // Daten senden
     try {
         $ret = IPS_SendDataToParent($this->InstanceID, json_encode(array("DataID" => "{EDDCCB34-E194-434D-93AD-FFDF1B56EF38}", "LSQ" => $LSQData)));
     } catch (Exception $exc) {
         // Senden fehlgeschlagen
         // Sende Lock aufheben
         $this->unlock("ToParent");
         throw new Exception("LMS not reachable");
     }
     // Sende Lock aufheben
     $this->unlock("ToParent");
     return $ret;
 }
예제 #3
0
 protected function SendDataToParent($Data)
 {
     // API-Daten verpacken und dann versenden.
     $JSONString = $Data->ToJSONString('{C2813FBB-CBA1-4A92-8896-C8BC32A82BA4}');
     //        IPS_LogMessage('SendDataToSplitter:'.$this->InstanceID,$JSONString);
     // Daten senden
     IPS_SendDataToParent($this->InstanceID, $JSONString);
     return true;
 }
예제 #4
0
 protected function SendDataToParent($LMSData)
 {
     if (is_array($LMSData->Command)) {
         $Commands = implode(' ', $LMSData->Command);
     } else {
         $Commands = $LMSData->Command;
     }
     if (is_array($LMSData->Data)) {
         $Data = $Commands . ' ' . implode(' ', $LMSData->Data);
     } else {
         $Data = $Commands . ' ' . $LMSData->Data;
     }
     $Data = trim($Data);
     //Semaphore setzen
     if (!$this->lock("ToParent")) {
         throw new Exception("Can not send to LMS", E_USER_NOTICE);
     }
     // Daten senden
     try {
         $ret = IPS_SendDataToParent($this->InstanceID, json_encode(array("DataID" => "{79827379-F36E-4ADA-8A95-5F8D1DC92FA9}", "Buffer" => utf8_encode($Data . chr(0xd)))));
     } catch (Exception $exc) {
         // Senden fehlgeschlagen
         $this->unlock("ToParent");
         throw new Exception("LMS not reachable", E_USER_NOTICE);
     }
     $this->unlock("ToParent");
     return $ret;
 }
예제 #5
0
 protected function SendDataToParent($Data)
 {
     $DataArray = array("DataID" => "{79827379-F36E-4ADA-8A95-5F8D1DC92FA9}", "Buffer" => utf8_encode($Data));
     $JSONString = json_encode($DataArray);
     IPS_SendDataToParent($this->InstanceID, $JSONString);
 }
예제 #6
0
 protected function SendDataToParent($Data)
 {
     // API-Daten verpacken und dann versenden.
     $JSONString = $Data->ToJSONString('{8F47273A-0B69-489E-AF36-F391AE5FBEC0}');
     //        IPS_LogMessage('SendDataToSplitter:'.$this->InstanceID,$JSONString);
     // Daten senden
     return @IPS_SendDataToParent($this->InstanceID, $JSONString);
 }
예제 #7
0
 protected function SendDataToParent($Data)
 {
     //        IPS_LogMessage('SendDataToSerialPort:'.$this->InstanceID,$Data);
     //Parent ok ?
     if (!$this->HasActiveParent()) {
         throw new Exception("Instance has no active Parent.");
     }
     // Frame bauen
     //Laenge bilden
     $len = strlen($Data);
     //Startzeichen
     $frame = chr(0x7e);
     //Laenge
     $frame .= chr(floor($len / 256)) . chr($len % 256);
     //Daten
     $frame .= $Data;
     //Checksum
     $check = 0;
     for ($x = 0; $x < $len; $x++) {
         $check = $check + ord($Data[$x]);
     }
     $check = $check & 0xff;
     $check = 0xff - $check;
     $frame = $frame . chr($check);
     //Semaphore setzen
     if (!$this->lock("ToParent")) {
         throw new Exception("Can not send to Parent");
     }
     // Daten senden
     try {
         IPS_SendDataToParent($this->InstanceID, json_encode(array("DataID" => "{79827379-F36E-4ADA-8A95-5F8D1DC92FA9}", "Buffer" => utf8_encode($frame))));
     } catch (Exception $exc) {
         // Senden fehlgeschlagen
         $this->unlock("ToParent");
         throw new Exception($exc);
     }
     $this->unlock("ToParent");
     return true;
 }
예제 #8
0
 protected function SendDataToParent($data)
 {
     $JSONString = json_encode(array("DataID" => '{79827379-F36E-4ADA-8A95-5F8D1DC92FA9}', "Buffer" => utf8_encode($data)));
     IPS_LogMessage('Logamatic -> Gateway:' . $this->InstanceID, str2hex(utf8_decode($data)));
     // Daten senden
     IPS_SendDataToParent($this->InstanceID, $JSONString);
     return true;
 }
예제 #9
0
 protected function SendDataToParent($data)
 {
     $JSONString = json_encode(array('DataID' => '{0D923A14-D3B4-4F44-A4AB-D2B534693C35}', 'Buffer' => utf8_encode($data)));
     IPS_LogMessage('Logamatic -> Gateway:', str2hex(utf8_decode($data)));
     // Daten senden
     IPS_SendDataToParent($this->InstanceID, $JSONString);
     return true;
 }
예제 #10
0
 protected function SendDataToParent($Data)
 {
     // API-Daten verpacken und dann versenden.
     $Data->NodeName = $this->ReadPropertyString('NodeName');
     $JSONString = $Data->ToJSONString('{5971FB22-3F96-45AE-916F-AE3AC8CA8782}');
     //        IPS_LogMessage('SendDataToGateway:'.$this->InstanceID,$JSONString);
     // Daten senden
     IPS_SendDataToParent($this->InstanceID, $JSONString);
     return true;
 }
예제 #11
0
 protected function SendDataToParent($Data)
 {
     //        IPS_LogMessage('SendDataToSerialPort:'.$this->InstanceID,$Data);
     //Parent ok ?
     if (!$this->CheckParents()) {
         throw new Exception("Instance has no active Parent.", E_USER_NOTICE);
     }
     // Frame bauen
     //
     // DATA aufüllen
     if ($this->Mode == ISCPSplitter::LAN) {
         $eISCPlen = chr(0x0) . chr(0x0) . chr(floor(strlen($Data) / 256)) . chr(strlen($Data) % 256);
         $Frame = $eISCPlen . chr($this->eISCPVersion) . chr(0x0) . chr(0x0) . chr(0x0);
         $Len = strlen($Frame) + 8;
         $eISCPHeaderlen = chr(0x0) . chr(0x0) . chr(floor($Len / 256)) . chr($Len % 256);
         $Frame = "ISCP" . $eISCPHeaderlen . $Frame . $Data;
     } elseif ($this->Mode == ISCPSplitter::COM) {
         $Frame = $Data;
     } else {
         throw new Exception("Wrong IO-Parent.", E_USER_WARNING);
     }
     //Semaphore setzen
     if (!$this->lock("ToParent")) {
         throw new Exception("Can not send to Parent", E_USER_NOTICE);
     }
     // Daten senden
     try {
         IPS_SendDataToParent($this->InstanceID, json_encode(array("DataID" => "{79827379-F36E-4ADA-8A95-5F8D1DC92FA9}", "Buffer" => utf8_encode($Frame))));
     } catch (Exception $exc) {
         // Senden fehlgeschlagen
         $this->unlock("ToParent");
         throw new Exception($exc);
     }
     $this->unlock("ToParent");
     return true;
 }