public function getFrame()
 {
     $frame = "";
     Buffer::packEui64($frame, $this->getIeeeAddress());
     Buffer::packInt8u($frame, $this->getRequestType());
     Buffer::packInt8u($frame, $this->getStartIndex());
     return $frame;
 }
 /**
  * Returns the frame as a sequence of bytes.
  *
  * @return string $frame
  */
 function getFrame()
 {
     $frame = "";
     Buffer::packEui64($frame, $this->getExtendedPanId());
     Buffer::packEui64($frame, $this->getExtendedAddress());
     Buffer::packInt16u($frame, $this->getNetworkAddress());
     $byte1 = $this->getDeviceType() & 3;
     $byte1 |= $this->getRxOnWhenIdle() << 2 & 12;
     $byte1 |= $this->getRelationship() << 5 & 112;
     Buffer::packInt8u($frame, $byte1);
     $byte2 = $this->getPermitJoining() & 3;
     Buffer::packInt8u($frame, $byte2);
     Buffer::packInt8u($frame, $this->getDepth());
     Buffer::packInt8u($frame, $this->getLqi());
     return $frame;
 }
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getStatus());
     Buffer::packEui64($frame, $this->getIeeeAddressRemoteDev());
     Buffer::packInt16u($frame, $this->getNwkAddrRemoteDev());
     // Omit the other fields if the request type is SINGLE or status is not SUCCESS
     if ($this->getRequestType() == self::REQUEST_TYPE_EXTENDED && $this->getStatus() == Status::SUCCESS) {
         Buffer::packInt8u($frame, $this->getNumAssocDev());
         // Omit the other fields if there are no associated devices listed
         if ($this->getNumAssocDev() != 0) {
             Buffer::packInt8u($frame, $this->getStartIndex());
             foreach ($this->getAssociatedDeviceList() as $assoc_dev) {
                 Buffer::packInt16u($frame, $assoc_dev);
             }
         }
     }
     return $frame;
 }
示例#4
0
 public function getFrame()
 {
     $checksum_frame = "";
     Buffer::packInt8u($checksum_frame, $this->getSMSHeader());
     Buffer::packInt16u($checksum_frame, 0x0);
     if ($this->isExtHeaderPresent()) {
         Buffer::packInt8u($checksum_frame, $this->getExtHeader());
     }
     if ($this->isTazBlockCountPresent()) {
         Buffer::packInt8u($checksum_frame, $this->getTazBlockCount());
     }
     switch ($this->getAddressType()) {
         case self::ADDRESS_TYPE_EUI64:
             Buffer::packEui64($checksum_frame, $this->getAddress());
             break;
         case self::ADDRESS_TYPE_NODE_ID:
             Buffer::packInt16u($checksum_frame, $this->getAddress());
             break;
     }
     for ($taz_index = 0; $taz_index < $this->getTazBlockCount(); $taz_index++) {
         $checksum_frame .= $this->taz_blocks[$taz_index]->getFrame();
     }
     $checksum_frame = self::applyChecksum($checksum_frame);
     if ($this->getFrameEncoding() == self::FRAME_ENCODING_BASE64) {
         $checksum_frame = base64_encode($checksum_frame);
     }
     $frame = "";
     Buffer::packInt8u($frame, $this->getFrameEncoding());
     $frame .= $checksum_frame;
     //echo __CLASS__."->".__FUNCTION__."(): ".Buffer::displayOctetString($frame).PHP_EOL;
     return $frame;
 }