package com.tcl.factory.impl;

import tvos.tv.TFactoryManager;
import tvos.tv.TManager;

import android.content.Context;
import android.util.Log;

import com.tcl.factory.EnTCLUSBUpdate;
import com.tcl.factory.FactoryManager;

public class FactoryMenuAdapter {

    private final String TAG = "FactoryMenuAdapter";
    private FactoryManager factoryManager = null;
    private static FactoryMenuAdapter sInstance = null;
    private static TFactoryManager tFactoryManager = null;

    private FactoryMenuAdapter(Context context) {
        factoryManager = FactoryManager.getInstance(context);
        tFactoryManager = TManager.getInstance(context).getFactoryManager();
        Log.i("eeeff", "factoryManager is " + factoryManager);
    }

    public static FactoryMenuAdapter getInstance(Context context) {
        Log.i("eeeff", "enter ....");
        if (sInstance == null) {
            synchronized (FactoryMenuAdapter.class) {
                if (sInstance == null) {
                    sInstance = new FactoryMenuAdapter(context);
                }
            }
        }
        Log.i("eeeff", "ok ...." + sInstance + "----");
        return sInstance;
    }

    public int getProjectID() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_PROJ_ID);
    }


    public void setProjectID(int projectID) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_PROJ_ID, projectID);
    }

    public int getPanelID() {
        return tFactoryManager.getAttribute(TFactoryManager.FACTORY_ATTR_PANEL_ID);
    }

    public boolean setPanelID(int panelID) {
        return tFactoryManager.setAttribute(TFactoryManager.FACTORY_ATTR_PANEL_ID, panelID);
    }

    public int getPanelMaxID() {
        return tFactoryManager.getAttribute(TFactoryManager.FACTORY_ATTR_PANEL_ID_MAX);
    }

    public boolean isSupportPanelID() {
        int i = 0;
        i = tFactoryManager.getAttribute(TFactoryManager.FACTORY_ATTR_PANEL_ID_SUPPORT);
        return i == 0 ? false : true;
    }

    public String getPanelName() {
        String panelName = tFactoryManager.getPanelName();
        return panelName;
    }

    public int getRedGainValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_RED_GAIN);
    }

    public boolean hasCI() {
        boolean status = factoryManager.hasCIKey();
        return status;
    }

    public boolean hasWideVine() {
        boolean status = factoryManager.hasWideVineKey();
        return status;
    }

    public void setRedGainValue(int redGainValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_RED_GAIN, redGainValue);
    }


    public int getGreenGainValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_GREEN_GAIN);
    }


    public void setGreenGainValue(int greenGainValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_GREEN_GAIN, greenGainValue);
    }


    public int getBlueGainValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_BLUE_GAIN);
    }


    public void setBlueGainValue(int blueGainValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_BLUE_GAIN, blueGainValue);
    }


    public int getRedOffsetValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_RED_OFFSET);
    }


    public void setRedOffsetValue(int redOffsetValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_RED_OFFSET, redOffsetValue);
    }


    public int getGreenOffsetValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_GREEN_OFFSET);
    }


    public void setGreenOffsetValue(int greenOffsetValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_GREEN_OFFSET, greenOffsetValue);
    }


    public int getBlueOffsetValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_BLUE_OFFSET);
    }


    public void setBlueOffsetValue(int blueOffsetValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_BLUE_OFFSET, blueOffsetValue);
    }


    public void setLogo(int bootLogoIndex) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_LOGO_INDEX, bootLogoIndex);
    }


    public int getPowerMode() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_POWER_MODE);
    }

    public int getTargetSource() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_TARGET_SOURCE);
    }

    public int getTargetTunerMode() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_TARGET_TUNER_MODE);
    }

    public int getTargetChannelNumber() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_TARGET_CHANNEL_NUMBER);
    }

    public void setPowerMode(int powerMode) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_POWER_MODE, powerMode);
    }


    public int getRemoteControlButtonValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_REMOTE_CONTROL_BUTTON);
    }


    public int getSidePanelButtonValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SIDE_PANEL_BUTTON);
    }


    public void resetUserSettings() {//not be called
        factoryManager.doResetUserSettings();
    }


    public void setPanelKeyLockStatus(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_PANEL_KEY_LOCK_STATUS, status ? 1 : 0);
    }


    public boolean CloneUSB2TV(int option) {
        return factoryManager.doCloneUSB2TV(option);
    }


    public boolean CloneTV2USB(int option) {
        return factoryManager.doCloneTV2USB(option);
    }


