1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /* Copyright (C) 2012-2016 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
- *
- * You can redistribute this program and/or modify it under the terms of
- * the GNU Lesser Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- */
- using System;
- using System.Collections.Generic;
- using System.Text;
- using Utilities;
- namespace SCSI
- {
- public class InquiryCommand : SCSICommandDescriptorBlock
- {
- public bool EVPD; // Enable Vital Product Data
- public VitalProductDataPageName PageCode;
- public InquiryCommand() : base()
- {
- OpCode = SCSIOpCodeName.Inquiry;
- }
- public InquiryCommand(byte[] buffer, int offset)
- {
- OpCode = (SCSIOpCodeName)buffer[offset + 0];
- EVPD = (buffer[offset + 1] & 0x01) != 0;
- PageCode = (VitalProductDataPageName)buffer[offset + 2];
- AllocationLength = BigEndianConverter.ToUInt16(buffer, offset + 3);
- Control = buffer[offset + 5];
- }
- public override byte[] GetBytes()
- {
- byte[] buffer = new byte[6];
- buffer[0] = (byte)OpCode;
- if (EVPD)
- {
- buffer[1] |= 0x01;
- }
- buffer[2] = (byte)PageCode;
- Array.Copy(BigEndianConverter.GetBytes(AllocationLength), 0, buffer, 3, 2);
- buffer[5] = Control;
- return buffer;
- }
- public ushort AllocationLength
- {
- get
- {
- return (ushort)TransferLength;
- }
- set
- {
- TransferLength = value;
- }
- }
- }
- }
|