Class CommandBlockWrapper
- java.lang.Object
-
- com.github.mjdev.libaums.driver.scsi.commands.CommandBlockWrapper
-
- Direct Known Subclasses:
ScsiInquiry,ScsiRead10,ScsiReadCapacity,ScsiRequestSense,ScsiTestUnitReady,ScsiWrite10
public abstract class CommandBlockWrapper extends java.lang.ObjectThis class represents the command block wrapper (CBW) which is always wrapped around a specific SCSI command in the SCSI transparent command set standard.Every SCSI command shall extend this class, call the constructor
CommandBlockWrapper(int, Direction, byte, byte)with the desired information. When transmitting the command, theserialize(ByteBuffer)method has to be called!
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommandBlockWrapper.DirectionThe direction of the data phase of the SCSI command.
-
Field Summary
Fields Modifier and Type Field Description protected intdCbwDataTransferLength
-
Constructor Summary
Constructors Modifier Constructor Description protectedCommandBlockWrapper(int transferLength, CommandBlockWrapper.Direction direction, byte lun, byte cbwcbLength)Constructs a new command block wrapper with the given information which can than easily be serialized withserialize(ByteBuffer).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetdCbwDataTransferLength()Returns the amount of bytes which should be transmitted in the data phase.intgetdCbwTag()Returns the tag which can be used to determine the correspondingCBW.CommandBlockWrapper.DirectiongetDirection()Returns the direction in the data phase.voidserialize(java.nio.ByteBuffer buffer)Serializes the command block wrapper for transmission.voidsetdCbwTag(int dCbwTag)Sets the tag which can be used to determine the correspondingCBW.
-
-
-
Constructor Detail
-
CommandBlockWrapper
protected CommandBlockWrapper(int transferLength, CommandBlockWrapper.Direction direction, byte lun, byte cbwcbLength)Constructs a new command block wrapper with the given information which can than easily be serialized withserialize(ByteBuffer).- Parameters:
transferLength- The bytes which should be transferred in the following data phase (Zero if no data phase).direction- The direction the data shall be transferred in the data phase. If there is no data phase it should be#NONE NONElun- The logical unit number the command is directed to.cbwcbLength- The length in bytes of the scsi command.
-
-
Method Detail
-
serialize
public void serialize(java.nio.ByteBuffer buffer)
Serializes the command block wrapper for transmission.This method should be called in every subclass right before the specific SCSI command serializes itself to the buffer!
- Parameters:
buffer- The buffer were the serialized data should be copied to.
-
getdCbwTag
public int getdCbwTag()
Returns the tag which can be used to determine the correspondingCBW.- Returns:
- The command block wrapper tag.
- See Also:
#getdCswTag()
-
setdCbwTag
public void setdCbwTag(int dCbwTag)
Sets the tag which can be used to determine the correspondingCBW.- Parameters:
dCbwTag- The command block wrapper tag- See Also:
#getdCswTag()
-
getdCbwDataTransferLength
public int getdCbwDataTransferLength()
Returns the amount of bytes which should be transmitted in the data phase.- Returns:
- The length in bytes.
-
getDirection
public CommandBlockWrapper.Direction getDirection()
Returns the direction in the data phase.- Returns:
- The direction.
- See Also:
Direction
-
-