private function WaitForResponse($APIData_Command) { $ReplyAPIDataID = $this->GetIDForIdent('ReplyAPIData'); for ($i = 0; $i < 300; $i++) { if (GetValueString($ReplyAPIDataID) === '') { IPS_Sleep(5); } else { if ($this->lock('ReplyAPIData')) { $ret = GetValueString($ReplyAPIDataID); SetValueString($ReplyAPIDataID, ''); $this->unlock('ReplyAPIData'); $JSON = json_decode($ret); $APIData = new ISCP_API_Data(); $APIData->GetDataFromJSONObject($JSON); if ($APIData_Command == $APIData->APICommand) { return $APIData; } else { $i = $i - 100; if ($i < 0) { $i = 0; } } } } } if ($this->lock('ReplyAPIData')) { SetValueString($ReplyAPIDataID, ''); $this->unlock('ReplyAPIData'); } return false; }
private function SendDataToZone(ISCP_API_Data $APIData) { // IPS_LogMessage('SendDataToZone',print_r($APIData,true)); $Data = $APIData->ToJSONString('{43E4B48E-2345-4A9A-B506-3E8E7A964757}'); IPS_SendDataToChildren($this->InstanceID, $Data); }