//	public void writeValue2TVStorage(int storageType, int addr, int value) {
//		factoryManager.doWriteData(storageType, addr, value);
//	}
//
//	
//	public int readValueFromTVStorage(int storageType, int addr) {
//		return factoryManager.doReadData(storageType, addr);
//	}
//
//	
//	public void writeValue2TVDataBase(String table, String id, String item) {
//		factoryManager.doWriteData(table, id, item);
//	}
//
//	
//	public String readValueFromTVDataBase(String table, String id) {
//		return factoryManager.doReadData(table, id);
//	}


    public void setPatternRGB(int red, int green, int blue) {
        factoryManager.doSetPatternRGB(red, green, blue);
    }


    public void cleanChannelList() {
        factoryManager.doCleanChannelList();
    }


    public int PalPreSetChannel(int chNum, String chName, int freq, int color,
                                int tvAudio) {
        return factoryManager.doPalPreSetChannel(chNum, chName, freq, color, tvAudio);
    }


    public void openSerialPort() {
        factoryManager.doOpenSerialPort();
    }

    public boolean getUartStatus() {
        boolean status = factoryManager.doGetUartStatus();
        Log.i("FactoryMenuAdapter", "getUartStatus() = " + status);
        return status;
    }

    public void closeSerialPort() {
        factoryManager.doCloseSerialPort();
    }


    public void outSerialData(byte[] serialData) { //not be called
        factoryManager.doOutSerialData(serialData);
    }


    public int getHorizonPosition() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HORIZON_POSITION);
    }


    public void setHorizonPosition(int horizonPosition) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HORIZON_POSITION, horizonPosition);
    }


    public int getVerticalPosition() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_VERTICAL_POSITION);
    }


    public void setVerticalPosition(int verticalPosition) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_VERTICAL_POSITION, verticalPosition);
    }


    public int getHorizonZoomSize() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HORIZON_ZOOM_SIZE);
    }


    public void setHorizonZoomSize(int hZoomSize) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HORIZON_ZOOM_SIZE, hZoomSize);
    }


    public int getVerticalZoomSize() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_VERTICAL_ZOOM_SIZE);
    }


    public void setVerticalZoomSize(int vZoomSize) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_VERTICAL_ZOOM_SIZE, vZoomSize);
    }


    public boolean getMemorySSC() {
        int attr = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_MEMORY_SSC);
        return attr == 0 ? false : true;
    }


    public void setMemorySSC(boolean flag) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_MEMORY_SSC, flag ? 1 : 0);
    }


    public int getMemorySpan() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_MEMORY_SPAN);
    }


    public void setMemorySpan(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_MEMORY_SPAN, value);
    }


    public int getMemorySteps() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_MEMORY_STEPS);
    }


    public void setMemorySteps(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_MEMORY_STEPS, value);
    }


    public boolean getLVDSSSC() {
        int attr = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_LVDS_SSC);
        return attr == 0 ? false : true;
    }


    public void setLVDSSSC(boolean flag) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_LVDS_SSC, flag ? 1 : 0);
    }


    public int getLVDSSpan() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_LVDS_SPAN);
    }


    public void setLVDSSpan(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_LVDS_SPAN, value);
    }


    public int getLVDSSteps() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_LVDS_STEPS);
    }


    public void setLVDSSteps(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_LVDS_STEPS, value);
    }


    public boolean getSITunerStatus() {
        int attr = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SI_TUNER_STATUS);
        return attr == 0 ? false : true;
    }

    public int getHotelVolumeMax() {
        int volumeMax = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MAX_VOLUME);
        return volumeMax;
    }

    public void setHotelVolumeMax(int vol) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MAX_VOLUME, vol);
    }


    public boolean getPanelRotateStatus() {
        int attr = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_PANEL_ROTATE_STATUS);
        return attr == 0 ? false : true;
    }


    public void setPanelRotateStatus(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_PANEL_ROTATE_STATUS, status ? 1 : 0);
    }


    public int getCurve(int type, int index) {
        return factoryManager.doGetCurve(type, index);
    }


    public void setCurve(int type, int index, int value) {
        factoryManager.doSetCurve(type, index, value);
    }


