Example #1
0
 public function testReverse()
 {
     $old_zcl = ZCLFrame::construct(ReadAttributesCommand::construct([AttributeIdentifier::construct(0x2)]), 0x4e47, ZCLFrame::DIRECTION_SERVER_TO_CLIENT, ZCLFrame::DEFAULT_RESPONSE_ENABLED, 0x1);
     $old_zcl_frame = $old_zcl->getFrame();
     $new = new ZCLFrame($old_zcl_frame);
     $this->assertEquals($old_zcl_frame, $new->getFrame());
 }
 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 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());
 }
Example #4
0
 public function testZCLInclusion()
 {
     $zcl_frame = ZCLFrame::construct(ReadAttributesCommand::construct([]));
     $aps_frame = new APSFrame();
     $aps_frame->setPayloadObject($zcl_frame);
     // The APS payload should be the same as the frame
     $this->assertEquals($zcl_frame->getFrame(), $aps_frame->getPayload());
     $this->assertEquals(APSFrame::FRAME_TYPE_DATA, $aps_frame->getFrameType());
 }
 public function testReverse()
 {
     $old_zcl_frame = $this->zcl_frame->getFrame();
     $new = new ZCLFrame($old_zcl_frame);
     $this->assertEquals($old_zcl_frame, $new->getFrame());
 }