// Roundabout way but the only way possible. Need to use the svcId and find the matching svcNum by scanning all channels int GetSvcNum( int svcId ) { int tvNum, radNum; int i; int returnval = -1; TYPE_TapChInfo channel; TAP_Channel_GetTotalNum( &tvNum, &radNum ); if( tvNum < 1 ) return -1; // Sanity check for( i = 0; i < tvNum; i++ ) { TAP_Channel_GetInfo( SVC_TYPE_Tv, i, &channel ); if( channel.svcId == svcId ) { returnval = i; i = tvNum; } } if( returnval > -1 ) return returnval; // Allow for the radio for( i = 0; i < radNum; i++ ) { TAP_Channel_GetInfo( SVC_TYPE_Radio, i, &channel ); if( channel.svcId == svcId ) { returnval = i; i = radNum; } } return returnval; }
//------------ // void InitLogoMemory( void ) { int i, count; int countTvSvc, countRadioSvc; TYPE_TapChInfo currentChInfo; TAP_Channel_GetTotalNum( &countTvSvc, &countRadioSvc ); // how many services are defined on this box? if ( countTvSvc > MAX_SERVICES/2 ) { // must quit if too many services // ErrorPrint("Too many services"); // TF5800 won't be affected - so hack ok for us // return; // temp - must fix. countTvSvc = MAX_SERVICES/2; } if ( countRadioSvc > MAX_SERVICES/2 ) { countRadioSvc = MAX_SERVICES/2; } for ( i=0; i<=countTvSvc; i++) // for each TV service { TAP_Channel_GetInfo( SVC_TYPE_Tv, i, ¤tChInfo ); // get the info pointer strcpy( logoArrayTv[i].svcName, currentChInfo.chName); // and copy the channel's name logoArrayTv[i].svcLCN = currentChInfo.logicalChNum; // service LCN logoArrayTv[i].svcNum = i; // service number logoArrayTv[i].svcType = SVC_TYPE_Tv; // service type (TV, or Radio) logoArrayTv[i].processedFlag = FALSE; // no logo cached yet logoArrayTv[i].logo = TAP_MemAlloc( LOGO_DATA_SIZE ); // allocate space for the logo CreateFileName( &logoArrayTv[i] ); // filter out puntuation and generate a file name } for ( i=0; i<=countRadioSvc; i++) // do the same for each radio service on this box { TAP_Channel_GetInfo( SVC_TYPE_Radio, i, ¤tChInfo ); strcpy( logoArrayRadio[i].svcName, currentChInfo.chName); logoArrayRadio[i].svcLCN = currentChInfo.logicalChNum; // service LCN logoArrayRadio[i].svcNum = i; logoArrayRadio[i].svcType = SVC_TYPE_Radio; logoArrayRadio[i].processedFlag = FALSE; logoArrayRadio[i].logo = TAP_MemAlloc( LOGO_DATA_SIZE ); CreateFileName( &logoArrayRadio[i] ); // filter out puntuation and generate a file name } maxTvSvc = countTvSvc; // save the number of services for later maxRadioSvc = countRadioSvc; logoIndex = 0; }
bool isOnMainTuner(int SvcType, int SvcNum) { TRACEENTER(); int svcTypeMainTuner, svcNumMainTuner; TYPE_TapChInfo chInfo1, chInfo2; TAP_Channel_GetInfo(SvcType, SvcNum, &chInfo1); TAP_Channel_GetCurrent(&svcTypeMainTuner, &svcNumMainTuner); TAP_Channel_GetInfo(svcTypeMainTuner, svcNumMainTuner, &chInfo2); TRACEEXIT(); return (chInfo1.satIdx == chInfo2.satIdx) && (chInfo1.freq == chInfo2.freq); }
//------------ // void DisplayLogo( word WindowRgn, dword Xcoord, dword Ycoord, int svcNum, byte svcType ) { char str[80]; dword width; int i; TYPE_logoArray *localPtr; TYPE_TapChInfo currentChInfo; if ( !TAP_Channel_GetInfo( svcType, svcNum, ¤tChInfo ) ) return; // service doesn't exist ! if ( svcType == SVC_TYPE_Tv ) localPtr = &logoArrayTv[svcNum]; // recover the correct pointer - TV, or Radio else localPtr = &logoArrayRadio[svcNum]; if ( localPtr->processedFlag == TRUE ) // is this logo in our cache? { // yes -> display it TAP_Osd_RestoreBox( WindowRgn, Xcoord, Ycoord, LOGO_W, LOGO_H, localPtr->logo ); } else // no -> just print the channel's name { // in place of the logo TAP_Osd_FillBox( rgn, Xcoord, Ycoord, LOGO_W, LOGO_H, COLOR_Black ); // blank the background i=0; FormatNameString( localPtr->svcName, &i, str, LOGO_W - 5); // print the 1st line TAP_Osd_PutStringAf1419( WindowRgn, Xcoord, Ycoord, Xcoord + LOGO_W + 5, str, COLOR_White, 0 ); FormatNameString( localPtr->svcName, &i, str, LOGO_W - 5); // print the 2nd line TAP_Osd_PutStringAf1419( WindowRgn, Xcoord, Ycoord + (LOGO_H/2), Xcoord + LOGO_W + 5, str, COLOR_White, 0 ); } }
char* Channel_Name( int svcType, int svcNum ) { TYPE_TapChInfo chInfo; static char channelName[128]; memset( channelName, 0, sizeof channelName ); TAP_Channel_GetInfo( svcType, svcNum, &chInfo ); sprintf( channelName, "%s\0", chInfo.chName ); return channelName; }
void DisplayChannelSelection( void ) { char str[256]; TYPE_TapChInfo chInfo; TAP_Channel_GetInfo( selectedSvc, selectedLogo, &chInfo ); TAP_SPrint( str, "%d -> %d: %d: %s", oldPageNumber, pageNumber, chInfo.logicalChNum, chInfo.chName ); TAP_Osd_FillBox( rgn, 53, 490, 614, 86, FILL_COLOUR ); // clear the bottom portion TAP_Osd_PutStringAf1622( rgn, 58, 518, 610, str, INFO_COLOUR, FILL_COLOUR ); }
// Function to render the guide item on the screen. Send it the required text void MultiList_RenderChannel( word rgn, word svcId, int row, int col ){ int x, y, w, h; dword fc = DISPLAY_EVENT; int svcNum, svcType; TYPE_TapChInfo chInfo; char text[128]; // Calculate the position to render the item // w = (720-((Panel_Left_X-DISPLAY_X_OFFSET)*2))/MultiList_Cols; // [ ][ ][ ] w = DISPLAY_ROW_WIDTH/MultiList_Cols; // [ ][ ][ ] x = Panel_Left_X + (w*col) + DISPLAY_GAP; // Offset plus the coloumn h = 22; y = (Panel_Left_Y + (( h + DISPLAY_GAP) * (0)))+(((( h + DISPLAY_GAP) * (MultiList_MaxEvents))+( h + DISPLAY_GAP))*row); // Draw background for item it previous or selected otherwise the background on text will do the job TAP_Osd_FillBox(rgn, x-1, y, w-2, h, DISPLAY_MAIN); svcNum = GetSvcNum(svcId); svcType = GetSvcType(svcId); sprintf( text, "%d, %d, %s\0", svcNum, svcType, Channel_Name(svcNum,svcType)); TAP_Channel_GetInfo( svcType, svcNum, &chInfo ); TAP_Osd_PutStringAf1419( rgn, x+5, y+1, x+(w-10), chInfo.chName, fc, COLOR_None ); }
int LogoManager_UpdateLIL(void) { TRACEENTER(); typedef struct { ulong64 ChannelID; char Name[MAXLOGONAME+1]; }tNewIDs; int nTvSvc, nRadioSvc; int i; TYPE_TapChInfo chInfo; char s[255], LogoName[MAX_SvcName + 1]; SYSTEM_TYPE SystemType; tFlashSatTable SatInfo; word SatPos; ulong64 ChannelID; tNewIDs *NewIDs; int NewIDCount; SystemType = GetSystemType(); HDD_TAP_PushDir(); HDD_ChangeDir(LOGOROOT); TAP_Channel_GetTotalNum(&nTvSvc, &nRadioSvc); NewIDs = TAP_MemAlloc((nTvSvc + nRadioSvc) * sizeof(tNewIDs)); NewIDCount = 0; INIOpenFile(LILNAME, NULL); for(i = 0; i < nTvSvc; i++) { TAP_Channel_GetInfo(SVC_TYPE_Tv, i, &chInfo); FlashSatTablesGetInfo(chInfo.satIdx, &SatInfo); switch(SystemType) { case ST_S: case ST_TMSS: { SatPos = SatInfo.SatPosition; break; } default: SatPos = 0; break; } ChannelID = LogoManager_CalculateChannelID(SatPos, chInfo.orgNetId, chInfo.tsId, chInfo.svcId); TAP_SPrint(s, "%16.16llx", ChannelID); if(!INIKeyExists(s)) { NewIDs[NewIDCount].ChannelID = ChannelID; strcpy(NewIDs[NewIDCount].Name, LogoManager_ChannelNameToLogoName(chInfo.chName, LogoName, sizeof(LogoName))); if(NewIDs[NewIDCount].Name[0]) NewIDCount++; } } for(i = 0; i < nRadioSvc; i++) { TAP_Channel_GetInfo(SVC_TYPE_Radio, i, &chInfo); FlashSatTablesGetInfo(chInfo.satIdx, &SatInfo); switch(SystemType) { case ST_S: case ST_TMSS: { SatPos = SatInfo.SatPosition; break; } default: SatPos = 0; break; } ChannelID = LogoManager_CalculateChannelID(SatPos, chInfo.orgNetId, chInfo.tsId, chInfo.svcId); TAP_SPrint(s, "%16.16llx", ChannelID); if(!INIKeyExists(s)) { NewIDs[NewIDCount].ChannelID = ChannelID; TAP_SPrint(NewIDs[NewIDCount].Name, "r_%s", LogoManager_ChannelNameToLogoName(chInfo.chName, LogoName, sizeof(LogoName))); if(NewIDs[NewIDCount].Name[0]) NewIDCount++; } } INICloseFile(); if(NewIDCount > 0) { TYPE_File *f; word year; byte month, day, weekDay; if(!TAP_Hdd_Exist(LILNAME)) TAP_Hdd_Create(LILNAME, ATTR_NORMAL); f = TAP_Hdd_Fopen(LILNAME); if(!f) { HDD_TAP_PopDir(); if(LogoManager_CB) LogoManager_CB(-1, 3); TRACEEXIT(); return -1; } TAP_Hdd_Fseek(f, 0, SEEK_END); TAP_ExtractMjd(Now(NULL) >> 16, &year, &month, &day, &weekDay); TAP_SPrint(s, "\n\n# Added %4.4d-%2.2d-%2.2d\n", year, month, day); TAP_Hdd_Fwrite(s, 1, strlen(s), f); for(i = 0; i < NewIDCount; i++) { TAP_SPrint(s, "%16.16llx=%s\n", NewIDs[i].ChannelID, NewIDs[i].Name); TAP_Hdd_Fwrite(s, 1, strlen(s), f); } TAP_Hdd_Fclose(f); if(LogoManager_CB) LogoManager_CB(5, NewIDCount); }