//	public int writeTVStorage(int storageType, int addr, byte[] data, int len) {
//		return factoryManager.doWriteData(storageType, addr, data, len);
//	}
//
//	
//	public int readTVStorage(int storageType, int addr, byte[] data, int len) {
//		return factoryManager.doReadData(storageType, addr, data, len);
//	}


    public int getNatureLightBPValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_BP);
    }


    public void setNatureLightBPValue(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_BP, value);
    }


    public int getNatureLightAPL2Value() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_APL2);
    }


    public void setNatureLightAPL2Value(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_APL2, value);
    }


    public void setNaturalLightModeValue(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_MODE, value);
    }

    public int getNaturalLightModeValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_MODE);
    }


    public void setNaturalLightEnable(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_ENABLE, status ? 1 : 0);
    }

    public void setNaturalLightPrintEnable(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_PRINT_ENABLE, status ? 1 : 0);
    }


    public void setNatureLightVerboseLevel(int level) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_VERBOSE_LEVEL, level);
    }

    public int getNatureLightVerboseLevel() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_VERBOSE_LEVEL);
    }


    public int getNatureLightSBLValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_SB);
    }


    public void setNatureLightSBLValue(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_SB, value);
    }


    public int getNatureLightBKEValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_BKE);
    }


    public void setNatureLightBKEValue(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_BKE, value);
    }


    public void shellExecute(String cmd) {
        factoryManager.doShellExecute(cmd);
    }


    public int[] getPanelPixel(int xpoint, int ypoint, int num) {
        return factoryManager.doGetPanelPixel(xpoint, ypoint, num);
    }


    public String getBootcodeVersion() {
        return factoryManager.doGetBootCodeVersion();
    }

    public int getNatureLightDimAPValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_DIMAP);
    }


    public void setNatureLightDimAPValue(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_DIMAP, value);
    }


    public int getNatureLightADimEnable() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_ADIM_ENABLE);
    }


    public void setNatureLightADimEnable(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_ADIM_ENABLE, value);
    }


    public void setChinaDescramblerBox1(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_CHINA_DESCRAMBLER_BOX1, status == false ? 0 : 1);

    }


    public boolean getChinaDescramblerBox1() {
        int status = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_CHINA_DESCRAMBLER_BOX1);
        return status == 0 ? false : true;
    }


    public void setChinaDescramblerBox2(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_CHINA_DESCRAMBLER_BOX2, status == false ? 0 : 1);
    }


    public boolean getChinaDescramblerBox2() {
        int status = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_CHINA_DESCRAMBLER_BOX2);
        return status == 0 ? false : true;
    }


    public void setChinaDescramblerBox2Delay(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_CHINA_DESCRAMBLER_BOX2_DELAY, value);
    }


    public int getChinaDescramblerBox2Delay() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_CHINA_DESCRAMBLER_BOX2_DELAY);
    }


    public void setVby1DrivingCurrent(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_NATURE_VBY1_DRIVING_CURRENT, value);
    }

    public int getVby1DrivingCurrent() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_VBY1_DRIVING_CURRENT);
    }


    public boolean setAutoADCColor() {
        return factoryManager.doSetAutoADCColor();
    }


    public int getAutoADCColorRGain() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_R_GAIN);
    }


    public int getAutoADCColorGGain() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_G_GAIN);
    }


    public int getAutoADCColorBGain() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_B_GAIN);
    }


    public int getAutoADCColorROffset() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_R_OFFSET);
    }


    public int getAutoADCColorGOffset() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_G_OFFSET);
    }


    public int getAutoADCColorBOffset() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_B_OFFSET);
    }


    public void setAutoADCColorBGain(int iValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_B_GAIN, iValue);
    }


    public void setAutoADCColorBOffset(int iValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_B_OFFSET, iValue);
    }


    public void setAutoADCColorGGain(int iValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_G_GAIN, iValue);
    }


    public void setAutoADCColorGOffset(int iValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_G_OFFSET, iValue);
    }


    public void setAutoADCColorRGain(int iValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_R_GAIN, iValue);
    }


    public void setAutoADCColorROffset(int iValue) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_COLOR_R_OFFSET, iValue);
    }

    public boolean getNaturalLightEnable() {
        int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_ENABLE);
        return retval == 0 ? false : true;
    }

    public boolean getNaturalLightPrintEnable() {
        int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_NATURE_LIGHT_PRINT_ENABLE);
        return retval == 0 ? false : true;
    }

    /**
     * 0 fail; 1 ok; other ng
     */
    public int getAutoADCStatus() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_AUTO_ADC_STATUS);
    }


