/**
  * Returns the frame as a sequence of bytes.
  *
  * @return string $frame
  */
 function getFrame()
 {
     $frame = "";
     Buffer::packInt16u($frame, $this->getZoneStatus()->getValue());
     Buffer::packInt8u($frame, $this->getExtendedStatus());
     return $frame;
 }
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getStatus());
     Buffer::packInt16u($frame, $this->getNwkAddrOfInterest());
     return $frame;
 }
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt16u($frame, $this->getAttributeId());
     Buffer::packInt8u($frame, $this->getDatatypeId());
     return $frame;
 }
 function getFrame()
 {
     $frame = "";
     Buffer::packInt16u($frame, $this->getStartAttributeIdentifier());
     Buffer::packInt8u($frame, $this->getMaximumAttributeIdentifiers());
     return $frame;
 }
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt16u($frame, $this->getNwkAddress());
     Buffer::packInt8u($frame, $this->getRequestType());
     Buffer::packInt8u($frame, $this->getStartIndex());
     return $frame;
 }
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt16u($frame, $this->getNwkAddrOfInterest());
     $user_descr_frame = $this->getUserDescriptor()->getFrame();
     Buffer::packInt8u($frame, strlen($user_descr_frame));
     $frame .= $user_descr_frame;
     return $frame;
 }
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getStatus());
     Buffer::packInt16u($frame, $this->getNwkAddrOfInterest());
     if ($this->getStatus() == Status::SUCCESS) {
         $frame .= $this->getPowerDescriptor()->getFrame();
     }
     return $frame;
 }
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt16u($frame, $this->getAttributeId());
     Buffer::packInt8u($frame, $this->getStatus());
     if ($this->getStatus() == ZCLStatus::SUCCESS) {
         Buffer::packInt8u($frame, $this->getDatatypeId());
         Buffer::packDatatype($frame, $this->getDatatypeId(), $this->getValue());
     }
     return $frame;
 }
Пример #9
0
 public function getZclHeaderFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getFrameControl());
     if ($this->getManufacturerIdPresent()) {
         Buffer::packInt16u($frame, $this->getManufacturerId());
     }
     Buffer::packInt8u($frame, $this->getTransactionId());
     Buffer::packInt8u($frame, $this->getCommandId());
     return $frame;
 }
Пример #10
0
 /**
  * Returns the frame as a sequence of bytes.
  *
  * @return string $frame
  */
 function getFrame()
 {
     $frame = "";
     Buffer::packInt16u($frame, $this->getDestinationAddress());
     $byte1 = $this->getStatus() & 7;
     $byte1 |= $this->getMemoryConstrained() << 3 & 8;
     $byte1 |= $this->getManyToOne() << 4 & 16;
     $byte1 |= $this->getRouteRecordRequired() << 5 & 32;
     Buffer::packInt8u($frame, $byte1);
     Buffer::packInt16u($frame, $this->getNextHopAddress());
     return $frame;
 }
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getStatus());
     if ($this->getStatus() == ZCLStatus::SUCCESS) {
         $frame .= parent::getFrame();
     } else {
         Buffer::packInt8u($frame, $this->getDirection());
         Buffer::packInt16u($frame, $this->getAttributeId());
     }
     return $frame;
 }
Пример #12
0
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getStatus());
     Buffer::packInt16u($frame, $this->getNwkAddrOfInterest());
     Buffer::packInt8u($frame, $this->getActiveEPCount());
     if ($this->getStatus() == Status::SUCCESS) {
         foreach ($this->getActiveEpList() as $active_ep) {
             Buffer::packInt8u($frame, $active_ep);
         }
     }
     return $frame;
 }
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getDirection());
     Buffer::packInt16u($frame, $this->getAttributeId());
     if ($this->getDirection() === self::DIRECTION_SERVER_TO_CLIENT) {
         Buffer::packInt8u($frame, $this->getDatatypeId());
         Buffer::packInt16u($frame, $this->getMinimumReportingInterval());
         Buffer::packInt16u($frame, $this->getMaximumReportingInterval());
         Buffer::packDatatype($frame, $this->getDatatypeId(), $this->getReportableChange());
     } else {
         Buffer::packInt16u($frame, $this->getTimeoutPeriod());
     }
     return $frame;
 }
Пример #14
0
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getStatus());
     Buffer::packInt16u($frame, $this->getNwkAddrOfInterest());
     if ($this->getStatus() == Status::SUCCESS) {
         $user_descr_frame = $this->getUserDescriptor()->getFrame();
         Buffer::packInt8u($frame, strlen($user_descr_frame));
         $frame .= $user_descr_frame;
     } else {
         // If status is not success, user descriptor length is 0
         Buffer::packInt8u($frame, 0x0);
     }
     return $frame;
 }
