package com.cvte.vman.impl;

import android.os.Parcel;
import com.cvte.vman.FwUpgrade;
import com.cvte.vman.VmanMiddleWare;
import com.cvte.vman.entity.EntityFwInfoType;
import com.cvte.vman.entity.EntityFwInfoU3HUB;
import com.cvte.vman.entity.EntityFwLocalDimming;
import com.cvte.vman.entity.EntityFwMcu;
import com.cvte.vman.instance.InvokeCmd;
import com.cvte.vman.types.EnumFwInfoType;
import com.cvte.vman.types.EnumFwInfoTypecLocation;
import com.cvte.vman.types.EnumFwInfoU3HUBLocation;
import com.cvte.vman.types.EnumFwInfoU3HUBSwitchLogic;
import com.cvte.vman.types.EnumFwInfoU3HUBType;
import com.cvte.vman.types.EnumMcuType;
import com.cvte.vman.utils.CLog;
import d.b.a.a.a;
import java.util.ArrayList;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public class FwUpgradeManager extends FwUpgrade {
    public static final int STAT_FU_UPGRADE_ERROR = 2;
    public static final int STAT_FU_UPGRADE_RUNNING = 1;
    public static final int STAT_FU_UPGRADE_SUCCESS = 0;
    public static final int TYPE_FW_ARRAY_MIC_VERSION = 56;
    public static final int TYPE_FW_AX88179_VERSION = 14;
    public static final int TYPE_FW_BITMOTION_VERSION = 64;
    public static final int TYPE_FW_CAMERA_SSC9381_VERSION = 44;
    public static final int TYPE_FW_CAMERA_VERSION = 51;
    public static final int TYPE_FW_CVTE_CAMERA = 1000;
    public static final int TYPE_FW_EXT_1_LT8711UXE1_VERSION = 21;
    public static final int TYPE_FW_EXT_1_LT8711_VERSION = 18;
    public static final int TYPE_FW_EXT_IT66311_VERSION = 37;
    public static final int TYPE_FW_GSV2201_VERSION = 62;
    public static final int TYPE_FW_GSV2202_VERSION = 65;
    public static final int TYPE_FW_GSV2702_VERSION = 36;
    public static final int TYPE_FW_GSV2705_VERSION = 58;
    public static final int TYPE_FW_GSV2712_VERSION = 54;
    public static final int TYPE_FW_GSV2715_FRONT_VERSION = 68;
    public static final int TYPE_FW_GSV2715_VERSION = 57;
    public static final int TYPE_FW_GSV6715_VERSION = 25;
    public static final int TYPE_FW_HDMI1_EDID_VERSION = 46;
    public static final int TYPE_FW_HDMI2_EDID_VERSION = 47;
    public static final int TYPE_FW_HDMI3_EDID_VERSION = 48;
    public static final int TYPE_FW_IOBOX_GSV2715_VERSION = 33;
    public static final int TYPE_FW_IOBOX_VERSION = 32;
    public static final int TYPE_FW_IOBOX_VGA_EDID_VERSION = 38;
    public static final int TYPE_FW_IT6563_VERSION = 13;
    public static final int TYPE_FW_IT68353_VERSION = 67;
    public static final int TYPE_FW_LED_CONTROL_VERSION = 42;
    public static final int TYPE_FW_LOCALDIMMING_VERSION = 41;
    public static final int TYPE_FW_LT6911UXE_A_VERSION = 60;
    public static final int TYPE_FW_LT6911UXE_B_VERSION = 61;
    public static final int TYPE_FW_LT7911_VERSION = 22;
    public static final int TYPE_FW_LT8668SXC_VERSION = 23;
    public static final int TYPE_FW_LT8668SX_VERSION = 24;
    public static final int TYPE_FW_LT8668_VERSION = 16;
    public static final int TYPE_FW_LT9611UXC_VERSION = 59;
    public static final int TYPE_FW_MAIN_1_LT8711UXE1_VERSION = 17;
    public static final int TYPE_FW_MOTOR_VERSION = 28;
    public static final int TYPE_FW_PC_EDID_VERSION = 45;
    public static final int TYPE_FW_PC_MCU_VERSION = 66;
    public static final int TYPE_FW_RTD2172_VERSION = 35;
    public static final int TYPE_FW_RTS545x_VERSION = 34;
    public static final int TYPE_FW_SRSM_SENSOR_VERSION = 11;
    public static final int TYPE_FW_TEA3308_VERSION = 26;
    public static final int TYPE_FW_TOUCHDRIVER_VERSION = 15;
    public static final int TYPE_FW_TXB_VERSION = 63;
    public static final int TYPE_FW_TYPEC1_EDID_VERSION = 49;
    public static final int TYPE_FW_TYPEC2_EDID_VERSION = 50;
    public static final int TYPE_FW_TYPEC_INTEG_1_VERSION = 30;
    public static final int TYPE_FW_TYPEC_INTEG_2_VERSION = 31;
    public static final int TYPE_FW_U3HUB_7817_VERSION = 53;
    public static final int TYPE_FW_U3HUB_8817_VERSION = 52;
    public static final int TYPE_FW_U3HUB_VERSION = 12;
    public static final int TYPE_FW_ULTRASONIC_VERSION = 55;
    public static final int TYPE_FW_UPGRADE_ARRAY_MIC = 58;
    public static final int TYPE_FW_UPGRADE_AX88179A = 14;
    public static final int TYPE_FW_UPGRADE_BITMOTION = 56;
    public static final int TYPE_FW_UPGRADE_DP2MIPI = 36;
    public static final int TYPE_FW_UPGRADE_DP2MIPI_VERSION = 40;
    public static final int TYPE_FW_UPGRADE_EXT_1_LT8711 = 19;
    public static final int TYPE_FW_UPGRADE_EXT_1_LT8711UXE1 = 21;
    public static final int TYPE_FW_UPGRADE_EXT_IT66311 = 33;
    public static final int TYPE_FW_UPGRADE_GSV2201 = 55;
    public static final int TYPE_FW_UPGRADE_GSV2202 = 59;
    public static final int TYPE_FW_UPGRADE_GSV2702 = 39;
    public static final int TYPE_FW_UPGRADE_GSV2705 = 48;
    public static final int TYPE_FW_UPGRADE_GSV2712 = 46;
    public static final int TYPE_FW_UPGRADE_GSV2715 = 47;
    public static final int TYPE_FW_UPGRADE_GSV2715_FRONT = 61;
    public static final int TYPE_FW_UPGRADE_GSV6715 = 25;
    public static final int TYPE_FW_UPGRADE_IOBOX = 30;
    public static final int TYPE_FW_UPGRADE_IOBOX_GSV2715 = 31;
    public static final int TYPE_FW_UPGRADE_IOBOX_VGA_EDID = 57;
    public static final int TYPE_FW_UPGRADE_IT6563 = 13;
    public static final int TYPE_FW_UPGRADE_IT66311_HDMIOUT = 3;
    public static final int TYPE_FW_UPGRADE_IT66311_PC = 2;
    public static final int TYPE_FW_UPGRADE_IT68353 = 60;
    public static final int TYPE_FW_UPGRADE_KT_AUDIO = 35;
    public static final int TYPE_FW_UPGRADE_KT_AUDIO_VERSION = 39;
    public static final int TYPE_FW_UPGRADE_LED_CONTROL = 41;
    public static final int TYPE_FW_UPGRADE_LOCALDIMMING = 40;
    public static final int TYPE_FW_UPGRADE_LT6911UXE_A = 50;
    public static final int TYPE_FW_UPGRADE_LT6911UXE_B = 51;
    public static final int TYPE_FW_UPGRADE_LT7911 = 22;
    public static final int TYPE_FW_UPGRADE_LT8668 = 15;
    public static final int TYPE_FW_UPGRADE_LT8668SX = 24;
    public static final int TYPE_FW_UPGRADE_LT8668SXC = 23;
    public static final int TYPE_FW_UPGRADE_LT8711_15W = 4;
    public static final int TYPE_FW_UPGRADE_LT8711_30W = 5;
    public static final int TYPE_FW_UPGRADE_LT8711_65W = 6;
    public static final int TYPE_FW_UPGRADE_LT9611UXC = 49;
    public static final int TYPE_FW_UPGRADE_MAIN_1_LT8711UXE1 = 18;
    public static final int TYPE_FW_UPGRADE_MCU = 1;
    public static final int TYPE_FW_UPGRADE_MCU_VERSION = 1;
    public static final int TYPE_FW_UPGRADE_MOTOR = 16;
    public static final int TYPE_FW_UPGRADE_RK3308B = 10;
    public static final int TYPE_FW_UPGRADE_RK3308B_VERSION = 10;
    public static final int TYPE_FW_UPGRADE_RK3308HS = 9;
    public static final int TYPE_FW_UPGRADE_RK3308HS_VERSION = 9;
    public static final int TYPE_FW_UPGRADE_RTD2172 = 8;
    public static final int TYPE_FW_UPGRADE_RTS545x = 7;
    public static final int TYPE_FW_UPGRADE_SOURCESW_INTEG_1 = 52;
    public static final int TYPE_FW_UPGRADE_SOURCESW_INTEG_2 = 53;
    public static final int TYPE_FW_UPGRADE_SOURCESW_INTEG_3 = 54;
    public static final int TYPE_FW_UPGRADE_SRSM_SENSOR = 11;
    public static final int TYPE_FW_UPGRADE_TEA3308 = 26;
    public static final int TYPE_FW_UPGRADE_TOUCHBIN = 32;
    public static final int TYPE_FW_UPGRADE_TXB = 17;
    public static final int TYPE_FW_UPGRADE_TYPEC_INTEG_1 = 28;
    public static final int TYPE_FW_UPGRADE_TYPEC_INTEG_2 = 29;
    public static final int TYPE_FW_UPGRADE_U3HUB_7817 = 44;
    public static final int TYPE_FW_UPGRADE_U3HUB_8817 = 43;
    public static final int TYPE_FW_UPGRADE_ULTRASONIC = 45;
    public static final int TYPE_FW_UPGRADE_VGA_EDID = 34;
    public static final int TYPE_FW_UPGRADE_VIEWSONIC_SENSORBOX = 20;
    public static final int TYPE_FW_UPGRADE_VL211_HUB = 38;
    public static final int TYPE_FW_UPGRADE_VL817_HUB = 27;
    public static final int TYPE_FW_UPGRADE_VLI817_103 = 12;
    public static final int TYPE_FW_UPGRADE_ZYZH_CAMERA = 37;
    public static final int TYPE_FW_UPGRADE_ZYZH_CAMERA_IPL = 42;
    public static final int TYPE_FW_VGA_EDID_VERSION = 29;
    public static final int TYPE_FW_VIEWSONIC_SENSORBOX_VERSION = 20;
    public static final int TYPE_FW_VL211_HUB_VERSION = 43;
    public static final int TYPE_FW_VL817_HUB_VERSION = 27;
    public static final int TYPE_FW_ZYZH_CAMERA = 1001;
    private static FwUpgradeManager mFwUpgradeManager;

    private FwUpgradeManager() {
    }

    public static synchronized FwUpgradeManager getInstance() {
        if (mFwUpgradeManager == null) {
            synchronized (FwUpgradeManager.class) {
                if (mFwUpgradeManager == null) {
                    mFwUpgradeManager = new FwUpgradeManager();
                }
            }
        }
        return mFwUpgradeManager;
    }

    @Override // com.cvte.vman.FwUpgrade
    public String catVersionFromTxt(String str) {
        return VmanMiddleWare.getInstance().excuteCommandSet_Str(InvokeCmd.CMD_FW_UPGRADE_CAT_VERSION_FROM_TXT, str);
    }

    @Override // com.cvte.vman.FwUpgrade
    public int clrMcuFwNeedUpStat() {
        return VmanMiddleWare.getInstance().excuteCommandSet_int(InvokeCmd.CMD_FW_UPGRADE_CLR_MCU_NEED_UPGRADE_STAT);
    }

    @Override // com.cvte.vman.FwUpgrade
    public int getFirmwareUpgradestat(int i2) {
        return VmanMiddleWare.getInstance().excuteCommandSet_int(InvokeCmd.CMD_FW_UPGRADE_GET_UPGRADE_STAT, i2);
    }

    @Override // com.cvte.vman.FwUpgrade
    public List<EntityFwInfoType> getFwInfoTypecList() {
        String strSubstring;
        new ArrayList();
        List<EntityFwInfoType> fwInfoTypecList2 = getFwInfoTypecList2();
        StringBuilder sbB = a.B("fwInfoTypecList.size() = ");
        sbB.append(fwInfoTypecList2.size());
        CLog.d(sbB.toString());
        if (fwInfoTypecList2.size() != 0) {
            return fwInfoTypecList2;
        }
        Parcel parcelExcuteCommandSet_Parcel = VmanMiddleWare.getInstance().excuteCommandSet_Parcel(InvokeCmd.CMD_FW_UPGRADE_GET_TYPEC_FW_LIST);
        parcelExcuteCommandSet_Parcel.readInt();
        parcelExcuteCommandSet_Parcel.dataSize();
        String string = parcelExcuteCommandSet_Parcel.readString();
        parcelExcuteCommandSet_Parcel.recycle();
        if (string == null || !string.contains("fwinfotypec_list=") || string.indexOf("fwinfotypec_list=") < 0 || (strSubstring = string.substring(string.indexOf("fwinfotypec_list=") + 17)) == null) {
            return fwInfoTypecList2;
        }
        for (String str : strSubstring.split("#")) {
            String[] strArrSplit = str.split(";");
            if (strArrSplit.length >= 8) {
                try {
                    int i2 = Integer.parseInt(strArrSplit[0]);
                    String str2 = strArrSplit[1];
                    int i3 = Integer.parseInt(strArrSplit[2]);
                    int i4 = Integer.parseInt(strArrSplit[3]);
                    boolean z = Integer.parseInt(strArrSplit[4]) != 0;
                    String str3 = strArrSplit[5];
                    boolean z2 = Integer.parseInt(strArrSplit[6]) != 0;
                    String str4 = strArrSplit[7];
                    String str5 = strArrSplit[8];
                    EnumFwInfoType enumFwInfoTypeValueOf = EnumFwInfoType.valueOf(i2);
                    if (enumFwInfoTypeValueOf.compareTo(EnumFwInfoType.FW_INFO_TYPE_TYPEC_INTEG_MAX) < 0) {
                        if (strArrSplit.length == 10) {
                            fwInfoTypecList2.add(new EntityFwInfoType(enumFwInfoTypeValueOf, str2, i3, i4, z, str3, z2, str4, EnumFwInfoTypecLocation.valueOf(Integer.parseInt(strArrSplit[8])), strArrSplit[9], str5));
                        } else {
                            fwInfoTypecList2.add(new EntityFwInfoType(enumFwInfoTypeValueOf, str2, i3, i4, z, str3, z2, str4, str5));
                        }
                    }
                } catch (NumberFormatException e2) {
                    e2.printStackTrace();
                }
            }
        }
        return fwInfoTypecList2;
    }

    @Override // com.cvte.vman.FwUpgrade
    public List<EntityFwInfoType> getFwInfoTypecList2() {
        ArrayList arrayList = new ArrayList();
        Parcel parcelD0 = a.d0(InvokeCmd.CMD_FW_UPGRADE_GET_TYPEC_FW_LIST_2);
        int i2 = parcelD0.readInt();
        a.M("fwInfoSize: ", i2);
        for (int i3 = 0; i3 < i2; i3++) {
            EntityFwInfoType entityFwInfoType = new EntityFwInfoType();
            entityFwInfoType.typeId = EnumFwInfoType.valueOf(parcelD0.readInt());
            entityFwInfoType.upFwType = parcelD0.readInt();
            entityFwInfoType.fwVerType = parcelD0.readInt();
            entityFwInfoType.version = parcelD0.readString();
            entityFwInfoType.needUDiskUp = parcelD0.readBoolean();
            entityFwInfoType.fwNameUDiskUp = parcelD0.readString();
            entityFwInfoType.needOtaUp = parcelD0.readBoolean();
            entityFwInfoType.fwPathOtaUp = parcelD0.readString();
            entityFwInfoType.location = EnumFwInfoTypecLocation.valueOf(parcelD0.readInt());
            entityFwInfoType.fwOtakey = parcelD0.readString();
            entityFwInfoType.currentVersion = parcelD0.readString();
            if (entityFwInfoType.typeId.ordinal() >= EnumFwInfoType.FW_INFO_TYPE_TYPEC_INTEG_1.ordinal() && entityFwInfoType.typeId.ordinal() < EnumFwInfoType.FW_INFO_TYPE_MAX.ordinal()) {
                arrayList.add(entityFwInfoType);
            }
        }
        parcelD0.recycle();
        return arrayList;
    }

    @Override // com.cvte.vman.FwUpgrade
    public List<EntityFwInfoU3HUB> getFwInfoU3HUBList() {
        ArrayList arrayList = new ArrayList();
        Parcel parcelD0 = a.d0(InvokeCmd.CMD_FW_UPGRADE_GET_U3HUB_FW_LIST);
        int i2 = parcelD0.readInt();
        for (int i3 = 0; i3 < i2; i3++) {
            EntityFwInfoU3HUB entityFwInfoU3HUB = new EntityFwInfoU3HUB();
            entityFwInfoU3HUB.typeId = EnumFwInfoU3HUBType.valueOf(parcelD0.readInt());
            entityFwInfoU3HUB.location = EnumFwInfoU3HUBLocation.valueOf(parcelD0.readInt());
            entityFwInfoU3HUB.upFwType = parcelD0.readInt();
            entityFwInfoU3HUB.fwVerType = parcelD0.readInt();
            entityFwInfoU3HUB.version = parcelD0.readString();
            entityFwInfoU3HUB.needUDiskUp = parcelD0.readBoolean();
            entityFwInfoU3HUB.fwNameUDiskUp = parcelD0.readString();
            entityFwInfoU3HUB.needOtaUp = parcelD0.readBoolean();
            entityFwInfoU3HUB.fwOtaLocalPath = parcelD0.readString();
            entityFwInfoU3HUB.fwOtakey = parcelD0.readString();
            entityFwInfoU3HUB.fwOtaModule = parcelD0.readString();
            entityFwInfoU3HUB.switchLogic = EnumFwInfoU3HUBSwitchLogic.valueOf(parcelD0.readInt());
            entityFwInfoU3HUB.curVersion = parcelD0.readString();
            if (entityFwInfoU3HUB.typeId.ordinal() > EnumFwInfoU3HUBType.FW_INFO_TYPE_U3HUB_INVALID.ordinal() && entityFwInfoU3HUB.typeId.ordinal() < EnumFwInfoU3HUBType.FW_INFO_TYPE_MAX.ordinal()) {
                arrayList.add(entityFwInfoU3HUB);
            }
        }
        parcelD0.recycle();
        return arrayList;
    }

    @Override // com.cvte.vman.FwUpgrade
    public List<EntityFwLocalDimming> getFwLocalDimmingList() {
        return new ArrayList();
    }

    @Override // com.cvte.vman.FwUpgrade
    public List<EntityFwMcu> getFwMcuList() {
        ArrayList arrayList = new ArrayList();
        Parcel parcelD0 = a.d0(InvokeCmd.CMD_FW_UPGRADE_GET_MCU_FW_LIST);
        int i2 = parcelD0.readInt();
        for (int i3 = 0; i3 < i2; i3++) {
            EntityFwMcu entityFwMcu = new EntityFwMcu();
            entityFwMcu.mcuType = EnumMcuType.valueOf(parcelD0.readInt());
            entityFwMcu.fwMcuType = parcelD0.readInt();
            String string = parcelD0.readString();
            entityFwMcu.mcuCurrentVersion = string;
            if (string.equals("")) {
                entityFwMcu.mcuCurrentVersion = null;
            }
            boolean z = true;
            entityFwMcu.isSupportUsbUpgrade = parcelD0.readInt() == 1;
            entityFwMcu.usbUpgradeMcuBinName = parcelD0.readString();
            entityFwMcu.isSupportOtaUpgrade = parcelD0.readInt() == 1;
            entityFwMcu.otaUpgradeMcuBinPath = parcelD0.readString();
            entityFwMcu.otaMcuBasicBinVersion = parcelD0.readString();
            entityFwMcu.otaMcuKey = parcelD0.readString();
            if (parcelD0.readInt() != 1) {
                z = false;
            }
            entityFwMcu.needRebootWhenUpgraded = z;
            arrayList.add(entityFwMcu);
        }
        parcelD0.recycle();
        return arrayList;
    }

    @Override // com.cvte.vman.FwUpgrade
    public String getFwOTAkey(int i2) {
        return VmanMiddleWare.getInstance().excuteCommandSet_Str(InvokeCmd.CMD_FW_UPGRADE_GET_FW_OTAKEY, i2);
    }

    @Override // com.cvte.vman.FwUpgrade
    public String getFwTargetBinPath(int i2) {
        return VmanMiddleWare.getInstance().excuteCommandSet_Str(InvokeCmd.CMD_FW_UPGRADE_GET_FW_TARGET_BIN_PATH, i2);
    }

    @Override // com.cvte.vman.FwUpgrade
    public String getFwTargetVersion(int i2) {
        return VmanMiddleWare.getInstance().excuteCommandSet_Str(InvokeCmd.CMD_FW_UPGRADE_GET_FW_TARGET_VERSION, i2);
    }

    @Override // com.cvte.vman.FwUpgrade
    public String getFwVersion(int i2) {
        return VmanMiddleWare.getInstance().excuteCommandSet_Str(InvokeCmd.CMD_FW_UPGRADE_GET_FW_VERSION, i2);
    }

    @Override // com.cvte.vman.FwUpgrade
    public String getMcuBinNameToUp() {
        return VmanMiddleWare.getInstance().excuteCommandSet_Str(InvokeCmd.CMD_FW_UPGRADE_GET_MCU_BIN_NAME);
    }

    @Override // com.cvte.vman.FwUpgrade
    public int getMcuFwNeedUpStat() {
        return VmanMiddleWare.getInstance().excuteCommandSet_int(InvokeCmd.CMD_FW_UPGRADE_GET_MCU_NEED_UPGRADE_STAT);
    }

    @Override // com.cvte.vman.FwUpgrade
    public int setFirmwareUpgrade(int i2, String str) {
        return VmanMiddleWare.getInstance().excuteCommandSet_int(3585, str, i2);
    }

    @Override // com.cvte.vman.FwUpgrade
    public String getMcuBinNameToUp(int i2) {
        return VmanMiddleWare.getInstance().excuteCommandSet_Str(InvokeCmd.CMD_FW_UPGRADE_GET_MCU_BIN_NAME_TYPE, i2);
    }
}
