package com.mstar.android.tv;

import android.os.RemoteException;
import android.util.Log;
import com.mstar.android.tvapi.common.exception.TvCommonException;
import com.mstar.android.tvapi.common.vo.EnumAntennaType;
import com.mstar.android.tvapi.common.vo.EnumProgramInfoType;
import com.mstar.android.tvapi.common.vo.ProgramInfo;
import com.mstar.android.tvapi.common.vo.ProgramInfoQueryCriteria;
import com.mstar.android.tvapi.common.vo.UserLocationSetting;
import com.mstar.android.tvapi.dtv.dvb.dvbs.vo.DvbsScanParam;
import com.mstar.android.tvapi.dtv.dvb.dvbs.vo.DvbsTransponderInfo;
import com.mstar.android.tvapi.dtv.dvb.dvbs.vo.LocationInfo;
import com.mstar.android.tvapi.dtv.dvb.dvbs.vo.SatelliteInfo;
import com.mstar.android.tvapi.dtv.dvb.vo.DvbRegionChannelListInfo;
import com.mstar.android.tvapi.dtv.dvb.vo.DvbTargetRegionInfo;
import com.mstar.android.tvapi.dtv.dvb.vo.EwsInfo;

/* JADX INFO: loaded from: classes.dex */
public class TvDvbChannelManager extends TvChannelManager {
    public static final int AUTO_UPDATE_TYPE_DVB_NETWORK_CHG = 6;
    public static final int AUTO_UPDATE_TYPE_FREQ_CHG = 3;
    public static final int AUTO_UPDATE_TYPE_FULL_RESCAN = 7;
    public static final int AUTO_UPDATE_TYPE_LOSS_SIGNAL = 4;
    public static final int AUTO_UPDATE_TYPE_MUX_ADD = 1;
    public static final int AUTO_UPDATE_TYPE_MUX_REMOVE = 2;
    public static final int AUTO_UPDATE_TYPE_NONE = 0;
    public static final int AUTO_UPDATE_TYPE_RETUNE_RF = 5;
    public static final int AUTO_UPDATE_TYPE_SMART_RETUNE = 8;
    public static final int DISEQC_MOTOR_CMD_CONTINUE_EAST = 2;
    public static final int DISEQC_MOTOR_CMD_CONTINUE_WEST = 1;
    public static final int DISEQC_MOTOR_CMD_DISABLE_LIMIT = 11;
    public static final int DISEQC_MOTOR_CMD_GOTO_REF_POINT = 5;
    public static final int DISEQC_MOTOR_CMD_GOTO_SAT_POSITION = 7;
    public static final int DISEQC_MOTOR_CMD_GOTO_X = 8;
    public static final int DISEQC_MOTOR_CMD_HALTMOTOR = 0;
    public static final int DISEQC_MOTOR_CMD_SAVE_SAT_POSITION = 6;
    public static final int DISEQC_MOTOR_CMD_SET_EAST_LIMIT = 10;
    public static final int DISEQC_MOTOR_CMD_SET_WEST_LIMIT = 9;
    public static final int DISEQC_MOTOR_CMD_STEP_EAST = 4;
    public static final int DISEQC_MOTOR_CMD_STEP_WEST = 3;
    public static final int DISEQC_V_1_0_PORT_1 = 1;
    public static final int DISEQC_V_1_0_PORT_2 = 2;
    public static final int DISEQC_V_1_0_PORT_3 = 3;
    public static final int DISEQC_V_1_0_PORT_4 = 4;
    public static final int DISEQC_V_1_0_PORT_NONE = 0;
    public static final int DISEQC_V_1_1_PORT_1 = 1;
    public static final int DISEQC_V_1_1_PORT_10 = 10;
    public static final int DISEQC_V_1_1_PORT_11 = 11;
    public static final int DISEQC_V_1_1_PORT_12 = 12;
    public static final int DISEQC_V_1_1_PORT_13 = 13;
    public static final int DISEQC_V_1_1_PORT_14 = 14;
    public static final int DISEQC_V_1_1_PORT_15 = 15;
    public static final int DISEQC_V_1_1_PORT_16 = 16;
    public static final int DISEQC_V_1_1_PORT_2 = 2;
    public static final int DISEQC_V_1_1_PORT_3 = 3;
    public static final int DISEQC_V_1_1_PORT_4 = 4;
    public static final int DISEQC_V_1_1_PORT_5 = 5;
    public static final int DISEQC_V_1_1_PORT_6 = 6;
    public static final int DISEQC_V_1_1_PORT_7 = 7;
    public static final int DISEQC_V_1_1_PORT_8 = 8;
    public static final int DISEQC_V_1_1_PORT_9 = 9;
    public static final int DISEQC_V_1_1_PORT_NONE = 0;
    public static final int DISH_22K_MODE_AUTO = 0;
    public static final int DISH_22K_MODE_OFF = 2;
    public static final int DISH_22K_MODE_ON = 1;
    public static final int DISH_TONE_BURST_MODE_0 = 1;
    public static final int DISH_TONE_BURST_MODE_1 = 2;
    public static final int DISH_TONE_BURST_MODE_NONE = 0;
    public static final int LATITUDE_DIRECTION_NORTH = 0;
    public static final int LATITUDE_DIRECTION_SOUTH = 1;
    public static final int LNB_BAND_TYPE_C = 0;
    public static final int LNB_BAND_TYPE_KU = 1;
    public static final int LNB_FREQ_10000_10450 = 16;
    public static final int LNB_FREQ_10600 = 9;
    public static final int LNB_FREQ_10750 = 10;
    public static final int LNB_FREQ_11250 = 11;
    public static final int LNB_FREQ_11300 = 12;
    public static final int LNB_FREQ_11475 = 13;
    public static final int LNB_FREQ_5150 = 5;
    public static final int LNB_FREQ_5150_5750 = 7;
    public static final int LNB_FREQ_5750 = 6;
    public static final int LNB_FREQ_9750 = 8;
    public static final int LNB_FREQ_9750_10700 = 14;
    public static final int LNB_FREQ_9750_10750 = 15;
    public static final int LNB_FREQ_MDU1 = 1;
    public static final int LNB_FREQ_MDU2 = 2;
    public static final int LNB_FREQ_MDU3 = 3;
    public static final int LNB_FREQ_MDU4 = 4;
    public static final int LNB_FREQ_UNICABLE = 18;
    public static final int LNB_FREQ_UNIVERSAL = 0;
    public static final int LNB_FREQ_USER_DEFINED = 17;
    public static final int LNB_POWER_MODE_13OR18V = 1;
    public static final int LNB_POWER_MODE_13V = 2;
    public static final int LNB_POWER_MODE_14OR19V = 4;
    public static final int LNB_POWER_MODE_14V = 5;
    public static final int LNB_POWER_MODE_18V = 3;
    public static final int LNB_POWER_MODE_19V = 6;
    public static final int LNB_POWER_MODE_OFF = 0;
    public static final int LONGITUDE_DIRECTION_EAST = 0;
    public static final int LONGITUDE_DIRECTION_WEST = 1;
    public static final int MOTOR_DISEQC_1_2 = 1;
    public static final int MOTOR_DISEQC_1_3 = 2;
    public static final int MOTOR_DISEQC_NONE = 0;
    public static final int NETWORK_SEARCH_OFF = 0;
    public static final int NETWORK_SEARCH_ON = 1;
    public static final int PROGRAM_INFO_TYPE_CURRENT = 0;
    public static final int PROGRAM_INFO_TYPE_DATABASE_INDEX = 3;
    public static final int PROGRAM_INFO_TYPE_MAX = 7;
    public static final int PROGRAM_INFO_TYPE_NEXT = 2;
    public static final int PROGRAM_INFO_TYPE_NEXT_BY_NUMBER = 6;
    public static final int PROGRAM_INFO_TYPE_PREVIOUS = 1;
    public static final int PROGRAM_INFO_TYPE_PREVIOUS_BY_NUMBER = 5;
    public static final int PROGRAM_INFO_TYPE_PROGRAM_NUMBER = 4;
    public static final int SCAN_MODE_FREE = 0;
    public static final int SCAN_MODE_FREE_SCRAMBLE = 1;
    public static final int SCAN_MODE_SCRAMBLE = 2;
    public static final int SERVICE_TYPE_AUDIO = 2;
    public static final int SERVICE_TYPE_TV = 0;
    public static final int SERVICE_TYPE_TV_AUDIO = 1;
    public static final int SERVICE_TYPE_TV_AUDIO_DATA = 3;
    public static final int SORTING_TYPE_FREQUENCY = 5;
    public static final int SORTING_TYPE_NAME = 2;
    public static final int SORTING_TYPE_NUM = 6;
    public static final int SORTING_TYPE_SATELLITE = 1;
    public static final int SORTING_TYPE_SCRAMBLED = 3;
    public static final int SORTING_TYPE_SERVICETYPE = 0;
    public static final int SORTING_TYPE_SGT_LCN = 4;
    private static final String TAG = "TvDvbChannelManager";
    public static final int TRANSPONDER_POLARITY_HORIZONTAL = 1;
    public static final int TRANSPONDER_POLARITY_VERTICAL = 0;
    private static ITvChannel mService;

