// Path: src/main/java/commandwrappers/CommandBlockWrapper.java
// public class CommandBlockWrapper extends CommandWrapper
// {
//     private int dCBWSignature;
//     private int dCBWTag;
//     private int dCBWDataLength;
//     private byte bmCBWFlags;
//     private byte bCBWLUN;
//     private byte bCBWCBLength;
//     private byte[] commandBlock;
// 
// 
//     public CommandBlockWrapper(int dCBWSignature, int dCBWTag, int dCBWDataLength,
//                                byte bmCBWFlags, byte bCBWLUN, byte bCBWCBLength)
//     {
//         this.dCBWSignature = dCBWSignature;
//         this.dCBWTag = dCBWTag;
//         this.dCBWDataLength = dCBWDataLength;
//         this.bmCBWFlags = bmCBWFlags;
//         this.bCBWLUN = bCBWLUN;
//         this.bCBWCBLength = bCBWCBLength;
//     }
// 
//     public CommandBlockWrapper( int dCBWDataLength,
//                                 byte bmCBWFlags, byte bCBWLUN, byte bCBWCBLength)
//     {
//         this.dCBWSignature = CommandWrapper.CBW_SIGNATURE;
//         this.dCBWTag = generateTag();
//         this.dCBWDataLength = dCBWDataLength;
//         this.bmCBWFlags = bmCBWFlags;
//         this.bCBWLUN = bCBWLUN;
//         this.bCBWCBLength = bCBWCBLength;
//     }
// 
//     public void setCommandBlock(byte[] commandBlock)
//     {
//         this.commandBlock = commandBlock;
//     }
// 
//     public int getdCBWDataLength()
//     {
//         return dCBWDataLength;
//     }
// 
//     public int generateTag()
//     {
//         Random random = new Random();
//         return random.nextInt();
//     }
// 
//     @Override
//     public byte[] getCWBuffer()
//     {
//         ByteBuffer buffer = ByteBuffer.allocate(CBW_SIZE);
//         buffer.putInt(EndianessUtil.swapEndianess(dCBWSignature));
//         buffer.putInt(dCBWTag);
//         buffer.putInt(EndianessUtil.swapEndianess(dCBWDataLength));
//         buffer.put(bmCBWFlags);
//         buffer.put(bCBWLUN);
//         buffer.put(bCBWCBLength);
//         buffer.put(commandBlock);
//         return buffer.array();
//     }
// }


import java.nio.ByteBuffer;
import commandwrappers.CommandBlockWrapper;
package com.felhr.usbmassstorageforandroid.scsi;



/**
 * Created by Felipe Herranz(felhr85@gmail.com) on 23/12/14.
 */
public class SCSIReportLuns extends SCSICommand
{
    public static final byte REPORTLUNS_OPERATION_CODE = (byte) 0xa0;

    private int selectReport; // 1 byte
    private int allocationLength; // 2 bytes
    private byte control;

    public SCSIReportLuns(int selectReport, int allocationLength)
    {
        this.dataTransportPhase = true;
        this.direction = 1;
        this.selectReport = selectReport;
        this.allocationLength = allocationLength;
        this.control = 0x00;
    }

    @Override
    public byte[] getSCSICommandBuffer()
    {
        ByteBuffer buffer = ByteBuffer.allocate(9);
        buffer.put(REPORTLUNS_OPERATION_CODE);
        buffer.put((byte) 0x00);
        buffer.put(convertToByte(selectReport, 1));
        buffer.put((byte) 0x00);
        buffer.put((byte) 0x00);
        buffer.put(convertToByte(allocationLength, 2));
        buffer.put((byte) 0x00);
        buffer.put(control);
        return buffer.array();
    }

    @Override
// Path: src/main/java/commandwrappers/CommandBlockWrapper.java
// public class CommandBlockWrapper extends CommandWrapper
// {
//     private int dCBWSignature;
//     private int dCBWTag;
//     private int dCBWDataLength;
//     private byte bmCBWFlags;
//     private byte bCBWLUN;
//     private byte bCBWCBLength;
//     private byte[] commandBlock;
// 
// 
//     public CommandBlockWrapper(int dCBWSignature, int dCBWTag, int dCBWDataLength,
//                                byte bmCBWFlags, byte bCBWLUN, byte bCBWCBLength)
//     {
//         this.dCBWSignature = dCBWSignature;
//         this.dCBWTag = dCBWTag;
//         this.dCBWDataLength = dCBWDataLength;
//         this.bmCBWFlags = bmCBWFlags;
//         this.bCBWLUN = bCBWLUN;
//         this.bCBWCBLength = bCBWCBLength;
//     }
// 
//     public CommandBlockWrapper( int dCBWDataLength,
//                                 byte bmCBWFlags, byte bCBWLUN, byte bCBWCBLength)
//     {
//         this.dCBWSignature = CommandWrapper.CBW_SIGNATURE;
//         this.dCBWTag = generateTag();
//         this.dCBWDataLength = dCBWDataLength;
//         this.bmCBWFlags = bmCBWFlags;
//         this.bCBWLUN = bCBWLUN;
//         this.bCBWCBLength = bCBWCBLength;
//     }
// 
//     public void setCommandBlock(byte[] commandBlock)
//     {
//         this.commandBlock = commandBlock;
//     }
// 
//     public int getdCBWDataLength()
//     {
//         return dCBWDataLength;
//     }
// 
//     public int generateTag()
//     {
//         Random random = new Random();
//         return random.nextInt();
//     }
// 
//     @Override
//     public byte[] getCWBuffer()
//     {
//         ByteBuffer buffer = ByteBuffer.allocate(CBW_SIZE);
//         buffer.putInt(EndianessUtil.swapEndianess(dCBWSignature));
//         buffer.putInt(dCBWTag);
//         buffer.putInt(EndianessUtil.swapEndianess(dCBWDataLength));
//         buffer.put(bmCBWFlags);
//         buffer.put(bCBWLUN);
//         buffer.put(bCBWCBLength);
//         buffer.put(commandBlock);
//         return buffer.array();
//     }
// }


// Path: src/main/java/com/felhr/usbmassstorageforandroid/scsi/SCSIReportLuns.java
import java.nio.ByteBuffer;
import commandwrappers.CommandBlockWrapper;

package com.felhr.usbmassstorageforandroid.scsi;



/**
 * Created by Felipe Herranz(felhr85@gmail.com) on 23/12/14.
 */
public class SCSIReportLuns extends SCSICommand
{
    public static final byte REPORTLUNS_OPERATION_CODE = (byte) 0xa0;

    private int selectReport; // 1 byte
    private int allocationLength; // 2 bytes
    private byte control;

    public SCSIReportLuns(int selectReport, int allocationLength)
    {
        this.dataTransportPhase = true;
        this.direction = 1;
        this.selectReport = selectReport;
        this.allocationLength = allocationLength;
        this.control = 0x00;
    }

    @Override
    public byte[] getSCSICommandBuffer()
    {
        ByteBuffer buffer = ByteBuffer.allocate(9);
        buffer.put(REPORTLUNS_OPERATION_CODE);
        buffer.put((byte) 0x00);
        buffer.put(convertToByte(selectReport, 1));
        buffer.put((byte) 0x00);
        buffer.put((byte) 0x00);
        buffer.put(convertToByte(allocationLength, 2));
        buffer.put((byte) 0x00);
        buffer.put(control);
        return buffer.array();
    }

    @Override
    public CommandBlockWrapper getCbw()