private void go2BootDefaultChannel(int serviceId) { ServiceInfoDao serInfoDao = new ServiceInfoDaoImpl(this); List<ServiceInfoBean> nBeans = serInfoDao.getChannelIdByLogicalNumber(serviceId); ServiceInfoBean nBean = null; if (nBeans.size() != 0) { nBean = nBeans.get(0); } if (null == nBean) { LogUtils.printLog(1, 5, TAG, "--->>> get boot default channel is null !"); finish(); return; } Bundle bundle = new Bundle(); bundle.putInt("ServicePos", nBean.getChannelPosition()); bundle.putInt("LogicalNumber", serviceId); bundle.putInt("ServiceId", serviceId); bundle.putString("ServiceName", nBean.getChannelName()); bundle.putChar("ServiceType", nBean.getServiceType()); bundle.putString("superPwd", superPwd); bundle.putInt("Grade", grade); bundle.putBoolean("RecStatus", recStatus); CommonUtils.skipActivity( SplashActivity.this, TVChannelPlay.class, bundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); }
public void handleMessage(Message msg) { switch (msg.what) { case Config.CONNECTION_SUCCESS: stopProgressDialog(); if (bootDefaultStatus != 0) { LogUtils.printLog( 1, 3, TAG, "--- start to play default channel " + bootDefaultStatus); go2BootDefaultChannel(bootDefaultStatus); return; } // process rec status. LogUtils.printLog(1, 3, TAG, "---Rec Status----->>>>" + recStatus); LogUtils.printLog(1, 3, TAG, "---entrance---------->>>>" + entrance); if (recStatus) { if (null != recBundle) { if (entrance.equals(Config.DVB_TV_PROGRAMME) || entrance.equals(Config.DVB_RADIO_PROGRAMME) || entrance.equals(Config.DVB_CHANNEL_SEARCH) || entrance.equals(Config.DVB_CA_USER_VIEW) || entrance.equals(Config.DVB_CHANNEL_EDIT) || entrance.equals(Config.DVB_EPG)) { new CustomToast(SplashActivity.this).show(getString(R.string.pvr_recording), 0); CommonUtils.skipActivity( SplashActivity.this, TVChannelPlay.class, recBundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { parserEntrance(); } } else { handler.sendEmptyMessage(Config.NO_PROGRAMME); } } else { LogUtils.printLog(1, 3, TAG, "-------Not Start Rec ----entrance--->>>" + entrance); if (null != entrance) { parserEntrance(); } } break; case Config.NO_PROGRAMME: tvTips.setVisibility(View.VISIBLE); break; } }
/** * <Parser the entrance from launcher.> * * @see [类、类#方法、类#成员] */ private void parserEntrance() { /* Start LinKang, 2013-12-24, Jump to SystemInfoActivity page... */ if (null != entrance && entrance.equalsIgnoreCase(Config.DVB_SYSTEM_INFO)) { CommonUtils.skipActivity( SplashActivity.this, SystemInfoActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } /* End LinKang, 2013-12-24, Jump to SystemInfoActivity page... */ // check if the ota is downloading now... // For OTADownloaderService may be force to quit... // So here user NativeDownload to get the ota status... NativeDownload nativeDownload = new NativeDownload(); int otaStatus = nativeDownload.downloadGetStatus(); if (otaStatus == 1) { LogUtils.e( TAG, "The OTA is in downloading status for nativeDownload.downloadGetStatus() == 1"); CommonUtils.skipActivity( SplashActivity.this, OTADownloaderActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); return; } else { LogUtils.e( TAG, "The OTA is not in downloading status for nativeDownload.downloadGetStatus() != 1"); } // Factory test if (entrance.equals(Config.DVB_FACTORY_TEST)) { CommonUtils.skipActivity( SplashActivity.this, FactoryTest.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Television Programme if (entrance.equals(Config.DVB_TV_PROGRAMME)) { if (tvList.size() != 0) { Bundle tvBundle = packageServiceInfo(); CommonUtils.skipActivity( SplashActivity.this, TVChannelPlay.class, tvBundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { if (null == searchDialog) { searchDialog = DialogUtils.twoButtonsDialogCreate( SplashActivity.this, getString(R.string.no_program_auto_search), new OnClickListener() { @Override public void onClick(View v) { if (null != searchDialog) { searchDialog.dismiss(); } Bundle bundle = new Bundle(); bundle.putInt("SearchMode", Config.Install_Search_Type_eAUTO_SEARCH); CommonUtils.skipActivity( SplashActivity.this, ChannelSearchProgress.class, bundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); } }, new OnClickListener() { @Override public void onClick(View v) { if (null != searchDialog) { searchDialog.dismiss(); } } }); } } } // Radio programme else if (entrance.equals(Config.DVB_RADIO_PROGRAMME)) { if (radioList.size() != 0) { Bundle radioInfos = packageServiceInfo(); CommonUtils.skipActivity( SplashActivity.this, TVChannelPlay.class, radioInfos, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { handler.sendEmptyMessage(Config.NO_PROGRAMME); } } // Epg else if (entrance.equals(Config.DVB_EPG)) { if (tvList.size() != 0 || radioList.size() != 0) { Bundle epgInfos = packageServiceInfo(); Bundle bundle = getIntent().getExtras(); if (null == bundle) { LogUtils.e(TAG, "SplashActivity.onKeyDown:: Epg bundle == null"); epgInfos.putChar(Config.DVB_SERVICE_TYPE, Config.SERVICE_TYPE_NOTYPE); } else { char mServiceType = bundle.getChar(Config.DVB_SERVICE_TYPE); if (mServiceType != Config.SERVICE_TYPE_TV && mServiceType != Config.SERVICE_TYPE_RADIO) { mServiceType = Config.SERVICE_TYPE_NOTYPE; } epgInfos.putChar(Config.DVB_SERVICE_TYPE, mServiceType); } CommonUtils.skipActivity( SplashActivity.this, EpgActivity.class, epgInfos, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { handler.sendEmptyMessage(Config.NO_PROGRAMME); } } // EIT else if (entrance.equals(Config.DVB_EIT)) { if (tvList.size() != 0 || radioList.size() != 0) { Bundle epgInfos = packageServiceInfo(); Bundle bundle = getIntent().getExtras(); if (null == bundle) { LogUtils.e(TAG, "SplashActivity.onKeyDown:: Eit bundle == null"); epgInfos.putChar(Config.DVB_SERVICE_TYPE, Config.SERVICE_TYPE_NOTYPE); } else { char mServiceType = bundle.getChar(Config.DVB_SERVICE_TYPE); if (mServiceType != Config.SERVICE_TYPE_TV && mServiceType != Config.SERVICE_TYPE_RADIO) { mServiceType = Config.SERVICE_TYPE_NOTYPE; } epgInfos.putChar(Config.DVB_SERVICE_TYPE, mServiceType); } CommonUtils.skipActivity( SplashActivity.this, EitActivity.class, epgInfos, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { handler.sendEmptyMessage(Config.NO_PROGRAMME); } } // Search channels else if (entrance.equals(Config.DVB_CHANNEL_SEARCH)) { CommonUtils.skipActivity( SplashActivity.this, TVChannelSearch.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // direct auto search else if (entrance.equals(Config.DVB_DIRECT_SEARCH)) { Bundle bundle = new Bundle(); bundle.putInt("SearchMode", Config.Install_Search_Type_eAUTO_SEARCH); CommonUtils.skipActivity( SplashActivity.this, ChannelSearchProgress.class, bundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // all search else if (entrance.equals(Config.DVB_ALL_SEARCH)) { Bundle bundle = new Bundle(); bundle.putInt("SearchMode", Config.Install_Search_Type_eALL_SEARCH); CommonUtils.skipActivity( SplashActivity.this, ChannelSearchProgress.class, bundle, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else if (entrance.equals(Config.DVB_FREQ_SETTING)) { CommonUtils.skipActivity( SplashActivity.this, SearchFreqSettings.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else if (entrance.equals(Config.DVB_BOOT_DEFAULT_CHANNEL)) { CommonUtils.skipActivity( SplashActivity.this, BootDefaultServiceActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Edit channels else if (entrance.equals(Config.DVB_CHANNEL_EDIT)) { if (tvList.size() != 0 || radioList.size() != 0) { Bundle editInfos = packageServiceInfo(); CommonUtils.skipActivity( SplashActivity.this, TVChannelEdit.class, editInfos, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else { handler.sendEmptyMessage(Config.NO_PROGRAMME); } } // pvr list else if (entrance.equals(Config.DVB_PVR_LIST)) { CommonUtils.skipActivity( SplashActivity.this, PvrOrderList.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } else if (entrance.equals(Config.DVB_PVR_PLAY_LIST)) { CommonUtils.skipActivity( SplashActivity.this, PvrPlayList.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca status else if (entrance.equals(Config.DVB_CA_STATUS)) { CommonUtils.skipActivity( SplashActivity.this, CaStateInfo.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca password settings else if (entrance.equals(Config.DVB_CA_PWD_SETTINGS)) { CommonUtils.skipActivity( SplashActivity.this, CaPasswordSet.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca adult grade else if (entrance.equals(Config.DVB_CA_GRADE)) { CommonUtils.skipActivity( SplashActivity.this, CaRateControl.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca auth else if (entrance.equals(Config.DVB_CA_AUTH)) { CommonUtils.skipActivity( SplashActivity.this, CaAuthInfo.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca email else if (entrance.equals(Config.DVB_CA_EMAIL)) { CommonUtils.skipActivity(SplashActivity.this, CaEmail.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } // Ca zimu card feeding else if (entrance.equals(Config.DVB_CA_USER_VIEW)) { CommonUtils.skipActivity( SplashActivity.this, PlayControlMain.class, Intent.FLAG_ACTIVITY_CLEAR_TOP); } }
/** * <搜索节目> * * @see [类、类#方法、类#成员] */ public void searchChannelInfo() { dvb = new NativeInstallation(); dvb.installationInit(); // 注册消息监听 msgInstall = new MessageInstallation(handler); dvb.installMessageInit(msgInstall); Install_Cfg_t icfg = dvb.new Install_Cfg_t(); icfg.ptTimeout = dvb.new Install_Timeout_t(); // 指定Tuner的参数类型为C类型 icfg.eSignalSource = Config.DVBCore_Signal_Source_eDVBCORE_SIGNAL_SOURCE_DVBC; if (!hasBat) { icfg.u8SearchLimitFlag = 1; } else { // 0 has bat,1 no bat icfg.u8SearchLimitFlag = 0; } // 声明Tuner参数的对象 NativeInstallation.DVBCore_Cab_Desc_t tunerDesc = dvb.new DVBCore_Cab_Desc_t(); if (null != strInputFrequency && !"".equals(strInputFrequency)) { u32Freq = Integer.parseInt(strInputFrequency); } if (null != strSymbolRate && !"".equals(strSymbolRate)) { u32SymbRate = Integer.parseInt(strSymbolRate); } else { u32Freq = Integer.parseInt(getString(R.string.InputFrequencyDefault)); u32SymbRate = Integer.parseInt(getString(R.string.SymbolRateDefault)); } int eMod = CommonUtils.getModHandling(strQam); SharedPreferences spChannel = getSharedPreferences("double_tuner", 8); int tunerid = spChannel.getInt("radio_serviceId", 0); LogUtils.printLog(1, 3, TAG, "--->>> tuner id is " + tunerid); tunerDesc.setU8TunerId((char) tunerid); tunerDesc.setU32Freq(u32Freq); tunerDesc.setU32SymbRate(u32SymbRate); tunerDesc.seteMod(eMod); // manual search if (searchMode == Config.Install_Search_Type_eTP_SEARCH) { Log.i(TAG, "---Search Type--->>>---Single TP ---------"); icfg.eSearchType = Config.Install_Search_Type_eTP_SEARCH; icfg.u32MainTpNum = 0; icfg.u32NormalTpNum = 1; icfg.puNormalTpDescList = new NativeInstallation.DVBCore_Cab_Desc_t[1]; icfg.puNormalTpDescList[0] = tunerDesc; } // auto search if (searchMode == Config.Install_Search_Type_eAUTO_SEARCH) { Log.i(TAG, "---Search Type--->>>---Auto Search ---------"); icfg.eSearchType = Config.Install_Search_Type_eAUTO_SEARCH; icfg.u32MainTpNum = 1; icfg.u32NormalTpNum = 0; NativeInstallation.DVBCore_Cab_Desc_t[] puMainTpDescList = new NativeInstallation.DVBCore_Cab_Desc_t[1]; puMainTpDescList[0] = tunerDesc; icfg.puMainTpDescList = puMainTpDescList; } // all search if (searchMode == Config.Install_Search_Type_eALL_SEARCH) { Log.i(TAG, "---Search Type--->>>---All Search ---------"); icfg.eSearchType = Config.Install_Search_Type_eALL_SEARCH; icfg.u32MainTpNum = 1; icfg.u32NormalTpNum = 0; NativeInstallation.DVBCore_Cab_Desc_t[] puMainTpDescList = new NativeInstallation.DVBCore_Cab_Desc_t[1]; puMainTpDescList[0] = tunerDesc; icfg.puMainTpDescList = puMainTpDescList; } Log.i(TAG, "--------------------DVB Search Params ---------------------------"); Log.i(TAG, "---------Search Mode is----------------------->>>" + searchMode); Log.i(TAG, "---------Input Frequency is----------------------->>>" + tunerDesc.getU32Freq()); Log.i(TAG, "---------SysbolRate is----------------------->>>" + tunerDesc.getU32SymbRate()); Log.i(TAG, "---------QAM is----------------------->>>" + tunerDesc.geteMod()); Log.i(TAG, "---------HasBAT----------------------->>>" + hasBat); int reCode = dvb.installationStart(icfg); Log.i(TAG, "---------------------------------->>>>>>>>>>Re Code ----------->>>>>" + reCode); }
public void handleMessage(Message msg) { switch (msg.what) { case Config.SIGNAL_INTERRUPT: CommonUtils.skipActivity( ChannelSearchProgress.this, AlertDialog.class, "dialogMessage", getString(R.string.NoSignal), -1); break; case Config.UPDATE_STRENGTH_QUALITY: Bundle bundle = (Bundle) msg.obj; int qValue = bundle.getInt("quality"); int sValue = bundle.getInt("strength"); pbProgressQuality.setProgress(qValue); pbProgressQuality.invalidate(); pbProgressStrength.setProgress(sValue); pbProgressStrength.invalidate(); tvQuality.setText(qValue + "%"); tvStrength.setText(sValue + "%"); break; case Config.UPDATE_SEARCH_PROGRESS: Bundle mBundle = (Bundle) msg.obj; int progress = mBundle.getInt("progress"); int freq = mBundle.getInt("frequency"); pbSearchProgress.setProgress(progress); pbSearchProgress.invalidate(); tvSearchProgress.setText(progress + "%"); pbSearchProgress.invalidate(); tvInputFrequency.setText(freq + ""); break; case Config.AUTO_SEARCH_COMPLETE: Log.i(TAG, "---------------------AUTO-SEARCH-SUCCESS!!------------------"); new SaveProgramTask().execute(); break; case Config.AUTO_SEARCH_FAILED: Log.i(TAG, "---------------------AUTO-SEARCH-FAILED!!------------------"); processDialog(); break; case Config.SIGLE_TP_SEARCH_COMPLETE: Log.i(TAG, "---------------------SINGLE-TP-SEARCH-SUCCESS!!------------------"); Bundle beValues = (Bundle) msg.obj; int freqValue = beValues.getInt("frequency"); int symbValue = beValues.getInt("symbRate"); int modValue = beValues.getInt("mod"); switch (modValue) { case 0: tvQam.setText("16QAM"); break; case 1: tvQam.setText("32QAM"); break; case 2: tvQam.setText("64QAM"); break; case 3: tvQam.setText("128QAM"); break; case 4: tvQam.setText("256QAM"); break; } String nameValue = beValues.getString("name"); char serviceType = beValues.getChar("serviceType"); allCount++; // manual search,no type service looks as tv type. if (searchMode == Config.Install_Search_Type_eTP_SEARCH) { if (serviceType == Config.SERVICE_TYPE_TV || serviceType == Config.SERVICE_TYPE_NOTYPE) { tvNames.add(nameValue); tvCount++; } } // auto search if (searchMode == Config.Install_Search_Type_eAUTO_SEARCH || searchMode == Config.Install_Search_Type_eALL_SEARCH) { if (serviceType == Config.SERVICE_TYPE_TV) { tvNames.add(nameValue); tvCount++; } } if (serviceType == Config.SERVICE_TYPE_RADIO) { radioNames.add(nameValue); radioCount++; } tvInputFrequency.setText(freqValue + ""); tvSymbolRate.setText(symbValue + ""); tvAllPrograms.setText(allCount + ""); tvTVprograms.setText(tvCount + ""); tvRadioPrograms.setText(radioCount + ""); if (tvNames.size() > 9) { tvNames.remove(0); } if (radioNames.size() > 9) { radioNames.remove(0); } tvAdapter.setProgramNames(tvNames); tvAdapter.notifyDataSetChanged(); lvTVPrograms.setAdapter(tvAdapter); radioAdapter.setProgramNames(radioNames); radioAdapter.notifyDataSetChanged(); lvRadioPrograms.setAdapter(radioAdapter); break; case Config.SIGLE_TP_SEARCH_FAILED: Log.i(TAG, "---------------------SINGLE-TP-SEARCH-FAILED!!------------------"); break; } }