public function setFrame($frame)
 {
     $this->setNwkAddrOfInterest(Buffer::unpackInt16u($frame));
     // User Descriptor Length, unused, but may not remain in buffer
     Buffer::unpackInt8u($frame);
     $this->setUserDescriptor(new UserDescriptor($frame));
 }
 /**
  * @param string $frame
  */
 function setFrame($frame)
 {
     $zone_status = new ZoneStatus();
     $zone_status->setValue(Buffer::unpackInt16u($frame));
     $this->setZoneStatus($zone_status);
     $this->setExtendedStatus(Buffer::unpackInt8u($frame));
 }
 public function setFrame($frame)
 {
     $this->setStatus(Buffer::unpackInt8u($frame));
     $this->setNwkAddrOfInterest(Buffer::unpackInt16u($frame));
     if ($this->getStatus() == Status::SUCCESS) {
         $this->setNodeDescriptor(new NodeDescriptor($frame));
     }
 }
 function setFrame($frame)
 {
     $this->setDiscoveryComplete(Buffer::unpackInt8u($frame) == 1);
     while (strlen($frame)) {
         $attribute_information = new AttributeInformation();
         $attribute_information->consumeFrame($frame);
         $this->addAttributeInformation($attribute_information);
     }
 }
 public function consumeFrame(&$frame)
 {
     $this->setAttributeId(Buffer::unpackInt16u($frame));
     $this->setStatus(Buffer::unpackInt8u($frame));
     if ($this->getStatus() == ZCLStatus::SUCCESS) {
         $this->setDatatypeId(Buffer::unpackInt8u($frame));
         $this->setValue(Buffer::unpackDatatype($frame, $this->getDatatypeId()));
     }
 }
 /**
  * @param string $frame
  */
 function setFrame($frame)
 {
     $byte1 = Buffer::unpackInt8u($frame);
     $byte2 = Buffer::unpackInt8u($frame);
     $this->setCurrentPowerMode(($byte1 & 0xf) >> 0);
     $this->setAvailablePowerSources(($byte1 & 0xf0) >> 4);
     $this->setCurrentPowerSource(($byte2 & 0xf) >> 0);
     $this->setCurrentPowerLevel(($byte2 & 0xf0) >> 4);
 }
