Example #1
0
 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());
 }
Example #2
0
 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();
 }
Example #3
0
 function __construct()
 {
     parent::__construct();
 }