// Board Support Layer
// Interface of the TV platform


package com.tcl.factory.bsp;

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

import com.tcl.factory.FactoryManager;
import com.tcl.factory.def.DEFS;

import com.tcl.factory.thirdparty.ThirdParty;
import com.tcl.factory.utils.Debug;
import com.tcl.factory.utils.Utils;
import com.tcl.tvmanager.TvManager;

 
 
public class TV {
 
	private final static String TAG = "TV";
	
	public static Context mContext = null;
 

/**
 * read the status of the device that is defined in  TVDefine.java
 * @param id the constant which is defined in TVDefine.java
 * @return the status of the selected device
 */
	public static boolean readS(int id)
	{
		Debug.v(TAG, "TV.readS(" + id + ")");
		boolean status = false;
		switch(id)
		{
		case TVDefine.DMode:
			status = ThirdParty.getDModeStatus();
			break;
		case TVDefine.PMode:
			status = ThirdParty.getPModeStatus();
			break;
		case TVDefine.SitaPMode:
			status = ThirdParty.getSitaPModeStatus();
			break;
		case TVDefine.DPMode:
			status = ThirdParty.getDPModeStatus();
			break;
		case TVDefine.WMode:
		case TVDefine.WarmUP:
			status = ThirdParty.getWModeStatus();
			break;
		case TVDefine.AudioMute:
			status = ThirdParty.getAudioMuteStatus();
			break;
		case TVDefine.AudioSmartVolume:
			status = ThirdParty.getAudioSmartVolumeStatus();
			break;
		case TVDefine.KeyCodeTest:
			status = TCL.getKeyCodeTestStatus();
			break;		
//		case TVDefine.SerialDebug:
//			status = TCL.getSerialDebugStatus();
//			break;
		case TVDefine.DeviceID:
			status = TCL.getDeviceIDShortTestStatus();
			break;	
		case TVDefine.SDCard:
			status = TCL.getSDCardStatus();
			break;
		case TVDefine.USB:
			status = TCL.getUSBStatus();
			break;
		case TVDefine.Wifi:
			status = TCL.getWifiStatus();
			break;
		case TVDefine.WiredNet:
			status = TCL.getWiredNetStatus();
			break;
		case TVDefine.NetworkConnectivity:
			status = TCL.getNetworkConnectivityStatus();
			break;
		case TVDefine.PanelRotate:
			status = ThirdParty.getPanelRotateStatus();
			break;	
		case TVDefine.NonStandardMode:
			status = ThirdParty.getNonStandardStatus();
			break;
		case TVDefine.CICard:
			status = ThirdParty.getCICardStatus();
			break;	
		case TVDefine.DBC:
			status = ThirdParty.getNatureLightEnabled();
			break;	
		case TVDefine.DCC:
			status = ThirdParty.getDccEnabled();
			break;	
		case TVDefine.ChinaDescramblerBoxMode1:
			status = ThirdParty.getChinaDescramblerBox1();
			break;	
		case TVDefine.ChinaDescramblerBoxMode2:
			status = ThirdParty.getChinaDescramblerBox2();
			break;	
		case TVDefine.MemorySSC:
			status = ThirdParty.getMemorySSC();
			break;
		case TVDefine.LVDSSSC:
			status = ThirdParty.getLVDSSSC();
			break;	
		case TVDefine.WatchDog:
			status = ThirdParty.getWatchDog();
			break;
		case TVDefine.SSC_FRC_ENABLE:
			status = ThirdParty.getSscFrcEnable();
			break;	
		case TVDefine.SSC_OSD_ENABLE:
			status = ThirdParty.getSscOsdEnable();
			break;
		case TVDefine.POWER_LOGO:
			status = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_POWER_LOGO);
			break;
		case TVDefine.CH_LOCK:
			status = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_CH_LOCK);
			break;
		case TVDefine.AUTO_SET:
			status = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_AUTO_SET);
			break;	
		case TVDefine.KeyLock:
			status = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_KEY_LOCK);
			break;
		case TVDefine.AfterSaleMenu_GetUserID:
			status = ThirdParty.getGetUserIDStatus();
			break;				
		case TVDefine.AfterSaleMenu_BGM:
			status = ThirdParty.getBGM();
			break;	
		case TVDefine.AfterSaleMenu_NMR:
			status = ThirdParty.getNMR();
			break;	
		case TVDefine.AfterSaleMenu_HbbTV_mode:
			status = ThirdParty.getHbbTVMode();
			break;
		case TVDefine.SilentInstallMode:
			status = ThirdParty.mFactoryAdapter.getHotelSilentInstal();			
			break;
		default:	
			Debug.v(TAG, "readS default case");
		}			
		return status;
	}
  	
	
	/**
	 * read the value of the device that is defined in  TVDefine.java
	 * @param id the constant which is defined in TVDefine.java
	 * @param value the eeprom's address that is being read
	 * @return the value of the specified address of eeprom
	 */
	public static int readV(int id, int value)
	{
		Debug.v(TAG, "TV.readV(" + id + "," + value + ")");
		int valueT = 0;
		switch(id)
		{
		case TVDefine.NVM:
			// 还需找f1对接
//			valueT = ThirdParty.getStorageValue(value);
			break;	
		case TVDefine.Overscan:
			valueT = TCL.getOverscan(value);
			break;	
		default:
			Debug.v(TAG, "readV default case");
		}
		
		return valueT;
	}


	public static int readV(int id, int value1, int value2)
	{
		Debug.v(TAG, "TV.readV(" + id + "," + value1 + "," + value2 + ")");
		int valueT = 0;
		switch(id)
		{
		case TVDefine.Curve:
			valueT = ThirdParty.getCurve(value1, value2);
			break;	
		default:
			Debug.v(TAG, "readV default case");
		}
		
		return valueT;
	}
	
	/**
	 * read the value of the device that is defined in  TVDefine.java
	 * @param id the constant which is defined in TVDefine.java
	 * @return the value that the device want to give us
	 */
	public static int readV(int id)
	{
		Debug.v(TAG, "TV.readV(" + id + ")");
		int value = 0;	
		switch(id)
		{
		case TVDefine.PowerMode:
			value = ThirdParty.getPowerModeValue();
			break;	
		case TVDefine.PictureMode:
			value = ThirdParty.getPictureModeValue();
			break;	
		case TVDefine.Hotel_PictureMode:
			value = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_PICTURE_MODE, 0);
			break;	
		case TVDefine.AudioMode:
			value = ThirdParty.getAudioModeValue();
			break;
		case TVDefine.Hotel_SoundMode:
			value = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_SOUND_MODE,0);
			break;
		case TVDefine.AudioBalance:
			value = ThirdParty.getAudioBalanceValue();
			break;
		case TVDefine.AudioType:
			value = ThirdParty.getAudioTypeValue();
			break;
		case TVDefine.Hotel_PresetVolume:
			value = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_POWER_VOLUME, 0);
			break;
		case TVDefine.AudioVolume:
			value = ThirdParty.getAudioVolumeValue();
			break;
		case TVDefine.AudioScene:
			value = ThirdParty.getAudioSceneValue();
			break;
		case TVDefine.AudioFormat:
			value = ThirdParty.getAudioFormatValue();
			break;			
			
		case TVDefine.RGain:
			value = ThirdParty.getRGainValue();
			break;
		case TVDefine.GGain:
			value = ThirdParty.getGGainValue();
			break;
		case TVDefine.BGain:
			value = ThirdParty.getBGainValue();
			break;
		case TVDefine.RGainOffset:
			value = ThirdParty.getRGainOffsetValue();
			break;
		case TVDefine.GGainOffset:
			value = ThirdParty.getGGainOffsetValue();
			break;
		case TVDefine.BGainOffset:
			value = ThirdParty.getBGainOffsetValue();
			break;
		case TVDefine.Hue:
			value = ThirdParty.getHueValue();
			break;
		case TVDefine.Contrast:
			value = ThirdParty.getContrastValue();
			break;
		case TVDefine.BackLight:
			value = ThirdParty.getBackLightValue();
			break;
		case TVDefine.Brightness:
			value = ThirdParty.getBrightnessValue();
			break;
		case TVDefine.Sharpness:
			value = ThirdParty.getSharpnessValue();
			break;
		case TVDefine.Saturation:
		case TVDefine.Color:
			value = ThirdParty.getSaturationValue();
			break;
		case TVDefine.NatureLightBP:
			value = ThirdParty.getNatureLightBPValue();
			break;
		case TVDefine.NatureLightAPL2:
			value = ThirdParty.getNatureLightAPL2Value();
			break;
		case TVDefine.ColorTemperature:
			value = ThirdParty.getColorTemperatureValue();
			break; 
		case TVDefine.PictureFormat:
			value = ThirdParty.getPictureFormatValue();
			break;
		case TVDefine.SidePanelKeyCode:
			value = ThirdParty.getSidePanelButtonValue();
			break; 
		case TVDefine.ProjectID:
			value = ThirdParty.getProjectIDValue();
			break; 
		case TVDefine.PanelID:
			value = ThirdParty.getPanelIDValue();
			break; 
		case TVDefine.PanelMaxID:
			value = ThirdParty.getPanelMaxIDValue();
			break;
		case TVDefine.AreaFrequence:
			value = ThirdParty.getAreaFrequenceValue();
			break;	
		case TVDefine.CityID:
			value = ThirdParty.getCityIDValue();
			break;	
		case TVDefine.LVDSSpan:
			value = ThirdParty.getLVDSSpan();
			break;	
		case TVDefine.LVDSStep:
			value = ThirdParty.getLVDSSteps();
			break;	
		case TVDefine.MemorySpan:
			value = ThirdParty.getMemorySpan();
			break;		
		case TVDefine.MemoryStep:
			value = ThirdParty.getMemorySteps();
			break;
		case TVDefine.ChinaDescramblerBoxMode2Delay:
			value = ThirdParty.getChinaDescramblerBox2Delay();
			break;
		case TVDefine.PanelSwing:
			value = ThirdParty.getVby1DrivingCurrent();
			break;
		case TVDefine.MemcLevel:
			value = ThirdParty.getMemcLevel();
			break;
		case TVDefine.SSC_FRC_SPAN:
			value = ThirdParty.getSscFrcSpan();
			break;
		case TVDefine.SSC_FRC_STEP:
			value = ThirdParty.getSscFrcStep();
			break;
		case TVDefine.SSC_OSD_SPAN:
			value = ThirdParty.getSscOsdSpan();
			break;
		case TVDefine.SSC_OSD_STEP:
			value = ThirdParty.getSscOsdStep();
			break;
		case TVDefine.Hotel_MaxVolume:
			value = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MAX_VOLUME,0);
			break;	
		case TVDefine.AudioVolumeMax:
			value = TCL.getHotelVolumeMaxValue();
			break;	
		case TVDefine.InputSource:
			value = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_SOURCE,0);
			break;	
		case TVDefine.ChannelPreSet:
			value = ThirdParty.getHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_POWER_ATV_CH,0);
			break;
		case TVDefine.AfterSaleMenu_DVBT2_mode:
			value = ThirdParty.getDVBT2ModeValue();
			break;		
		case TVDefine.ADC_MAX:
			value = ThirdParty.getAdcMaxValue();
			break;
		case TVDefine.ADC_MIN:
			value = ThirdParty.getAdcMinValue();
			break;
		case TVDefine.RATIO_MIN:
			value = ThirdParty.getRatioMinValue();
			break;
		case TVDefine.StandbyLEDIndicatorMode:
			value = ThirdParty.mFactoryAdapter.getStandbyLEDIndicatorMode();
			break;
		case TVDefine.GraphicBackLight:
			value = ThirdParty.getGraphicBacklightValue();
			break;
		default:
			Debug.v(TAG, "readV default case");
		}
		return value;
	}
 


	
	/**
	 * read the data from the device that is defined in  TVDefine.java
	 * @param id the constant which is defined in TVDefine.java
	 * @return the data that the device want to give us
	 */