示例#7
0
 public function setFrame($frame)
 {
     $this->setFrameControl(Buffer::unpackInt8u($frame));
     if ($this->getManufacturerIdPresent()) {
         $this->setManufacturerId(Buffer::unpackInt16u($frame));
     }
     $this->setTransactionId(Buffer::unpackInt8u($frame));
     $this->setCommandId(Buffer::unpackInt8u($frame));
     $this->setPayload($frame);
 }
 public function setFrame($frame)
 {
     $this->setStatus(Buffer::unpackInt8u($frame));
     $this->setNwkAddrOfInterest(Buffer::unpackInt16u($frame));
     // Simple Descriptor Length, unused, but may not remain in buffer
     Buffer::unpackInt8u($frame);
     if ($this->getStatus() == Status::SUCCESS) {
         $this->setSimpleDescriptor(new SimpleDescriptor($frame));
     }
 }
 public function consumeFrame(&$frame)
 {
     $this->setDestinationAddress(Buffer::unpackInt16u($frame));
     $byte1 = Buffer::unpackInt8u($frame);
     $this->setStatus(($byte1 & 7) >> 0);
     $this->setMemoryConstrained(($byte1 & 8) >> 3);
     $this->setManyToOne(($byte1 & 16) >> 4);
     $this->setRouteRecordRequired(($byte1 & 32) >> 5);
     $this->setNextHopAddress(Buffer::unpackInt16u($frame));
 }
 public function setFrame($frame)
 {
     $this->setStatus(Buffer::unpackInt8u($frame));
     $this->setNwkAddrOfInterest(Buffer::unpackInt16u($frame));
     if ($this->getStatus() == Status::SUCCESS) {
         $active_ep_count = Buffer::unpackInt8u($frame);
         for ($i = 0; $i < $active_ep_count; $i++) {
             $this->addActiveEP(Buffer::unpackInt8u($frame));
         }
     }
 }
 public function setFrame($frame)
 {
     $this->setStatus(Buffer::unpackInt8u($frame));
     $this->setNwkAddrOfInterest(Buffer::unpackInt16u($frame));
     $this->setEndpoint(Buffer::unpackInt8u($frame));
     $this->setAppInputClusterCount(Buffer::unpackInt8u($frame));
     $this->setAppOutputClusterCount(Buffer::unpackInt8u($frame));
     $this->setStartIndex(Buffer::unpackInt8u($frame));
     while (strlen($frame) > 0) {
         $this->addAppClusterListElement(Buffer::unpackInt16u($frame));
     }
 }
 public function consumeFrame(&$frame)
 {
     $this->setDirection(Buffer::unpackInt8u($frame));
     $this->setAttributeId(Buffer::unpackInt16u($frame));
     if ($this->getDirection() === self::DIRECTION_SERVER_TO_CLIENT) {
         $this->setDatatypeId(Buffer::unpackInt8u($frame));
         $this->setMinimumReportingInterval(Buffer::unpackInt16u($frame));
         $this->setMaximumReportingInterval(Buffer::unpackInt16u($frame));
         $this->setReportableChange(Buffer::unpackDatatype($frame, $this->getDatatypeId()));
     } else {
         $this->setTimeoutPeriod(Buffer::unpackInt16u($frame));
     }
 }
 public function setFrame($frame)
 {
     $this->setStatus(Buffer::unpackInt8u($frame));
     if ($this->getStatus() == Status::SUCCESS) {
         $this->setRoutingTableEntries(Buffer::unpackInt8u($frame));
         $this->setStartIndex(Buffer::unpackInt8u($frame));
         $routing_table_list_count = Buffer::unpackInt8u($frame);
         for ($i = 0; $i < $routing_table_list_count; $i++) {
             $routing_descriptor = new RoutingDescriptor();
             $routing_descriptor->consumeFrame($frame);
             $this->addRoutingDescriptor($routing_descriptor);
         }
     }
 }
 public function setFrame($frame)
 {
     $this->setStatus(Buffer::unpackInt8u($frame));
     if ($this->getStatus() == Status::SUCCESS) {
         $this->setNeighborTableEntries(Buffer::unpackInt8u($frame));
         $this->setStartIndex(Buffer::unpackInt8u($frame));
         $neighbor_table_list_count = Buffer::unpackInt8u($frame);
         for ($i = 0; $i < $neighbor_table_list_count; $i++) {
             $neighbor_descriptor = new NeighborDescriptor();
             $neighbor_descriptor->consumeFrame($frame);
             $this->addNeighborDescriptor($neighbor_descriptor);
         }
     }
 }
 public function setFrame($frame)
 {
     $this->setStatus(Buffer::unpackInt8u($frame));
     $this->setIeeeAddressRemoteDev(Buffer::unpackEui64($frame));
     $this->setNwkAddrRemoteDev(Buffer::unpackInt16u($frame));
     if (strlen($frame) > 0) {
         $this->setRequestType(self::REQUEST_TYPE_EXTENDED);
         $num_assoc_dev = Buffer::unpackInt8u($frame);
         // If there are any devices listed
         if ($num_assoc_dev > 0) {
             $this->setStartIndex(Buffer::unpackInt8u($frame));
             for ($i = 0; $i < $num_assoc_dev; $i++) {
                 $this->addAssociatedDevice(Buffer::unpackInt16u($frame));
             }
         }
     }
 }
 /**
  * @param string $frame
  */
 function setFrame($frame)
 {
     $this->setEndpoint(Buffer::unpackInt8u($frame));
     $this->setApplicationProfileIdentifier(Buffer::unpackInt16u($frame));
     $this->setApplicationDeviceIdentifier(Buffer::unpackInt16u($frame));
     // Device Version is in the first 4 bits
     $byte1 = Buffer::unpackInt8u($frame);
     $this->setApplicationDeviceVersion(($byte1 & 0b1111) >> 0);
     $input_cluster_count = Buffer::unpackInt8u($frame);
     for ($i = 0; $i < $input_cluster_count; $i++) {
         $this->addApplicationInputCluster(Buffer::unpackInt16u($frame));
     }
     $output_cluster_count = Buffer::unpackInt8u($frame);
     for ($i = 0; $i < $output_cluster_count; $i++) {
         $this->addApplicationOutputCluster(Buffer::unpackInt16u($frame));
     }
 }