//	public static final int FACTORY_ATTR_D_MODE                     = 44;
//	public static final int FACTORY_ATTR_P_MODE                     = 45;
//	public static final int                = 46;
//	public static final int FACTORY_ATTR_HOTEL_MODE                 = 47;
//	public static final int FACTORY_ATTR_HOTEL_POWER_LOGO           = 48;
//	public static final int FACTORY_ATTR_HOTEL_AUTO_SET             = 49;
//	public static final int FACTORY_ATTR_HOTEL_CH_LOCK              = 50;
//	public static final int FACTORY_ATTR_HOTEL_KEY_LOCK             = 51;
//	public static final int FACTORY_ATTR_HOTEL_POWER_VOLUME         = 52;
//	public static final int FACTORY_ATTR_HOTEL_SOURCE               = 53;
//	public static final int FACTORY_ATTR_HOTEL_POWER_ATV_CH         = 54;
//	public static final int FACTORY_ATTR_HOTEL_MAX_VOLUME           = 55;
//	public static final int FACTORY_ATTR_HOTEL_PICTURE_MODE         = 56;
//	public static final int FACTORY_ATTR_HOTEL_SOUND_MODE           = 57;
//	public static final int FACTORY_ATTR_PSHOTKEY                   = 58;
//	public static final int FACTORY_ATTR_AUTO_ADC_STATUS            = 59;

    public boolean getWarmUpModeStatus() {
        int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_WARM_UP_MODE);
        return retval == 0 ? false : true;
    }

    public void setWarmUpModeStatus(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_WARM_UP_MODE, status == false ? 0 : 1);
    }

    public boolean getDModeStatus() {
        int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_D_MODE);
        return retval == 0 ? false : true;
    }

    public void setDModeStatus(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_D_MODE, status == false ? 0 : 1);
    }

    public boolean getPModeStatus() {
        int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_P_MODE);
        return retval == 0 ? false : true;
    }

    public void setPModeStatus(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_P_MODE, status == false ? 0 : 1);
    }

    public boolean getSKDModeStatus() {
//		int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SKD_MODE);//hubin
        return true;//retval == 0 ? false : true;  //hubin
    }

    public void setSKDModeStatus(boolean status) {
//		factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_SKD_MODE, status == false ? 0 : 1);//hubin
    }

    public boolean getSitaPModeStatus() {
        int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SITA_P_MODE);
        return retval == 0 ? false : true;
    }

    public void setSitaPModeStatus(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_SITA_P_MODE, status == false ? 0 : 1);
    }

    public boolean getSerialDebugStatus() {
        int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_PSHOTKEY);
        return retval == 0 ? false : true;
    }

    public String getMacAddress() {
        return factoryManager.doGetMacAddress();
    }

    public String getDeviceID() {
        return factoryManager.doGetDeviceID();
    }

    public String getRegisterCode() {
        return factoryManager.doGetRegisterCode();
    }

    public String getNonstandardDTV() {
        return factoryManager.doGetOperatorName();
    }

    public void preNonstandardDTV() {
        factoryManager.doSetOperator(false);
    }

    public void nextNonstandardDTV() {
        factoryManager.doSetOperator(true);
    }

    public boolean getWathDog() {
        return factoryManager.doGetWatchDog();
    }

    public boolean setWathDog(boolean status) {
        return factoryManager.doSetWatchDog(status);
    }

    public int getHotelFlag() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE);
    }

    public void setHotelFlag(int status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE, status);
    }

    public boolean FPCImageUpgrade() {
        return factoryManager.doUSBUpdate(EnTCLUSBUpdate.EN_TCL_USB_FRC_IMAGE_UPDATE);
    }

    public int getFPCImageUpgradeProgress() {
        return 0;//factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_FRC_UPGRADE_PROCESS);
    }

    public boolean CIKeyUpgrade() {
        return factoryManager.doUSBUpdate(EnTCLUSBUpdate.EN_TCL_USB_CI_PLUS_KEY_UPDATE);
    }

    public boolean WideVineKeyUpgrade() {
        return factoryManager.doUSBUpdate(EnTCLUSBUpdate.EN_TCL_USB_WIDEVINE_KEY_UPDATE);
    }

    public boolean HdmiKeyUpgrade() {
        return factoryManager.doUSBUpdate(EnTCLUSBUpdate.EN_TCL_USB_HDCP_UPDATE);
    }

    public boolean WidiKeyUpgrade() {
        return factoryManager.doUSBUpdate(EnTCLUSBUpdate.EN_TCL_USB_HDCP2_UPDATE);
    }

    public boolean VB1_LVDS_Upgrade() {
        return factoryManager.doUSBUpdate(EnTCLUSBUpdate.EN_TCL_USB_VB1_LVDS_UPDATE);
    }

    public boolean MACUpgrade() {
        return factoryManager.doMacAddrUpgradeByUSB();
//		return false;
    }

    public String getSNString() {
        return factoryManager.doGetSnCode();
    }

    public boolean hasHDCP() {
        boolean status = factoryManager.doGetHDCPStatus(0);
        Log.i(TAG, "hashdcp===" + status);
        return status;
    }

    public boolean hasDRM() {
        boolean status = factoryManager.doGetDRMStatus();
        Log.i(TAG, "hasDrm===" + status);
        return status;
    }

    public boolean hasWIDI() {
        boolean status = factoryManager.doGetHDCPStatus(1);
        Log.i(TAG, "hasWIDI===" + status);
        return status;
    }

    public void setBluetooth3dWorkStatus(int status) {
        if (null == factoryManager) {
            Log.d(TAG, "setBluetooth3dSyncStatus factoryManager is null");
            return;
        }
        factoryManager.doSetBluetooth3dWorkStatus(status);
    }

    public void setBluetooth3dSyncStatus(int status) {
        if (null == factoryManager) {
            Log.d(TAG, "setBluetooth3dSyncStatus factoryManager is null");
            return;
        }
        factoryManager.doSetBluetooth3dSyncStatus(status);
    }

    public void setSscFrcEnable(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_SSC_FRC_ENABLE, status == false ? 0 : 1);
    }

    public boolean getSscFrcEnable() {
        int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SSC_FRC_ENABLE);
        return retval == 0 ? false : true;
    }

    public void setSscFrcSpan(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_SSC_FRC_SPAN, value);
    }

    public int getSscFrcSpan() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SSC_FRC_SPAN);
    }

    public void setSscFrcStep(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_SSC_FRC_STEP, value);
    }

    public int getSscFrcStep() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SSC_FRC_STEP);
    }

    public void setSscOsdEnable(boolean status) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_SSC_OSD_ENABLE, status == false ? 0 : 1);
    }

    public boolean getSscOsdEnable() {
        int retval = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SSC_OSD_ENABLE);
        return retval == 0 ? false : true;
    }

    public void setSscOsdSpan(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_SSC_OSD_SPAN, value);
    }

    public int getSscOsdSpan() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SSC_OSD_SPAN);
    }

    public void setSscOsdStep(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_SSC_OSD_STEP, value);
    }

    public int getSscOsdStep() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_SSC_OSD_STEP);
    }

    public String getProjectName() {
        return factoryManager.doGetProjectName();
    }

    public String getStbcCodeVersion() {
        return factoryManager.doGetStbcCodeVersion();
    }

    public String getFrcCodeVersion() {
        return factoryManager.doGetFrcCodeVersion();
    }

    public String getTconVersion() {
        return factoryManager.doGetTconVersion();
    }

    /**
     * 鐠佸墽鐤嗛柊鎺戠暗閼挎粌宕熼柅澶愩��
     *
     * @param defineId 闁版帒绨甸懣婊冨礋闁銆岻D 婵″偊绱板锟介張绨俹g
     * @param value    0閿涙瓌FF  1閿涙瓌N
     * @author liuyuanfeng
     * @create 2015-1-9 娑撳﹤宕�11:17:33
     */
    public void setHotelAttribute(int defineId, int value) {
        Log.d("lyf", "1.setHotelAttribute defineId = " + defineId + ", value =" + value);
        factoryManager.doSetAttribute(defineId, value);
    }

    /**
     * 閺嶈宓乨efineId閼惧嘲褰囨妯款吇閸婏拷
     *
     * @param defineId 闁版帒绨甸懣婊冨礋闁銆岻D 婵″偊绱板锟介張绨俹g
     * @return
     * @author liuyuanfeng
     * @create 2015-1-9 娑撳﹤宕�11:21:51
     */
    public int getHotelAttribute(int defineId) {
        int value = factoryManager.doGetAttribute(defineId);
        Log.d("lyf", "2.GetHotelAttribute defineId = " + defineId + ", value =" + value);
        return value;
    }

    public boolean LocalDimmingUpgrade() {
        return factoryManager.doUSBUpdate(EnTCLUSBUpdate.EN_TCL_LOCAL_DIMMING_UPDATE);
    }

    public String getLocalDimmingVersion() {
        return factoryManager.doGetLocalDimmingVersion();
    }

    public String getDrmString() {
        return factoryManager.doGetDrmKeyCode();
    }


    public boolean getGetUserIDStatus() {
        return factoryManager.doGetGetUserIDStatus();
    }

    public boolean setGetUserIDStatus(boolean status) {
        return factoryManager.doSetGetUserIDStatus(status);
    }

    public boolean getBGM() {
        return factoryManager.doGetBGM();
    }

    public boolean setBGM(boolean status) {
        return factoryManager.doSetBGM(status);
    }

    public boolean getNMR() {
        return factoryManager.doGetNMR();
    }

    public boolean setNMR(boolean status) {
        return factoryManager.doSetNMR(status);
    }

    public int getDVBT2ModeValue() {
        return factoryManager.doGetDVBT2Mode();
    }


    public boolean setDVBT2ModeValue(int Mode) {
        return factoryManager.doSetDVBT2Mode(Mode);
    }

    public boolean getHbbTVMode() {
        return factoryManager.doGetHbbTVMode();
    }

    public boolean setHbbTVMode(boolean status) {
        return factoryManager.doSetHbbTVMode(status);
    }

    public String getRunningTimeString() {
        return factoryManager.doGetRunningTimeString();
    }

    public int getAdcMaxValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_ADC_MAX);
    }

    public int getAdcMinValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_ADC_MIN);
    }

    public int getRatioMinValue() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_RATIO_MIN);
    }

    public boolean OpenHbbtvPortal(String str_URL) {
        return factoryManager.doOpenHbbtvPortal(str_URL);
    }

    public boolean startRecordTS(String str_URL) {
        return factoryManager.doStartRecordTS(str_URL);
    }

    public boolean stopRecordTS() {
        return factoryManager.doStopRecordTS();
    }

    public void setAdcMaxValue(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_ADC_MAX, value);
    }

    public void setAdcMinValue(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_ADC_MIN, value);
    }

    public void setRatioMinValue(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_RATIO_MIN, value);
    }

    public boolean setHotelBootLogo(int status) {
        return factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_BOOT_LOGO, status);
    }

    public int getHotelBootLogo() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_BOOT_LOGO);
    }

    public boolean setHotelBootAnimation(int status) {
        return factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_BOOT_ANIMATION, status);
    }

    public int getHotelBootAnimation() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_BOOT_ANIMATION);

    }

    public String getHotelDefaultBootAnimPath() {
        return factoryManager.getHotelInfo(FactoryManager.HOTEL_INFO_TYPE_DEFAULT_BOOT_ANIMATION_PATH);
    }

    public boolean setHotelBootVideo(int status) {
        return factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_BOOT_VIDEO, status);
    }

    public int getHotelBootVideo() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_BOOT_VIDEO);
    }

    public String getHotelLauncherAppName() {
        return factoryManager.getHotelInfo(FactoryManager.HOTEL_INFO_TYPE_PACKAGE_NAME);
    }

    public String getHotelLauncherActivityName() {
        return factoryManager.getHotelInfo(FactoryManager.HOTEL_INFO_TYPE_ACTIVITY_NAME);
    }

    public boolean setHotelLauncherAppName(String name) {
        return factoryManager.setHotelInfo(FactoryManager.HOTEL_INFO_TYPE_PACKAGE_NAME, name);
    }

    public boolean setHotelLauncherActivityName(String name) {
        return factoryManager.setHotelInfo(FactoryManager.HOTEL_INFO_TYPE_ACTIVITY_NAME, name);
    }

    public boolean setHotelScreenPosition(boolean flag) {
        int value = flag ? 1 : 0;
        return factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_SCREEN_POSITION, value);
    }

    public boolean getHotelScreenPosition() {
        boolean flag = false;
        if (factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_SCREEN_POSITION) == 1) {
            flag = true;
        }
        return flag;
    }

    public boolean setHotelSilentInstal(boolean flag) {
        int value = flag ? 1 : 0;
        return factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_SILENT_INSTALL, value);
    }

    public boolean getHotelSilentInstal() {
        boolean flag = false;
        if (factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_SILENT_INSTALL) == 1) {
            flag = true;
        }
        return flag;
    }

    public int getStandbyLEDIndicatorMode() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_STANDBY_LED_INDICATOR);
    }

    public boolean setStandbyLEDIndicatorMode(int Mode) {
        return factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_STANDBY_LED_INDICATOR, Mode);
    }

    public boolean startHotelCheckBootVideo() {
        boolean flag = false;
        if (factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_CHECK_BOOT_VIDEO) == 1) {
            flag = true;
        }
        return flag;
    }

    public boolean getHotelCheckBootVideoFinish() {
        boolean flag = false;
        if (factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_CHECK_BOOT_VIDEO_FINISH) == 1) {
            flag = true;
        }
        return flag;
    }

    public int getHotelCheckBootVideoPlayStatus() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_BOOT_VIDEO_PLAY_STATUS);
    }

    public int getHotelPowerOnMode() {
        int value = factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_POWER_ON);
        Log.d(TAG, "jacky  getHotelPowerOnMode= " + value);
        return value;
    }

    public boolean setHotelPowerOnMode(int Mode) {
        Log.d(TAG, "jacky  setHotelPowerOnMode= " + Mode);
        return factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_POWER_ON, Mode);
    }

    public String getConfigPackVersion() {
        return factoryManager.doGetConfigPackVersion();
    }

    public int getHotelCNClock() {
        return factoryManager.doGetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_CH_LOCK);
    }

    public void setHotelCNClock(int value) {
        factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_CH_LOCK, value);
    }

    public boolean setRootSeek(String cmd) {
        return factoryManager.setInformation(FactoryManager.FACTORY_ATTR_ROOT_SEEKER, cmd);
    }

    public boolean setLogoStatus(int value) {
        return factoryManager.doSetAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MODE_BOOT_LOGO, value);
    }
}