//	public static short[] readD(int id, short[] data)
//	{
//		Debug.v(TAG, "TV.readD(" + id + "," + data+")");
//		short[] dataT = {0};
//		switch(id)
//		{
//		case TVDefine.HdcpKey:
//			dataT = TCL.getHdcpKey(data);
//			break;
// 		default:
//			Debug.v(TAG, "readD default case");
//		}		
//		return dataT;
//	}
	
	public static short[] readD(int id)
	{
		Debug.v(TAG, "TV.readD(" + id + ")");
		short[] dataT = {0};
		switch(id)
		{
		case TVDefine.WarmUPTime:
			dataT = TCL.getWarmUPTimeData();
			break;
		case TVDefine.PlatformType:
			dataT = TCL.getPlatformTypeData();
			break;
		case TVDefine.SN:
			dataT = ThirdParty.getSNShort();
			break;
		case TVDefine.NatureLight:
			dataT = ThirdParty.getNaturaLightParameter();
			break;
		case TVDefine.MAC:
			dataT = ThirdParty.getMACAddressShort();
			break;
		case TVDefine.DeviceID:
			dataT = ThirdParty.getDeviceIDShort();
			break;
		case TVDefine.RegiterCode:
			dataT = ThirdParty.getRegiterCodeShort();
			break;
		case TVDefine.DeviceIDMACStatus:
			dataT = ThirdParty.pollingDeviceIDAndMacStatus();
			break;
		case TVDefine.USBCloneStatus:
			dataT = TCL.getUSBCloneStatus();
			break;
		case TVDefine.FactoryTest:
			dataT = ThirdParty.getFactoryTestData();
			break;
		case TVDefine.SoftwareVersion://Jane add
			dataT= Utils.String2Short(ThirdParty.getSoftwareVersion());
			break;
		case TVDefine.BootloaderVersion://Jane add
			dataT= Utils.String2Short(ThirdParty.getBootcodeVersion());
			break;
		default:
			Debug.v(TAG, "readD default case");
		}		
		return dataT;
	}
 
	