示例#17
0
 public function setFrame($frame)
 {
     $this->setTazHeader(Buffer::unpackInt8u($frame));
     $length = Buffer::unpackInt8u($frame);
     if ($length !== strlen($frame)) {
         throw new ZigbeeException("Invalid length in length field");
     }
     if ($this->getRequestTimestampPresent()) {
         $this->setRequestTimestamp(Buffer::unpackUTC($frame) + self::MILLENNIUM_EPOCH);
     }
     if ($this->getExecuteTimestampPresent()) {
         $this->setExecuteTimestamp(Buffer::unpackUTC($frame) + self::MILLENNIUM_EPOCH);
     }
     if ($this->getEndTimestampPresent()) {
         $this->setEndTimestamp(Buffer::unpackUTC($frame) + self::MILLENNIUM_EPOCH);
     }
     $this->setPayload($frame);
 }
 public function setFrame($frame)
 {
     /**
      * If there are no write attribute status records in the constructed command, indicating that all attributes were
      * written successfully, a single write attribute status record shall be included in the
      * command, with the status field set to SUCCESS and the attribute identifier field
      * omitted.
      */
     if (strlen($frame) == 1) {
         $status = Buffer::unpackInt8u($frame);
         if ($status != ZCLStatus::SUCCESS) {
             throw new ZigbeeException("If a " . __CLASS__ . " only has one byte, it should be the SUCCESS status");
         }
         return;
     } else {
         while (strlen($frame)) {
             $write_attribute_status_record = new WriteAttributeStatusRecord();
             $write_attribute_status_record->consumeFrame($frame);
             $this->write_attribute_status_records[] = $write_attribute_status_record;
         }
     }
 }
 public function setFrame($frame)
 {
     /**
      * Note that attribute status records are not included for successfully configured
      * attributes, in order to save bandwidth. In the case of successful configuration of all
      * attributes, only a single attribute statusrecord shall be included in the command,
      * with the status field set to SUCCESS and the direction and attribute identifier
      * fields omitted
      */
     if (strlen($frame) == 1) {
         $status = Buffer::unpackInt8u($frame);
         if ($status != ZCLStatus::SUCCESS) {
             throw new ZigbeeException("If a " . __CLASS__ . " only has one byte, it should be the SUCCESS status");
         }
         return;
     } else {
         while (strlen($frame)) {
             $attribute_status_record = new AttributeStatusRecord();
             $attribute_status_record->consumeFrame($frame);
             $this->addAttributeStatusRecord($attribute_status_record);
         }
     }
 }
 public function consumeFrame(&$frame)
 {
     $this->setStatus(Buffer::unpackInt8u($frame));
     parent::consumeFrame($frame);
 }
示例#21
0
 /**
  * Set all parameters of this object by parsing a frame
  *
  * @param string $frame Byte string of the APS frame
  * @return void
  * @throws ZigbeeException
  */
 public function setFrame($frame)
 {
     $this->setFrameControl(Buffer::unpackInt8u($frame));
     if ($this->isGroupAddressPresent()) {
         $this->setGroupAddress(Buffer::unpackInt16u($frame));
     }
     if ($this->isDestinationEndpointPresent()) {
         $this->setDestinationEndpoint(Buffer::unpackInt8u($frame));
     }
     if ($this->isClusterIdPresent()) {
         $this->setClusterId(Buffer::unpackInt16u($frame));
     }
     if ($this->isProfileIdPresent()) {
         $this->setProfileId(Buffer::unpackInt16u($frame));
     }
     if ($this->isSourceEndpointPresent()) {
         $this->setSourceEndpoint(Buffer::unpackInt8u($frame));
     }
     $this->setApsCounter(Buffer::unpackInt8u($frame));
     if ($this->isExtHeaderPresent()) {
         $this->setExtHeader(Buffer::unpackInt8u($frame));
     }
     if ($this->isFragBlockNumberPresent()) {
         $this->setFragBlockNumber(Buffer::unpackInt8u($frame));
     }
     if ($this->isFragAckBitfieldPresent()) {
         $this->setFragAckBitfield(Buffer::unpackInt8u($frame));
     }
     if ($this->isPayloadPresent()) {
         $this->setPayload($frame);
     } elseif (strlen($frame) > 0) {
         throw new ZigbeeException("Unparsed data (" . strlen($frame) . " bytes) at end of frame");
     }
 }
 public function consumeFrame(&$frame)
 {
     $this->setExtendedPanId(Buffer::unpackEui64($frame));
     $this->setExtendedAddress(Buffer::unpackEui64($frame));
     $this->setNetworkAddress(Buffer::unpackInt16u($frame));
     $byte1 = Buffer::unpackInt8u($frame);
     $this->setDeviceType(($byte1 & 3) >> 0);
     $this->setRxOnWhenIdle(($byte1 & 12) >> 2);
     $this->setRelationship(($byte1 & 112) >> 5);
     $byte2 = Buffer::unpackInt8u($frame);
     $this->setPermitJoining($byte2 & 3);
     $this->setDepth(Buffer::unpackInt8u($frame));
     $this->setLqi(Buffer::unpackInt8u($frame));
 }