    private TvDvbChannelManager() throws TvCommonException {
    }

    public static TvDvbChannelManager getInstance() {
        if (TvCommonManager.getInstance().getCurrentTvSystem() == 7 || TvCommonManager.getInstance().getCurrentTvSystem() == 8) {
            throw new IllegalAccessError("Only dvb system can get dvb channelmanager instance");
        }
        if (TvChannelManager.mInstance == null) {
            synchronized (TvDvbChannelManager.class) {
                if (TvChannelManager.mInstance == null) {
                    try {
                        TvChannelManager.mInstance = new TvDvbChannelManager();
                    } catch (TvCommonException e2) {
                        e2.printStackTrace();
                        return null;
                    }
                }
            }
        }
        return (TvDvbChannelManager) TvChannelManager.mInstance;
    }

    private static ITvChannel getService() {
        ITvChannel iTvChannel = mService;
        if (iTvChannel != null) {
            return iTvChannel;
        }
        if (true == TvServiceBinder.isNeedBindService()) {
            ITvService tvService = TvServiceBinder.getTvService();
            if (tvService == null) {
                Log.e(TAG, "TvService doesn't exist!!");
                throw new NullPointerException("TvService doesn't exist.");
            }
            try {
                mService = tvService.getTvChannel();
            } catch (RemoteException e2) {
                e2.printStackTrace();
            }
        } else {
            mService = TvManager.getInstance().getTvChannel();
        }
        return mService;
    }