// super.StatusHandlerEEPROM(TVDefine.NULL, ConfigType.ADDR_Hotel_BootLogo) ;break;
	
//	protected void StatusHandlerEEPROM(int TVDefineID, int EEPROMAddress)
//	{
//		if(TV.readV(TVDefine.NVM, EEPROMAddress) == DEFS.COMMON_ON)
//		{
//			TV.writeS(TVDefineID, DEFS.Disable);  // execute in time
	
	
	// set status of resource
	public static void writeS(int id, boolean status)
	{
		Debug.v(TAG, "TV.writeS(" + id + "," + status + ")");
		switch(id)
		{
		case TVDefine.DMode:
			ThirdParty.setDModeStatus(status);
			break;
		case TVDefine.PMode:
			ThirdParty.setPModeStatus(status);
			break;
		case TVDefine.SitaPMode:
			ThirdParty.setSitaPModeStatus(status);
			break;
		case TVDefine.WMode:
			ThirdParty.setWModeStatus(status);
			break;
		case TVDefine.AudioMute:
			ThirdParty.setAudioMuteStatus(status);
			break;
		case TVDefine.AudioSmartVolume:
			ThirdParty.setAudioSmartVolumeStatus(status);
			break;
		case TVDefine.KeyCodeTest:
			TCL.setKeyCodeTestStatus(status);
			break;
//		case TVDefine.SerialDebug:
//			TCL.setSerialDebugStatus(status);
//			break;	
		case TVDefine.Serial:
			ThirdParty.setSerialStatus(status);
			break;	
		case TVDefine.WarmUP:
			TCL.setWarmUpStatus(status);
			break;	
		case TVDefine.PanelRotate:
			ThirdParty.setPanelRotateStatus(status);
			break;	
		case TVDefine.NonStandardMode:
			ThirdParty.setNonStandardStatus(status);
			break;	
		case TVDefine.PowerKeyPassToApp:
			ThirdParty.setPowerKeyPassToApp(status);
			break;	
//		case TVDefine.KeyLock:
//			ThirdParty.setKeyLockStatus(status);
//			break;	
		case TVDefine.DBC:
			ThirdParty.setNatureLightEnabled(status);
			break;	
		case TVDefine.DCC:
			ThirdParty.setDccEnabled(status);
			break;	
		case TVDefine.ChinaDescramblerBoxMode1:
			ThirdParty.setChinaDescramblerBox1(status);
			break;	
		case TVDefine.ChinaDescramblerBoxMode2:
			ThirdParty.setChinaDescramblerBox2(status);
			break;
		case TVDefine.ThreeDMode:
			ThirdParty.setThreeDMode(status);
			break;
		case TVDefine.MemorySSC:
			ThirdParty.setMemorySSC(status);
			break;	
		case TVDefine.LVDSSSC:
			ThirdParty.setLVDSSSC(status);
			break;
		case TVDefine.WatchDog:
			ThirdParty.setWatchDog(status);
			break;
		case TVDefine.SSC_FRC_ENABLE:
			ThirdParty.setSscFrcEnable(status);
			break;	
		case TVDefine.SSC_OSD_ENABLE:
			ThirdParty.setSscOsdEnable(status);
			break;
		case TVDefine.POWER_LOGO:
			ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_POWER_LOGO,status);
			break;
		case TVDefine.CH_LOCK:
		    ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_CH_LOCK,status);
			break;
		case TVDefine.AUTO_SET:
			ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_AUTO_SET,status);
			break;	
		case TVDefine.KeyLock:
			ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_KEY_LOCK,status);
			break;	
		case TVDefine.AfterSaleMenu_GetUserID:
			ThirdParty.setGetUserIDStatus(status);
			break;			
		case TVDefine.AfterSaleMenu_BGM:
			ThirdParty.setBGM(status);
			break;
		case TVDefine.AfterSaleMenu_NMR:
			ThirdParty.setNMR(status);
			break;
		case TVDefine.AfterSaleMenu_HbbTV_mode:
			ThirdParty.setHbbTVMode(status);			
			break;			
		case TVDefine.SilentInstallMode:
			ThirdParty.setHotelSilentInstal(status);			
			break;	
		default:
			Debug.v(TAG, "writeS default case");
		}
}
	
	public static void writeV(int id)
	{
		Debug.v(TAG, "TV.writeV(" + id + ")");
		switch(id)
		{
		case TVDefine.AudioVolumeUp:
			ThirdParty.setAudioVolumeUp();
			break;
		case TVDefine.AudioVolumeDown:
			ThirdParty.setAudioVolumeDown();
			break;	
		case TVDefine.ChannelUp:
			ThirdParty.setChannelUp( );
			break;	
		case TVDefine.ChannelDown:
			ThirdParty.setChannelDown( );
			break;	
		case TVDefine.NVMReSet:
			//ThirdParty.NVMReset();
			ThirdParty.NVMResetSelect(false);
			break;	
		case TVDefine.ResetAll:
			//ThirdParty.ResetAll();
			ThirdParty.NVMResetSelect(true);
			break;	
		case TVDefine.ShopInit:
			ThirdParty.shopInit();
			break;	
		case TVDefine.WhiteBalance:
			ThirdParty.whiteBalanceInit();
			break;	
		default:
			Debug.v(TAG, "writeV default case");
	}	
	}

	// write value to resource
	public static void writeV(int id, int value)
	{
		Debug.v(TAG, "TV.writeV(" + id + "," + value + ")");
		switch(id)
		{
		case TVDefine.PictureMode:
			ThirdParty.setPictureModeValue(value);
			break;	
		case TVDefine.Hotel_PictureMode:
			ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_PICTURE_MODE, value);
			break;	
		case TVDefine.ChannelPreSet:
			//ThirdParty.channelPreSet(value);
			ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_POWER_ATV_CH, value);
			break;	
		case TVDefine.RGain:
			ThirdParty.setRGainValue(value);
			break;
		case TVDefine.GGain:
			ThirdParty.setGGainValue(value);
			break;
		case TVDefine.BGain:
			ThirdParty.setBGainValue(value);
			break;
		case TVDefine.RGainOffset:
			ThirdParty.setRGainOffsetValue(value);
			break;
		case TVDefine.GGainOffset:
			ThirdParty.setGGainOffsetValue(value);
			break;
		case TVDefine.BGainOffset:
			ThirdParty.setBGainOffsetValue(value);
			break;
		case TVDefine.Hue:
			ThirdParty.setHueValue(value);
			break;
		case TVDefine.Contrast:
			ThirdParty.setContrastValue(value);
			break;
		case TVDefine.BackLight:
			ThirdParty.setBackLightValue(value);
			break;
		case TVDefine.Brightness:
			ThirdParty.setBrightnessValue(value);
			break;
		case TVDefine.Sharpness:
			ThirdParty.setSharpnessValue(value);
			break;
		case TVDefine.Saturation:
		case TVDefine.Color:
			ThirdParty.setSaturationValue(value);
			break;
		case TVDefine.NatureLightMode:
			ThirdParty.setNatureLightModeValue(value);
			break;
		case TVDefine.NatureLightBP:
			ThirdParty.setNatureLightBPValue(value);
			break;
		case TVDefine.NatureLightAPL2:
			ThirdParty.setNatureLightAPL2Value(value);
			break;		
		case TVDefine.NatureLightBKE:
			ThirdParty.setNatureLightBKEValue(value);
			break;
		case TVDefine.ColorTemperature:
			ThirdParty.setColorTemperatureValue(value);
			break; 
		case TVDefine.PictureFormat:
			ThirdParty.setPictureFormatValue(value);
			break; 

		case TVDefine.PowerMode:
			ThirdParty.setPowerModeValue(value);
			break;