示例#23
0
 /**
  * @param string $frame
  */
 function setFrame($frame)
 {
     $byte1 = Buffer::unpackInt8u($frame);
     $this->setLogicalType(($byte1 & 7) >> 0);
     $this->setComplexDescriptorAvailable(($byte1 & 8) >> 3);
     $this->setUserDescriptorAvailable(($byte1 & 16) >> 4);
     $byte2 = Buffer::unpackInt8u($frame);
     $this->setApsFlags(($byte2 & 7) >> 0);
     $this->setFrequencyBand(($byte2 & 248) >> 3);
     $byte_mac = Buffer::unpackInt8u($frame);
     $this->setMacCapabilityAlternatePanCoordinator(($byte_mac & 1) >> 0);
     $this->setMacCapabilityDeviceType(($byte_mac & 2) >> 1);
     $this->setMacCapabilityPowerSource(($byte_mac & 4) >> 2);
     $this->setMacCapabilityReceiverOnWhenIdle(($byte_mac & 8) >> 3);
     $this->setMacCapabilitySecurityCapability(($byte_mac & 64) >> 6);
     $this->setMacCapabilityAllocateAddress(($byte_mac & 128) >> 7);
     $this->setManufacturerCode(Buffer::unpackInt16u($frame));
     $this->setMaximumBufferSize(Buffer::unpackInt8u($frame));
     $this->setMaximumIncomingTransferSize(Buffer::unpackInt16u($frame));
     $this->setServerMask(Buffer::unpackInt16u($frame));
     $this->setMaximumOutgoingTransferSize(Buffer::unpackInt16u($frame));
     $byte_descriptor = Buffer::unpackInt8u($frame);
     $this->setExtendedActiveEndpointListAvailable(($byte_descriptor & 1) >> 0);
     $this->setExtendedSimpleDescriptorListAvailable(($byte_descriptor & 2) >> 1);
 }
示例#24
0
 public function setFrame($frame)
 {
     $this->setTransactionId(Buffer::unpackInt8u($frame));
     $this->setPayload($frame);
 }
 public function setFrame($frame)
 {
     $this->setStartIndex(Buffer::unpackInt8u($frame));
 }
 public function setFrame($frame)
 {
     $this->setStatus(Buffer::unpackInt8u($frame));
     $this->setNwkAddrOfInterest(Buffer::unpackInt16u($frame));
 }
 public function setFrame($frame)
 {
     $this->setNwkAddressOfInterest(Buffer::unpackInt16u($frame));
     $this->setEndpoint(Buffer::unpackInt8u($frame));
     $this->setStartIndex(Buffer::unpackInt8u($frame));
 }
 public function setFrame($frame)
 {
     $this->setCommandIdentifier(Buffer::unpackInt8u($frame));
     $this->setStatusCode(Buffer::unpackInt8u($frame));
 }
 public function consumeFrame(&$frame)
 {
     $this->setAttributeId(Buffer::unpackInt16u($frame));
     $this->setDatatypeId(Buffer::unpackInt8u($frame));
 }
示例#30
0
 public static function validateChecksum($frame)
 {
     $checksum_frame = self::generateChecksum($frame);
     Buffer::unpackInt8u($frame);
     $checksum_field = Buffer::unpackInt16u($frame);
     if ($checksum_field === $checksum_frame) {
         return true;
     }
     return false;
 }