package com.ifpdos.mcusdk;

import android.os.Parcel;
import android.os.Parcelable;
import com.ifpdos.mcusdk.McuCommandList;
import com.ifpdos.mcusdk.utils.ByteUtils;

/* JADX INFO: loaded from: classes.dex */
public class McuCommonResponse implements Parcelable {
    public static final Parcelable.Creator<McuCommonResponse> CREATOR = new Parcelable.Creator<McuCommonResponse>() { // from class: com.ifpdos.mcusdk.McuCommonResponse.1
        /* JADX WARN: Can't rename method to resolve collision */
        @Override // android.os.Parcelable.Creator
        public McuCommonResponse createFromParcel(Parcel parcel) {
            return new McuCommonResponse(parcel);
        }

        /* JADX WARN: Can't rename method to resolve collision */
        @Override // android.os.Parcelable.Creator
        public McuCommonResponse[] newArray(int i) {
            return new McuCommonResponse[i];
        }
    };
    protected byte[] bufferData;
    public boolean isTimeOut;
    private Byte mainId;
    public String result;
    public int status;
    private Byte subId;
    public int type;

    @Override // android.os.Parcelable
    public int describeContents() {
        return 0;
    }

    public McuCommonResponse(int i, Byte b, Byte b2, byte[] bArr, boolean z) {
        this.type = i;
        this.mainId = b;
        this.subId = b2;
        this.bufferData = bArr;
        this.isTimeOut = z;
    }

    public McuCommonResponse(int i, Byte b, Byte b2, byte[] bArr, boolean z, String str, int i2) {
        this.type = i;
        this.mainId = b;
        this.subId = b2;
        this.bufferData = bArr;
        this.isTimeOut = z;
        this.result = str;
        this.status = i2;
    }

    protected McuCommonResponse(Parcel parcel) {
        this.type = parcel.readInt();
        if (parcel.readByte() == 0) {
            this.mainId = null;
        } else {
            this.mainId = Byte.valueOf(parcel.readByte());
        }
        if (parcel.readByte() == 0) {
            this.subId = null;
        } else {
            this.subId = Byte.valueOf(parcel.readByte());
        }
        this.bufferData = parcel.createByteArray();
        this.isTimeOut = parcel.readByte() != 0;
        this.result = parcel.readString();
        this.status = parcel.readInt();
    }

    @Override // android.os.Parcelable
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.type);
        if (this.mainId == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeByte(this.mainId.byteValue());
        }
        if (this.subId == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeByte(this.subId.byteValue());
        }
        parcel.writeByteArray(this.bufferData);
        parcel.writeByte(this.isTimeOut ? (byte) 1 : (byte) 0);
        parcel.writeString(this.result);
        parcel.writeInt(this.status);
    }

    public int getType() {
        return this.type;
    }

    public Byte getMainId() {
        return this.mainId;
    }

    public Byte getSubId() {
        return this.subId;
    }

    public byte[] getBufferData() {
        return this.bufferData;
    }

    public String toString() {
        return "[ " + McuCommandList.CommandType.values()[this.type] + " ]: [ " + ByteUtils.changeByteToHexString(this.mainId.byteValue()) + " ] [ " + ByteUtils.changeByteToHexString(this.subId.byteValue()) + " ][ " + ByteUtils.changeByteArrayToString(this.bufferData) + " ] [ " + this.result + "] [ " + this.status + " ]";
    }
}
