public function testZCLInclusion() { $zcl = new ZCLFrame(); try { $zcl->setPayloadObject($this->frame); } catch (\Exception $e) { $this->fail("Could not include DiscoverAttributesCommand in a ZCLFrame: " . $e->getMessage()); } }
public function testReadAttribute() { $zcl = new ZCLFrame(); $zcl->setTransactionId(0x1); $read_attributes_elem = new AttributeIdentifier(); $read_attributes_elem->setAttributeId(0x2); $read_attributes = new ReadAttributesCommand(); $read_attributes->addAttributeIdentifier($read_attributes_elem); $zcl->setPayloadObject($read_attributes); $this->assertEquals('0x00 0x01 0x00 0x02 0x00', $zcl->displayFrame()); }
public function testFitInZCLFrame() { $bytes = chr(0x5a) . chr(0x0) . chr(0x0); $command = new ZoneStatusChangeNotificationCommand($bytes); $zcl_frame = new ZCLFrame(); $zcl_frame->setPayloadObject($command); /** * @var $output ZoneStatusChangeNotificationCommand */ $output = $zcl_frame->getPayloadObject(Cluster::IAS_ZONE); $this->assertInstanceOf("Munisense\\Zigbee\\ZCL\\IAS_Zone\\ZoneStatusChangeNotificationCommand", $output); $this->assertEquals($bytes, $output->getFrame()); }