//		case TVDefine.NVM:
//			ThirdParty.setNVMAddress(value);
//			break; 
		case TVDefine.NVM2USB:
			ThirdParty.NVM2USB(value);
			break; 
		case TVDefine.USB2NVM:
			ThirdParty.USB2NVM(value);
			break; 
		case TVDefine.ProjectID:
			ThirdParty.setProjectIDValue(value);
			break; 
		case TVDefine.PanelID:
			ThirdParty.setPanelIDValue(value);
			break; 
		case TVDefine.CityID:
			ThirdParty.setCityIDValue(value);
			break;	
		case TVDefine.AudioMode:
			 ThirdParty.setAudioModeValue(value);
			break;
		case TVDefine.Hotel_SoundMode:
			ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_SOUND_MODE, value);
			break;
		case TVDefine.AudioBalance:
			ThirdParty.setAudioBalanceValue(value);
			break;
		case TVDefine.AudioType:
			ThirdParty.setAudioTypeValue(value);
			break;
		case TVDefine.Hotel_PresetVolume:
			ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_POWER_VOLUME, value);
		case TVDefine.AudioVolume:
			ThirdParty.setAudioVolumeValue(value);
			break;
		case TVDefine.Hotel_MaxVolume:
			ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_MAX_VOLUME,value);
			break;
		case TVDefine.AudioVolumeMax:
			TCL.setHotelVolumeMaxValue(value);
			break;
		case TVDefine.AudioScene:
			ThirdParty.setAudioSceneValue(value);
			break;
		case TVDefine.AudioFormat:
			ThirdParty.setAudioFormatValue(value);
			break;	

		case TVDefine.ChannelSet:
			ThirdParty.ChannelSet(value);
			break;

		case TVDefine.LVDSSpan:
			ThirdParty.setLVDSSpan(value);
			break;	
		case TVDefine.LVDSStep:
			ThirdParty.setLVDSSteps(value);
			break;	
		case TVDefine.MemorySpan:
			ThirdParty.setMemorySpan(value);
			break;	
		
		case TVDefine.MemoryStep:
			ThirdParty.setMemorySteps(value);
			break;	
		case TVDefine.ChinaDescramblerBoxMode2Delay:
			ThirdParty.setChinaDescramblerBox2Delay(value);
			break;	
		case TVDefine.PanelSwing:
			ThirdParty.setVby1DrivingCurrent(value);
			break;
		case TVDefine.MemcLevel:
			ThirdParty.setMemcLevel(value);
			break;
		case TVDefine.SSC_FRC_SPAN:
			ThirdParty.setSscFrcSpan(value);
			break;	
		case TVDefine.SSC_FRC_STEP:
			ThirdParty.setSscFrcStep(value);
			break;	
		case TVDefine.SSC_OSD_SPAN:
			ThirdParty.setSscOsdSpan(value);
			break;
		case TVDefine.SSC_OSD_STEP:
			ThirdParty.setSscOsdStep(value);
			break;
		case TVDefine.InputSource:
			ThirdParty.setHotelAttribute(FactoryManager.FACTORY_ATTR_HOTEL_SOURCE, value);
			break;
		case TVDefine.AfterSaleMenu_DVBT2_mode:
			ThirdParty.setDVBT2ModeValue(value);
			break;	
		case TVDefine.ADC_MAX:
			ThirdParty.setAdcMaxValue(value);
			break;
		case TVDefine.ADC_MIN:
			ThirdParty.setAdcMinValue(value);
			break;
		case TVDefine.RATIO_MIN:
			ThirdParty.setRatioMinValue(value);
			break;
		case TVDefine.StandbyLEDIndicatorMode:
			ThirdParty.setStandbyLEDIndicatorMode(value);
			break;
		case TVDefine.GraphicBackLight:
			ThirdParty.setGraphicBackLightValue(value);
			break;
		default:
			Debug.v(TAG, "writeV default case");
		}	
 	}

	
	
	public static void writeV(int id, int value1, int value2)
	{
		Debug.v(TAG, "TV.writeV(" + id + "," + value1 + "," + value2 + ")");
		switch(id)
		{
		case TVDefine.NVM:
			// 还需找f1对接
//			ThirdParty.setStorageValue(value1, value2);//Jane add
			break;
		case TVDefine.Overscan:
			TCL.setOverscan(value1, value2);
			break;
		
		default:
			Debug.v(TAG, "writeV default case");
		}
	}
	public static void writeV(int id, int value1, int value2, int value3)
	{
		Debug.v(TAG, "TV.writeV(" + id + "," + value1 + "," + value2 + "," + value3 + ")");
		switch(id)
		{
		case TVDefine.Curve:
			ThirdParty.setCurve(value1,value2,value3);
			break;

		default:
			Debug.v(TAG, "writeV default case");
		}
	}
 
