package com.dowse.base.param.device;

import com.dowse.base.data.DSDeviceCustomInfo;
import com.dowse.base.log.DSLog;
import com.dowse.base.param.pic.ChannelPicConfig;
import com.dowse.base.param.pic.ChannelPicParam;
import com.dowse.base.param.pic.DSPicParam;
import com.dowse.base.param.video.ChannelConfig;
import com.dowse.base.param.video.ChannelOSD;
import com.dowse.base.param.video.ChannelOSDConfig;
import com.dowse.base.param.video.ChannelType;
import com.dowse.base.param.video.ChannelVideoConfig;
import com.dowse.base.param.video.ChannelVideoParam;
import com.dowse.base.param.video.DSChannel;
import com.dowse.base.param.video.DSOSDParam;
import com.dowse.base.param.video.DSStream;
import com.dowse.base.param.video.DSVideoParam;
import com.dowse.base.param.video.StreamType;
import com.dowse.base.util.DeviceUtil;
import java.util.ArrayList;
import java.util.List;

/* loaded from: ds_base_2.0.9_23030112.aar:classes.jar:com/dowse/base/param/device/DeviceConfigUtil.class */
public class DeviceConfigUtil {
    private static final String TAG = "DeviceConfigUtil";

    private static List<DSStream> getStreams(DeviceType deviceType) {
        List<DSStream> streams = new ArrayList<>();
        DSStream mainStream = new DSStream();
        mainStream.setStreamType(StreamType.MAIN_STREAM);
        DSStream subStream = new DSStream();
        subStream.setStreamType(StreamType.SUB_STREAM);
        DSStream threeStream = new DSStream();
        threeStream.setStreamType(StreamType.THIRD_STREAM);
        switch (AnonymousClass1.$SwitchMap$com$dowse$base$param$device$DeviceType[deviceType.ordinal()]) {
            case 1:
            case 2:
            case DeviceConst.SYSTEM_REBOOT /* 3 */:
                mainStream.setSupport(true);
                subStream.setSupport(false);
                threeStream.setSupport(false);
                break;
        }
        streams.add(mainStream);
        streams.add(subStream);
        streams.add(threeStream);
        return streams;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: com.dowse.base.param.device.DeviceConfigUtil$1  reason: invalid class name */
    /* loaded from: ds_base_2.0.9_23030112.aar:classes.jar:com/dowse/base/param/device/DeviceConfigUtil$1.class */
    public static /* synthetic */ class AnonymousClass1 {
        static final /* synthetic */ int[] $SwitchMap$com$dowse$base$param$device$DeviceType = new int[DeviceType.values().length];

        static {
            try {
                $SwitchMap$com$dowse$base$param$device$DeviceType[DeviceType.DS_BALL_NORMAL.ordinal()] = 1;
            } catch (NoSuchFieldError e) {
            }
            try {
                $SwitchMap$com$dowse$base$param$device$DeviceType[DeviceType.DS_DUAL_IRON.ordinal()] = 2;
            } catch (NoSuchFieldError e2) {
            }
            try {
                $SwitchMap$com$dowse$base$param$device$DeviceType[DeviceType.DS_DUAL_PLASTICS.ordinal()] = 3;
            } catch (NoSuchFieldError e3) {
            }
        }
    }

    private static List<DSChannel> getChannels(DeviceType deviceType) {
        List<DSChannel> channels = new ArrayList<>();
        switch (AnonymousClass1.$SwitchMap$com$dowse$base$param$device$DeviceType[deviceType.ordinal()]) {
            case 2:
                DSChannel channel_1 = new DSChannel();
                channel_1.setChannelType(ChannelType.MTK_CAMERA_FRONT_1);
                channel_1.setChannel(1);
                channel_1.setSdk_channel(1);
                channel_1.setEnable(true);
                channel_1.setStreams(getStreams(deviceType));
                channels.add(channel_1);
                DSChannel channel_2 = new DSChannel();
                channel_2.setChannelType(ChannelType.MTK_CAMERA_BACK_1);
                channel_2.setChannel(2);
                channel_2.setSdk_channel(2);
                channel_2.setEnable(true);
                channel_2.setStreams(getStreams(deviceType));
                channels.add(channel_2);
                break;
        }
        return channels;
    }

    private static DeviceType getDeviceType() {
        DeviceType deviceType = DeviceType.DS_DUAL_IRON;
        String model = DeviceUtil.getModel();
        DSLog.d(TAG, "model:" + model);
        return deviceType;
    }

    public static ChannelConfig getDefaultChannelConfig() {
        DeviceType deviceType = getDeviceType();
        ChannelConfig config = new ChannelConfig();
        config.setDeviceType(deviceType);
        config.setChannels(getChannels(deviceType));
        return config;
    }

    public static ChannelOSD getChannelOSD() {
        ChannelOSD channelOSD = new ChannelOSD();
        channelOSD.setTimeEnable(true);
        channelOSD.setInfoEnable(true);
        channelOSD.setTextOSDS(null);
        return channelOSD;
    }

    public static ChannelOSDConfig getDefaultChannelOSDConfig() {
        ChannelOSDConfig osdConfig = new ChannelOSDConfig();
        ChannelConfig channelConfig = getDefaultChannelConfig();
        List<DSOSDParam> osds = new ArrayList<>();
        if (channelConfig != null && channelConfig.getChannels() != null) {
            for (DSChannel channel : channelConfig.getChannels()) {
                DSOSDParam dsosdParam = new DSOSDParam();
                dsosdParam.setChannel(channel.getChannel());
                dsosdParam.setChannelOSD(getChannelOSD());
                osds.add(dsosdParam);
            }
        }
        osdConfig.setOsdList(osds);
        return osdConfig;
    }

    public static ChannelPicParam getChannelPicParam() {
        ChannelPicParam channelPicParam = new ChannelPicParam();
        channelPicParam.setColor(1);
        channelPicParam.setLuminance(80);
        channelPicParam.setSaturation(80);
        channelPicParam.setContrast(80);
        channelPicParam.setWidth(1920);
        channelPicParam.setHeight(1080);
        channelPicParam.setCompress_radio(100);
        return channelPicParam;
    }

    public static ChannelVideoParam getChannelVideoParam() {
        ChannelVideoParam channelVideoParam = new ChannelVideoParam();
        channelVideoParam.setBit_rate(8294400);
        channelVideoParam.setFrame_rate(24);
        channelVideoParam.setI_frame_interval(1);
        return channelVideoParam;
    }

    public static ChannelPicConfig getDefaultChannelPicConfig() {
        ChannelConfig channelConfig = getDefaultChannelConfig();
        ChannelPicConfig picConfig = new ChannelPicConfig();
        List<DSPicParam> pics = new ArrayList<>();
        if (channelConfig != null && channelConfig.getChannels() != null) {
            for (DSChannel channel : channelConfig.getChannels()) {
                DSPicParam dsPicParam = new DSPicParam();
                dsPicParam.setChannel(channel.getChannel());
                dsPicParam.setChannelPicParam(getChannelPicParam());
                pics.add(dsPicParam);
            }
        }
        picConfig.setPicParams(pics);
        return picConfig;
    }

    public static DSDeviceCustomInfo getDefaultDeviceCustomInfo() {
        DSDeviceCustomInfo customInfo = new DSDeviceCustomInfo();
        customInfo.setDeviceModel(DeviceUtil.getModel());
        customInfo.setDeviceName(DeviceUtil.getModel());
        customInfo.setDeviceVersion(DeviceUtil.getSysVer());
        customInfo.setProductionNo(DeviceUtil.getSN());
        customInfo.setManufacturerDate("");
        customInfo.setComponentId("");
        customInfo.setManufacturer("");
        return customInfo;
    }

    public static ChannelVideoConfig getDefaultChannelVideoConfig() {
        ChannelConfig channelConfig = getDefaultChannelConfig();
        ChannelVideoConfig videoConfig = new ChannelVideoConfig();
        List<DSVideoParam> videoParams = new ArrayList<>();
        if (channelConfig != null && channelConfig.getChannels() != null) {
            for (DSChannel channel : channelConfig.getChannels()) {
                DSVideoParam dsVideoParam = new DSVideoParam();
                dsVideoParam.setChannel(channel.getChannel());
                dsVideoParam.setChannelVideoParam(getChannelVideoParam());
                videoParams.add(dsVideoParam);
            }
        }
        videoConfig.setVideoParams(videoParams);
        return videoConfig;
    }
}
