📄 emc_autosearch.c
字号:
sttbx_Print( "Failed to add new transponder slot\n" );/*channel full*///wuhan modified,06-28-2005
#endif
return FALSE;
}
pstTransponderInfoTemp->Xpdr.Terrestrial.iTransponderFreq=iInputFrequency;
pstTransponderInfoTemp->Xpdr.Terrestrial.iBandWidth=iBandWidth; //set input param and then send to tuner,by jy
if(SRUIF_ReadTunerParam(pstTransponderInfoTemp) == INVALID_LINK)
{
xpdrInManSearch = cLocalTransSlot;
sttbx_Print("\nxpdrInManSearch = %d\n",xpdrInManSearch);
if (!SRUIF_SendNewTuneReq(cLocalTransSlot, pstTransponderInfoTemp )/*TMTM &&(iInputFrequency!=0)*/)
{ /*Succeed*/
return TRUE;
}
else
{
//STTBX_Print( "Can't Lock Tuner \n"); TMTM actually wrong params
sttbx_Print( "Tuner param errors... \n"); //TMTM081104
SRDBE_DeleteProgramsByTransponder(cLocalTransSlot);
DeleteTransponderSlot(cLocalTransSlot);
return FALSE;
}
}
else
{
/* Free the appended transponder */
SRDBE_DeleteProgramsByTransponder(cLocalTransSlot);
DeleteTransponderSlot(cLocalTransSlot);
return FALSE;
}
return FALSE;//wuhan 05-19-2005
}
int AutoSearchPerform(void)/*PerformAutoSearchTask(also used in appblast.c)*/
{
//sd textrect;
clock_t curTime = 0;
U32 SignalQuality,SignalStrength;
char str[20];
str[19]='\0';
//textrect.x = 50;
//textrect.y = 50;
#if 0
/*show the sinal strenth and quality,07-05-2005*/
SRTNR_GetSignalInfo(TNR_DEFAULT_ID, &SignalQuality, &SignalStrength);
sprintf(str,"%d",SignalQuality);
MyDrawTextButton(Handle_Menu4bpp, 0,0,80,200, //wuhan modified,07-02-2005
"",lightbluecolor,lightbluecolor,lightbluecolor,300);
EMC_DrawText(Handle_Menu4bpp, FONT_MYFONT,str,&textrect, //wuhan modified,07-02-2005
whitecolor);
MyDrawTextButton(Handle_Menu4bpp, 50,100+100-SignalQuality,30,SignalQuality+10, //wuhan modified,07-02-2005
"",blackcolor,yellowcolor,yellowcolor,300);
sprintf(str,"%d",SignalStrength);
textrect.x = MainParams4bpp.Width*5/6+20;
textrect.y = 50;
MyDrawTextButton(Handle_Menu4bpp, MainParams4bpp.Width*5/6,0,80,200, //wuhan modified,07-02-2005
"",lightbluecolor,lightbluecolor,lightbluecolor,300);
EMC_DrawText(Handle_Menu4bpp,FONT_MYFONT, str,&textrect, //wuhan modified,07-02-2005
whitecolor);
MyDrawTextButton(Handle_Menu4bpp,MainParams4bpp.Width*5/6+20 ,100+100-SignalStrength,30,SignalStrength+10, //wuhan modified,07-02-2005
"",blackcolor,yellowcolor,yellowcolor,300);
#else
/*show the sinal quality,09-22-2005*/
SRTNR_GetSignalInfo(TNR_DEFAULT_ID, &SignalQuality, &SignalStrength);
if(SignalQuality<1|| SignalQuality>100)
SignalQuality = 0;
sprintf(str,"%d",SignalQuality);
//sttbx_Print("\nSignalQuality = %s\n",str);
updateAutoSearchEditBox(Handle_ProviewWindow,AS_X+210,AS_Y(iPAL_Mode)+40,str,whitecolor,dialogcolor);
#endif
/*check if current search frequency have program*/
curTime = time_now();
//sttbx_Print(("time_now is %d\n",curTime));
if(time_minus(curTime , autoSearchStartTime) >= 10*WAIT_FOR_3_SEC) //wuhan modified,to cofirm finishing the SDT,07-01-2005
{ /*time out, no signal on this frequency*/
sttbx_Print(("\n-------------Autosearch Timeout!\n"));
}
else
{ /*continue to check*/
if(DBaseBlgDone == 100 )
{ /*cannot lock frequency*/
/*Added by Allen,03-08-2006,moved from sr_tuner.c*/
DBaseBlgDone = FALSE;
if(xpdrInManSearch != INVALID_LINK)
{
/* if currently in manual search, delete created transponder */
sruif_SendMsgFromUsif2DBase(xpdrInManSearch, STOP_DATA_BASE_BUILDING); /* Issue34 */
SRDBE_DeleteProgramsByTransponder(xpdrInManSearch);
DeleteTransponderSlot(xpdrInManSearch);
xpdrInManSearch = INVALID_LINK;
}
sttbx_Print("\n@@@@@@@@@@@@@@@@DBaseBlgDone == 100 (in AutoSearchPerorm)\n");
}
else if(DBaseBlgDone == TRUE)
{
int iTemp = SRDBE_PositionProgInfoTop();//wuhan added for auto search,05-19-2005
ChannelsFoundNum++;//wuhan added for auto search,05-19-2005
STTBX_Print(( "\nNo of channelsfound [%d]\n", ChannelsFoundNum));
if(iTemp != INVALID_LINK)
ProgramsFoundNum = iTemp;
UpdateAutoSearchWindow();
}
else
return TRUE;
}
CurSearchFreq += iBandWidth;
AutosearchProgress = (CurSearchFreq - MIN_FREQ)/4;
if(CurSearchFreq >= MAX_FREQ)/*modified by Allen,01-04-2005*/
{
//int iProgNo;
//PROG_INFO_STRUCT *pstProgInfoTemp;
#if 0 /*just search for 8M bandwidth,09-22-2005*/
if(iBandWidth != 6)
{
CurSearchFreq = MIN_SEARCH_FREQUENCY;
iBandWidth--;
}
else //iBandWidth=6,meaning the searching should be finished!wuhan modified,07-02-2005
#endif
{
sttbx_Print("\n----AutosearchProgress = %d\n",AutosearchProgress);
ChangeAutoSearchTips("Search Finished!","搜索完毕!","",3);
#if 0
currMenuState = DVB_PRE_AUTO_SEARCH;
#else
msm_FeedbackMsg(cmd_Exit);/*change state to DVB_PRE_AUTO_SEARCH*/
#endif
SRDBE_PositionProgInfoTop();
iLastProgramNumber = -1;
#if 0
ChangeStateToDVBDisplay(DVB_PREPARE_AUTO_SEARCH_STATE);
#else
msm_FeedbackMsg(cmd_Exit);/*change state to DVB_AUTO_SEARCH*/
#endif
}
return TRUE;
}
DBaseBlgDone = FALSE; /*Fix me*/
if(PrepareNewSearchingFrequency() != TRUE)
{
ChangeAutoSearchTips("Search Failed!","搜索失败!","",3);
UpdateAutoSearchWindow();
#if 0
DVB_Screen_State = DVB_PREPARE_AUTO_SEARCH_STATE;
#else
currMenuState = DVB_PRE_AUTO_SEARCH;
#endif
return FALSE;
}
UpdateAutoSearchWindow();
autoSearchStartTime = time_now();
return TRUE;
}
void msm_StartAutoSearch(void)/*doAutoSearch*/
{
/*Step 1: initialiaziation*/
sttbx_Print( "doAutoSearch\n" );
SRDBE_DeleteAllTransponders();
InitEPGSkedDateTag();/*Added by Allen,03-15-2006*/
DBaseBlgDone = FALSE;
ChangeAutoSearchTips("Seeking...","正在搜索...","",3);
#if 0
CurSearchFreq=MIN_FREQ;
iBandWidth = 8;
#else
if(CountrySelect == 4)/*Taiwan*/
{
CurSearchFreq = MIN_SEARCH_FREQUENCY_6M;
iBandWidth = 6;
}
else
{
CurSearchFreq = MIN_SEARCH_FREQUENCY_8M;
iBandWidth = 8;
}
#endif
ChannelsFoundNum=0;/*wuhan added for auto search,05-19-2005*/
ProgramsFoundNum= 0; /*wuhan added for auto search,05-19-2005*/
AutosearchProgress = 0; /*added by Allen,09-22-2005*/
drawAutoSearchWindow();
/*AL09 Start*/
#if 0/*move the block to the end of this func,by Allen,11-05-2005*/
DVB_Screen_State = DVB_AUTO_SEARCH_STATE;
sttbx_Print("\nEntering DVB_AUTO_SEARCH_STATE\n");
#endif
/*AL09 End*/
/*Step 2: perform the fisrt frequency to search*/
/* Stop current Channel */
SRAVC_AVstop();
if(PrepareNewSearchingFrequency() != TRUE)
{
ChangeAutoSearchTips("Tuner param errors...","高频头参数错误...","",3);
UpdateAutoSearchWindow();
#if 0
DVB_Screen_State = DVB_PREPARE_AUTO_SEARCH_STATE;
#else
currMenuState = DVB_PRE_AUTO_SEARCH;
#endif
sttbx_Print("\nEntering DVB_PREPARE_AUTO_SEARCH_STATE\n");
return;
}
autoSearchStartTime = time_now();
/*AL09 Start*/
/*moved by Allen,11-05-2005*/
/*this movement is very important!!Or it will affect the other process in Appblast.c*/
#if 0
DVB_Screen_State = DVB_AUTO_SEARCH_STATE;
#else
//currMenuState = DVB_AUTO_SEARCH;
#endif
sttbx_Print("\nEntering DVB_AUTO_SEARCH_STATE\n");
/*AL09 End*/
}
void msm_AutoSearchPause(void)
{
ChangeAutoSearchTips("User break!","用户中止!","",3);
/*wuhan added,07-20-2005,解决自动搜台后第一个节目不能自动播放的问题*/
iLastProgramNumber = -1;
UpdateAutoSearchWindow();
//DVB_Screen_State = DVB_PREPARE_AUTO_SEARCH_STATE;
sttbx_Print("\nEntering DVB_PREPARE_AUTO_SEARCH_STATE\n");
}
void msm_AutoSearchRestart(void)
{
if(currMenuState == DVB_PRE_AUTO_SEARCH)
{
msm_StartAutoSearch();
}
}
void msm_AutoSearchExit(void)
{
RestoreAutoSearchParameter();
msm_ClearScreen();
EMC_ResetTime();
}
/*------------------------------------EOF---------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -