using System.Diagnostics;
using System.Runtime.InteropServices;
using System;
using Helper;
namespace SCSI.Block
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public class StartStopUnitCommand : SCSICommand
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private const byte FORMAT_LAYER_NUMBER_MASK = 0x03;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private const byte POWER_CONDITIONS_MASK = 0xF0;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private const byte POWER_CONDITION_MODIFIER_MASK = 0x0F;
public StartStopUnitCommand() : base(OpCode.StartStopUnit) { }
public StartStopUnitCommand(bool loadEject, bool start) : this(loadEject, start, false) { }
public StartStopUnitCommand(bool loadEject, bool start, bool immediate) : this(loadEject, start, default(PowerConditions), PowerConditionModifier.None, false) { }
public StartStopUnitCommand(PowerConditions powerCondition) : this(powerCondition, false) { }
public StartStopUnitCommand(PowerConditions powerCondition, bool immediate) : this(powerCondition, PowerConditionModifier.None, immediate) { }
public StartStopUnitCommand(PowerConditions powerCondition, PowerConditionModifier modifier, bool immediate) : this(false, false, powerCondition, modifier, immediate) { }
public StartStopUnitCommand(bool loadEject, bool start, PowerConditions powerConditions, PowerConditionModifier modifier, bool immediate)
: this()
{
this.LoadEject = loadEject;
this.Start = start;
this.PowerConditions = powerConditions;
this.PowerConditionModifier = modifier;
this.Immediate = immediate;
}
private BitVector8 byte1;
/// <summary>If <see cref="Immediate"/> is set to <c>false</c>, status shall be returned only after the operation is completed. If <see cref="Immediate"/> is set to <c>true</c>, status shall be returned as soon as the CDB has been validated.</summary>
public bool Immediate { get { return this.byte1[0]; } set { this.byte1[0] = value; } }
private byte byte2;
private BitVector8 byte3;
public PowerConditionModifier PowerConditionModifier
{
get { return (PowerConditionModifier)Helper.Bits.ExtractValueMask((byte)this.byte3, 0, POWER_CONDITION_MODIFIER_MASK); }
set { this.byte3 = Helper.Bits.PutValueMask((byte)this.byte3, (byte)value, 0, POWER_CONDITION_MODIFIER_MASK); }
}
private BitVector8 byte4;
public PowerConditions PowerConditions
{
get { return (PowerConditions)Helper.Bits.ExtractValueMask((byte)this.byte4, 4, POWER_CONDITIONS_MASK); }
set { this.byte4 = Helper.Bits.PutValueMask((byte)this.byte4, (byte)value, 4, POWER_CONDITIONS_MASK); }
}
public bool NoFlush { get { return this.byte4[2]; } set { this.byte4[2] = value; } }
public bool LoadEject { get { return this.byte4[1]; } set { this.byte4[1] = value; } }
public bool Start { get { return this.byte4[0]; } set { this.byte4[0] = value; } }
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private Control _Control;
public override Control Control { get { return this._Control; } set { this._Control = value; } }
}
}