public function testReverse() { $old_zcl = ConfigureReportingResponseCommand::construct([AttributeStatusRecord::construct(ZCLStatus::UNREPORTABLE_ATTRIBUTE, AttributeReportingConfigurationStatusRecord::DIRECTION_SERVER_TO_CLIENT, 0x1234), AttributeStatusRecord::construct(ZCLStatus::CALIBRATION_ERROR, AttributeReportingConfigurationStatusRecord::DIRECTION_SERVER_TO_CLIENT, 0x4567)]); $old_zcl_frame = $old_zcl->getFrame(); $new = new ConfigureReportingResponseCommand($old_zcl_frame); $this->assertEquals($old_zcl_frame, $new->getFrame()); }
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); } } }