package com.ifpdos.mcusdk;

import android.os.Parcel;
import android.os.Parcelable;
import d.f.a.r2.h3;

/* JADX INFO: loaded from: classes.dex */
public class McuCommonBase implements Parcelable {
    public static final Parcelable.Creator<McuCommonBase> CREATOR = new a();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f2015b;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Byte f2016e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public Byte f2017f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public Byte f2018g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public Byte f2019h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public byte[] f2020i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public Byte f2021j;

    public static class a implements Parcelable.Creator<McuCommonBase> {
        @Override // android.os.Parcelable.Creator
        public McuCommonBase createFromParcel(Parcel parcel) {
            return new McuCommonBase(parcel);
        }

        @Override // android.os.Parcelable.Creator
        public McuCommonBase[] newArray(int i2) {
            return new McuCommonBase[i2];
        }
    }

    public McuCommonBase(int i2, Byte b2, Byte b3, byte[] bArr, Byte b4) {
        Byte bValueOf = Byte.valueOf(b(bArr) ? bArr[0] : (byte) 0);
        bArr = b(bArr) ? bArr : new byte[]{0};
        Byte bValueOf2 = Byte.valueOf(b(bArr) ? bArr[bArr.length - 1] : (byte) 0);
        this.f2015b = i2;
        this.f2016e = b2;
        this.f2018g = b3;
        this.f2019h = bValueOf;
        this.f2020i = bArr;
        this.f2021j = bValueOf2;
        this.f2017f = b4;
    }

    public static boolean b(byte[] bArr) {
        return bArr != null && bArr.length > 0;
    }

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

    public String toString() {
        StringBuilder sbB = d.b.a.a.a.B("[ ");
        sbB.append(d.f.c.a.values()[this.f2015b]);
        sbB.append(" ]: [ ");
        sbB.append(h3.e(this.f2016e.byteValue()));
        sbB.append(" ] [ ");
        sbB.append(h3.e(this.f2018g.byteValue()));
        sbB.append(" ][ ");
        sbB.append(h3.d(this.f2020i));
        sbB.append(" ]");
        return sbB.toString();
    }

    @Override // android.os.Parcelable
    public void writeToParcel(Parcel parcel, int i2) {
        parcel.writeInt(this.f2015b);
        if (this.f2016e == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeByte(this.f2016e.byteValue());
        }
        if (this.f2017f == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeByte(this.f2017f.byteValue());
        }
        if (this.f2018g == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeByte(this.f2018g.byteValue());
        }
        if (this.f2019h == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeByte(this.f2019h.byteValue());
        }
        parcel.writeByteArray(this.f2020i);
        if (this.f2021j == null) {
            parcel.writeByte((byte) 0);
        } else {
            parcel.writeByte((byte) 1);
            parcel.writeByte(this.f2021j.byteValue());
        }
    }

    public McuCommonBase(Parcel parcel) {
        this.f2015b = parcel.readInt();
        if (parcel.readByte() == 0) {
            this.f2016e = null;
        } else {
            this.f2016e = Byte.valueOf(parcel.readByte());
        }
        if (parcel.readByte() == 0) {
            this.f2017f = null;
        } else {
            this.f2017f = Byte.valueOf(parcel.readByte());
        }
        if (parcel.readByte() == 0) {
            this.f2018g = null;
        } else {
            this.f2018g = Byte.valueOf(parcel.readByte());
        }
        if (parcel.readByte() == 0) {
            this.f2019h = null;
        } else {
            this.f2019h = Byte.valueOf(parcel.readByte());
        }
        this.f2020i = parcel.createByteArray();
        if (parcel.readByte() == 0) {
            this.f2021j = null;
        } else {
            this.f2021j = Byte.valueOf(parcel.readByte());
        }
    }
}
