private function sendAck(CoapResponse $resp, $code = '2.00') { $ack = new CoapPdu(); $ack->setType(CoapPdu::ACK); $ack->setCode($code); $ack->setMessageId($resp->getMessageId()); $this->sock->send($ack->getMessage()); }
function __construct($uri, $method, $data) { $parts = parse_url($uri); if ($parts['scheme'] != 'coap') { throw \Exception('Bad Uri: ' . $uri); } $this->uriParts = $parts; $this->addOption(new CoapOption(3, $this->getHost())); $this->addOption(new CoapOption(11, substr($this->uriParts['path'], 1))); if (isset($this->uriParts['query'])) { $this->addOption(new CoapOption(15, $this->uriParts['query'])); } $this->setPayload($data); parent::__construct(); }
function __construct() { parent::__construct(); }