package com.github.mjdev.libaums.driver.scsi.commands;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/* JADX INFO: loaded from: classes.dex */
public abstract class CommandBlockWrapper {
    private static final int D_CBW_SIGNATURE = 1128420181;
    private byte bCbwLun;
    private byte bCbwcbLength;
    private byte bmCbwFlags;
    protected int dCbwDataTransferLength;
    private int dCbwTag;
    private Direction direction;

    public enum Direction {
        IN,
        OUT,
        NONE
    }

    protected CommandBlockWrapper(int i, Direction direction, byte b, byte b2) {
        this.dCbwDataTransferLength = i;
        this.direction = direction;
        if (direction == Direction.IN) {
            this.bmCbwFlags = (byte) -128;
        }
        this.bCbwLun = b;
        this.bCbwcbLength = b2;
    }

    public void serialize(ByteBuffer byteBuffer) {
        byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
        byteBuffer.putInt(D_CBW_SIGNATURE);
        byteBuffer.putInt(this.dCbwTag);
        byteBuffer.putInt(this.dCbwDataTransferLength);
        byteBuffer.put(this.bmCbwFlags);
        byteBuffer.put(this.bCbwLun);
        byteBuffer.put(this.bCbwcbLength);
    }

    public int getdCbwTag() {
        return this.dCbwTag;
    }

    public void setdCbwTag(int i) {
        this.dCbwTag = i;
    }

    public int getdCbwDataTransferLength() {
        return this.dCbwDataTransferLength;
    }

    public Direction getDirection() {
        return this.direction;
    }
}
