Client = new \XMLRPC\Client($this->host, $this->port, $this->ssl); } public function addEvent($event) { $this->Client->send('addEvent', $event); } public function removeEvent($eventId) { $this->Client->send('removeEvent', $eventId); } public function pollEvent() { return evaluate($this->Client->send('pollEvent')); } public function getPeerId($filterType, $filterValue) { return $this->Client->send('getPeerId', [$filterType, $filterValue]); } public function getAllMetadata($peerid) { return $this->Client->send('getAllMetadata', [$peerid]); } public function getMetadata($peerid, $meta) { return $this->Client->send('getMetadata', [$peerid, $meta]); } public function setMetadata($peerid, $meta, $value) { return $this->Client->send('setMetadata', [$peerid, $meta, $value]); } public function getValue($peerId, $channel, $parameterName) { return $this->evaluate($this->Client->send('getValue', [$peerId, $channel, $parameterName])); } public function setValue($peerId, $channel, $parameterName, $value) { $this->evaluate( $this->Client->send('setValue', [$peerId, $channel, $parameterName, $value])); } public function getSystemVariable($name) { return $this->evaluate($this->Client->send('getSystemVariable', [$name])); } public function setSystemVariable($name, $value) { $this->Client->send('setSystemVariable', [$name, $value]); } public function deleteSystemVariable($name) { $this->Client->send('deleteSystemVariable', [$name]); } public function subscribePeer($peerId) { return $this->Client->send('subscribePeer', [$peerId]); } public function getParamset($peerId, $channel, $type) { return $this->evaluate($this->Client->send('getParamset', [$peerId, $channel, $type])); } public function registerThread($peerId) { return $this->Client->send('registerThread', [$peerId]); } /* fake calls only local */ public function getScriptId() { return \Homegear\Homegear::$scriptId; } public function shuttingDown() { return FALSE; } public function peerExists($peer) { return TRUE; } /* logging */ public function log($level, $message) { error_log($message."\r\n", 3, \Homegear\Homegear::LOGFILE); } private function evaluate($result) { if (is_array($result) && array_key_exists('faultCode', $result)) { throw new \Homegear\HomegearException; } return $result; } } }