// write data to resource	
	public static void writeD(int id, short[] data)
	{		
		Debug.v(TAG, "TV.writeD(" + id + "," + data + ")");
		switch(id)
		{
		case TVDefine.Serial:
			ThirdParty.setSerialOutputData(data);
			break;
		case TVDefine.HdcpKey:
			ThirdParty.setHdcpKeyShort(data);
			break;
		case TVDefine.HdcpKey20:
			ThirdParty.setHdcpKey20Short(data);
			break;
		case TVDefine.RegiterCode:
			ThirdParty.setRegiterCodeShort(data);
			break;
		case TVDefine.DeviceID:
			ThirdParty.setDeviceIDShort(data);
			break;
		case TVDefine.SN:
			ThirdParty.setSNShort(data);
			break;
		case TVDefine.MAC:
			ThirdParty.setMACAddressShort(data);
			break;
		case TVDefine.FactoryTest:
			ThirdParty.setFactoryTestData(data);
			break;
		default:
			Debug.v(TAG, "writeD default case");
		}
 	}
  
	
	
	public static void setSource(int type, int index)
	{ 
		Debug.v(TAG, "setSource" + type + "," + index);
		ThirdParty.setSourceType(type, index);				
	}
	public static void setSource(int type, int index, boolean asLastestSavedSource)
	{ 
		Debug.v(TAG, "[setSource]type/index/asLastestSavedSource = " + type + "/" + index + "/" + asLastestSavedSource);
		ThirdParty.setSourceType(type, index, asLastestSavedSource);				
	}	
	public static void setATVChannel(int index)
	{ 
		Debug.v(TAG, "setATVChannel" + index);
		ThirdParty.selectProgram(index);
		Utils.showATVInfo(index);
	}
	
	public static void setDTVChannel( int index)
	{ 
		Debug.v(TAG, "setDTVChannel");
		ThirdParty.selectProgramDTV(index);
		Utils.showDTVInfo(index);
	}
	public static String getSourceType()
	{
		Debug.v(TAG, "getSourceType");
		return ThirdParty.getSourceType();
	}
	public static int getSourceTypeIndex(){
		return ThirdParty.getSourceTypeIndex();
	}


//	public static void implemetThirdPartyIsntance(Context context)
//	{
//		mContext = context;
//		Utils.mContext=context;
//		new ThirdParty(mContext);
//	}

}