Пример #15
0
 /**
  * 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::packInt16u($frame, $this->getNwkAddrOfInterest());
     Buffer::packInt8u($frame, $this->getEndpoint());
     Buffer::packInt8u($frame, $this->getAppInputClusterCount());
     Buffer::packInt8u($frame, $this->getAppOutputClusterCount());
     Buffer::packInt8u($frame, $this->getStartIndex());
     if ($this->getStatus() == Status::SUCCESS) {
         foreach ($this->getAppClusterList() as $cluster_id) {
             Buffer::packInt16u($frame, $cluster_id);
         }
     }
     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;
 }
Пример #18
0
 /**
  * Returns the frame as a sequence of bytes.
  *
  * @return string $frame
  */
 function getFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getEndpoint());
     Buffer::packInt16u($frame, $this->getApplicationProfileIdentifier());
     Buffer::packInt16u($frame, $this->getApplicationDeviceIdentifier());
     Buffer::packInt8u($frame, $this->getApplicationDeviceVersion());
     // Input Clusters
     Buffer::packInt8u($frame, $this->getApplicationInputClusterCount());
     foreach ($this->getApplicationInputClusterList() as $cluster_id) {
         Buffer::packInt16u($frame, $cluster_id);
     }
     // Output Clusters
     Buffer::packInt8u($frame, $this->getApplicationOutputClusterCount());
     foreach ($this->getApplicationOutputClusterList() as $cluster_id) {
         Buffer::packInt16u($frame, $cluster_id);
     }
     return $frame;
 }
Пример #19
0
 /**
  * Returns the frame as a sequence of bytes.
  *
  * @return string $frame
  */
 function getFrame()
 {
     $frame = "";
     $byte1 = $this->getLogicalType() & 7;
     $byte1 |= $this->getComplexDescriptorAvailable() << 3 & 8;
     $byte1 |= $this->getUserDescriptorAvailable() << 4 & 16;
     Buffer::packInt8u($frame, $byte1);
     $byte2 = $this->getApsFlags() & 7;
     $byte2 |= $this->getFrequencyBand() << 3 & 248;
     Buffer::packInt8u($frame, $byte2);
     $byte_mac = $this->getMacCapabilityAlternatePanCoordinator() >> 0 & 1;
     $byte_mac |= $this->getMacCapabilityDeviceType() >> 1 & 2;
     $byte_mac |= $this->getMacCapabilityPowerSource() >> 2 & 4;
     $byte_mac |= $this->getMacCapabilityReceiverOnWhenIdle() >> 3 & 8;
     $byte_mac |= $this->getMacCapabilitySecurityCapability() >> 6 & 64;
     $byte_mac |= $this->getMacCapabilityAllocateAddress() >> 7 & 128;
     Buffer::packInt8u($frame, $byte_mac);
     Buffer::packInt16u($frame, $this->getManufacturerCode());
     Buffer::packInt8u($frame, $this->getMaximumBufferSize());
     Buffer::packInt16u($frame, $this->getMaximumIncomingTransferSize());
     Buffer::packInt16u($frame, $this->getServerMask());
     Buffer::packInt16u($frame, $this->getMaximumOutgoingTransferSize());
     $byte_descriptor = $this->getExtendedActiveEndpointListAvailable() >> 0 & 1;
     $byte_descriptor |= $this->getExtendedSimpleDescriptorListAvailable() >> 1 & 2;
     Buffer::packInt8u($frame, $byte_descriptor);
     return $frame;
 }
Пример #20
0
 /**
  * Get the current frame.
  *
  * @return string Frame
  */
 public function getFrame()
 {
     $frame = "";
     Buffer::packInt8u($frame, $this->getFrameControl());
     if ($this->isGroupAddressPresent()) {
         Buffer::packInt16u($frame, $this->getGroupAddress());
     }
     if ($this->isDestinationEndpointPresent()) {
         Buffer::packInt8u($frame, $this->getDestinationEndpoint());
     }
     if ($this->isClusterIdPresent()) {
         Buffer::packInt16u($frame, $this->getClusterId());
     }
     if ($this->isProfileIdPresent()) {
         Buffer::packInt16u($frame, $this->getProfileId());
     }
     if ($this->isSourceEndpointPresent()) {
         Buffer::packInt8u($frame, $this->getSourceEndpoint());
     }
     Buffer::packInt8u($frame, $this->getApsCounter());
     if ($this->isExtHeaderPresent()) {
         Buffer::packInt8u($frame, $this->getExtHeader());
     }
     if ($this->isFragBlockNumberPresent()) {
         Buffer::packInt8u($frame, $this->getFragBlockNumber());
     }
     if ($this->isFragAckBitfieldPresent()) {
         Buffer::packInt8u($frame, $this->getFragAckBitfield());
     }
     if ($this->isPayloadPresent()) {
         $frame .= $this->getPayload();
     }
     return $frame;
 }
Пример #21
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;
 }