    public boolean addSatelliteInfo(SatelliteInfo satelliteInfo) {
        try {
            return getService().addSatelliteInfo(satelliteInfo);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean addTransponderInfo(int i2, DvbsTransponderInfo dvbsTransponderInfo) {
        try {
            return getService().addTransponderInfo(i2, dvbsTransponderInfo);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean deleteSatelliteInfo(int i2) {
        try {
            return getService().deleteSatelliteInfo(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean deleteTransponderInfo(int i2, int i3) {
        try {
            return getService().deleteTransponderInfo(i2, i3);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public int getCurrentSatelliteCount() {
        int currentSatelliteCount;
        try {
            currentSatelliteCount = getService().getCurrentSatelliteCount();
        } catch (RemoteException e2) {
            e = e2;
            currentSatelliteCount = 0;
        }
        try {
            Log.d(TAG, " Current Satellite Count is " + currentSatelliteCount);
        } catch (RemoteException e3) {
            e = e3;
            e.printStackTrace();
        }
        return currentSatelliteCount;
    }

    public int getCurrentSatelliteNumber() {
        int currentSatelliteNumber;
        try {
            currentSatelliteNumber = getService().getCurrentSatelliteNumber();
        } catch (RemoteException e2) {
            e = e2;
            currentSatelliteNumber = 0;
        }
        try {
            Log.d(TAG, " Current Satellite Number is " + currentSatelliteNumber);
        } catch (RemoteException e3) {
            e = e3;
            e.printStackTrace();
        }
        return currentSatelliteNumber;
    }

    public int getCurrentTransponderNumber() {
        int currentTransponderNumber;
        try {
            currentTransponderNumber = getService().getCurrentTransponderNumber();
        } catch (RemoteException e2) {
            e = e2;
            currentTransponderNumber = 0;
        }
        try {
            Log.d(TAG, " Current Transponder Number is " + currentTransponderNumber);
        } catch (RemoteException e3) {
            e = e3;
            e.printStackTrace();
        }
        return currentTransponderNumber;
    }

    public int getDefaultNetworkId() {
        try {
            return getService().getDefaultNetworkId();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public EwsInfo getEWSInfo() {
        try {
            EwsInfo eWSInfo = getService().getEWSInfo();
            if (eWSInfo != null) {
                Log.d(TAG, "EWS, type = " + eWSInfo.type);
                Log.d(TAG, "EWS, authority = " + eWSInfo.authority);
                Log.d(TAG, "EWS, level = " + eWSInfo.level);
            }
            return eWSInfo;
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    @Override // com.mstar.android.tv.TvChannelManager
    @Deprecated
    public ProgramInfo getProgramInfo(ProgramInfoQueryCriteria programInfoQueryCriteria, EnumProgramInfoType enumProgramInfoType) {
        return getProgramInfo(programInfoQueryCriteria, enumProgramInfoType.ordinal());
    }

    public DvbRegionChannelListInfo getRegionChannellistInfo() {
        DvbRegionChannelListInfo regionChannellistInfo;
        try {
            regionChannellistInfo = getService().getRegionChannellistInfo();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            regionChannellistInfo = null;
        }
        if (regionChannellistInfo != null) {
            return regionChannellistInfo;
        }
        DvbRegionChannelListInfo dvbRegionChannelListInfo = new DvbRegionChannelListInfo();
        dvbRegionChannelListInfo.count = 0;
        return dvbRegionChannelListInfo;
    }

    public DvbTargetRegionInfo getRegionInfo() {
        DvbTargetRegionInfo regionInfo;
        try {
            regionInfo = getService().getRegionInfo();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            regionInfo = null;
        }
        if (regionInfo != null) {
            return regionInfo;
        }
        DvbTargetRegionInfo dvbTargetRegionInfo = new DvbTargetRegionInfo();
        dvbTargetRegionInfo.countryCount = (short) 0;
        return dvbTargetRegionInfo;
    }

    public SatelliteInfo getSatelliteInfo(int i2) {
        try {
            return getService().getSatelliteInfo(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public int getSystemNetworkId() {
        try {
            return getService().getSystemNetworkId();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public int getTransponderCount(int i2) {
        int transponderCount;
        try {
            transponderCount = getService().getTransponderCount(i2);
        } catch (RemoteException e2) {
            e = e2;
            transponderCount = 0;
        }
        try {
            Log.d(TAG, " Current Transponder Count is " + transponderCount);
        } catch (RemoteException e3) {
            e = e3;
            e.printStackTrace();
        }
        return transponderCount;
    }

    public DvbsTransponderInfo getTransponderInfo(int i2, int i3) {
        try {
            return getService().getTransponderInfo(i2, i3);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public int getUnusedMotorPosition() {
        try {
            return getService().getUnusedMotorPosition();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    @Override // com.mstar.android.tv.TvChannelManager
    @Deprecated
    public int getUserLocationCode() {
        try {
            return getService().getUserLocationCode();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public int getUserLocationCount() {
        try {
            return getService().getUserLocationCount();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    public LocationInfo getUserLocationInfo(int i2) {
        try {
            return getService().getUserLocationInfo(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public UserLocationSetting getUserLocationSetting() {
        try {
            return getService().getUserLocationSetting();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public boolean sendDiSEqCMotorCommand(int i2) {
        try {
            return getService().sendDiSEqCMotorCommand(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setCurrentSatelliteNumber(int i2) {
        try {
            return getService().setCurrentSatelliteNumber(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setCurrentTransponderNumber(int i2) {
        try {
            return getService().setCurrentTransponderNumber(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setDiSEqCSwitchPort(int i2, int i3) {
        try {
            return getService().setDiSEqCSwitchPort(i2, i3);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setDish22KMode(int i2) {
        try {
            return getService().setDishLNBPowerMode(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setDishLNBPowerMode(int i2) {
        try {
            return getService().setDishLNBPowerMode(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setDishToneburstMode(int i2) {
        try {
            return getService().setDishLNBPowerMode(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    @Deprecated
    public void setDtvAntennaType(EnumAntennaType enumAntennaType) {
        Log.d(TAG, "setDtvAntennaType(), paras type = " + enumAntennaType);
        setDtvAntennaType(enumAntennaType.ordinal());
    }

    public boolean setDvbsScanParam(DvbsScanParam dvbsScanParam) {
        try {
            return getService().setDvbsScanParam(dvbsScanParam);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setProgramSortByType(int i2) {
        try {
            return getService().setProgramSortByType(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setRegionInfo(String str, short s2, short s3, int i2) {
        try {
            return getService().setRegionInfo(str, s2, s3, i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean setRegionalChannelListID(int i2) {
        try {
            return getService().setRegionalChannelListID(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void setSystemNetworkId(int i2) {
        try {
            getService().setSystemNetworkId(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    @Override // com.mstar.android.tv.TvChannelManager
    @Deprecated
    public void setUserLocationCode(int i2) {
        try {
            getService().setUserLocationCode(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public void setUserLocationSetting(UserLocationSetting userLocationSetting) {
        try {
            getService().setUserLocationSetting(userLocationSetting);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }

    public boolean updateSatelliteInfo(int i2, SatelliteInfo satelliteInfo) {
        try {
            return getService().updateSatelliteInfo(i2, satelliteInfo);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean updateTransponderInfo(int i2, int i3, DvbsTransponderInfo dvbsTransponderInfo) {
        try {
            return getService().updateTransponderInfo(i2, i3, dvbsTransponderInfo);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public boolean verifySlotFrequency() {
        try {
            return getService().verifySlotFrequency();
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public ProgramInfo getProgramInfo(ProgramInfoQueryCriteria programInfoQueryCriteria, int i2) {
        ITvChannel service = getService();
        Log.d(TAG, "getProgramInfo, paras ProgramInfoQueryCriteria is " + programInfoQueryCriteria.queryIndex + " ProgramInfoType is " + i2);
        try {
            return service.getProgramInfo(programInfoQueryCriteria, i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public void setDtvAntennaType(int i2) {
        Log.d(TAG, "setDtvAntennaType(), paras type = " + i2);
        try {
            getService().setDtvAntennaType(i2);
        } catch (RemoteException e2) {
            e2.printStackTrace();
        }
    }
}
