public function getFrame() { $frame = ""; Buffer::packInt8u($frame, $this->command_identifier); Buffer::packInt8u($frame, $this->status_code); return $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 getFrame() { $frame = ""; Buffer::packInt16u($frame, $this->getAttributeId()); Buffer::packInt8u($frame, $this->getDatatypeId()); return $frame; }
public function testAllSuccess() { Buffer::packInt8u($payload, ZCLStatus::SUCCESS); $frame = new WriteAttributesResponseCommand($payload); $this->assertTrue($frame->isSuccess()); $this->assertEquals("0x00", $frame->displayFrame()); }
public function setFrame($frame) { while (strlen($frame)) { $attribute_identifier = new AttributeIdentifier(); $attribute_identifier->setAttributeId(Buffer::unpackInt16u($frame)); $this->attribute_identifiers[] = $attribute_identifier; } }
public function getFrame() { $frame = ""; Buffer::packInt16u($frame, $this->getNwkAddress()); Buffer::packInt8u($frame, $this->getRequestType()); Buffer::packInt8u($frame, $this->getStartIndex()); return $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); } }
/** * @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); }
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)); }
/** * Returns the frame as a sequence of bytes. * * @return string $frame */ function getFrame() { $frame = ""; // Note: 2.3.2.7 Suggests 16 bytes always, but the length field of the UserDescRsp command would then not be needed? $user_description = $this->getUserDescription(); for ($x = 0; $x < strlen($user_description); $x++) { if (isset($user_description[$x])) { Buffer::packInt8u($frame, ord($user_description[$x])); } } return $frame; }
public function getFrame() { $frame = ""; if (!empty($this->attribute_status_records)) { foreach ($this->attribute_status_records as $attribute_status_record) { $frame .= $attribute_status_record->getFrame(); } } else { Buffer::packInt8u($frame, ZCLStatus::SUCCESS); } 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; }
public function getFrame() { $frame = ""; // If there are no records, just send a single SUCCESS if (empty($this->write_attribute_status_records)) { Buffer::packInt8u($frame, ZCLStatus::SUCCESS); } else { // Loop over the different records foreach ($this->write_attribute_status_records as $write_attribute_status_record) { $frame .= $write_attribute_status_record->getFrame(); } } return $frame; }
public function getFrame() { $frame = ""; Buffer::packInt8u($frame, $this->getStatus()); if ($this->getStatus() == Status::SUCCESS) { Buffer::packInt8u($frame, $this->getRoutingTableEntries()); Buffer::packInt8u($frame, $this->getStartIndex()); Buffer::packInt8u($frame, $this->getRoutingTableListCount()); foreach ($this->getRoutingTableList() as $routing_descriptor) { $frame .= $routing_descriptor->getFrame(); } } return $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)); } }
public function displayNwkAddrOfInterest() { return Buffer::displayInt16u($this->getNwkAddrOfInterest()); }
function setFrame($frame) { $this->setStartAttributeIdentifier(Buffer::unpackInt16u($frame)); $this->setMaximumAttributeIdentifiers(Buffer::unpackInt8u($frame)); }
public function displayValue() { return Buffer::displayDatatype($this->getDatatypeId(), $this->getValue()); }
public function __toString() { $output = __CLASS__ . " (length: " . strlen($this->getFrame()) . ")" . PHP_EOL; $output .= "|- Status : " . $this->displayStatus() . PHP_EOL; $output .= "|- NwkAddr : " . $this->displayNwkAddrOfInterest() . PHP_EOL; if ($this->getStatus() == Status::SUCCESS) { $output .= "|- Active EP: " . implode(", ", array_map(function ($ep) { return Buffer::displayInt8u($ep); }, $this->getActiveEpList())); } return $output; }
public function displayExtendedPanId() { return Buffer::displayEui64($this->getExtendedPanId()); }
public function displayPayload() { return Buffer::displayOctetString($this->getPayload()); }
public function getFrame() { $frame = ""; Buffer::packInt16u($frame, $this->getNwkAddressOfInterest()); return $frame; }
public function getFrame() { $frame = parent::getFrame(); Buffer::packInt8u($frame, $this->getStartIndex()); return $frame; }
public function getFrame() { $frame = parent::getFrame(); Buffer::packInt8u($frame, $this->getEndpoint()); return $frame; }
/** * @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); }
public function displayTimeoutPeriod() { return Buffer::displayTimeOfDay($this->getTimeoutPeriod() * 1000); }
public function __toString() { $output = __CLASS__ . " (length: " . strlen($this->getFrame()) . ")" . PHP_EOL; $output .= "|- Status : " . $this->displayStatus() . PHP_EOL; $output .= "|- IeeeAddr : " . $this->displayIeeeAddressRemoteDev() . PHP_EOL; $output .= "|- NwkAddr : " . $this->displayNwkAddrRemoteDev() . PHP_EOL; if ($this->getRequestType() == self::REQUEST_TYPE_EXTENDED && $this->getStatus() == Status::SUCCESS) { $output .= "|- NumAssocDev : " . $this->getNumAssocDev() . PHP_EOL; if ($this->getNumAssocDev() != 0) { $output .= "`- StartIndex : " . $this->displayStartIndex() . PHP_EOL; foreach ($this->getAssociatedDeviceList() as $assoc_dev) { $output .= " |- " . Buffer::displayInt16u($assoc_dev) . PHP_EOL; } } } return $output; }
public function displayIeeeAddress() { return Buffer::displayEui64($this->getIeeeAddress()); }
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; }