void ReDrawAllLogosInPage( int pagenum )
{
	int countTvSvc = 0, countRadioSvc = 0;
	int svcCount = 0, i = 0, j = 0;
	char buffer2 [256];

//TAP_SPrint(buffer2, "ReDraw: %d %d",pageNumber, selectedLogo);
//DisplayMessageWindow(buffer2, "Press OK", "", &dummy);

	TAP_Osd_FillBox( rgn, 53, 70, 614, 420, FILL_COLOUR );				// Clear the main portion of the screen
	
	TAP_Channel_GetTotalNum( &countTvSvc, &countRadioSvc );
	if ( selectedSvc == 0 ) svcCount = countTvSvc; else svcCount = countRadioSvc;
	
	for ( i=(pagenum*MAX_CHANNELS_PER_PAGE); i<svcCount ; i++)										// for each channel (service)
	{
		if ( j >= MAX_CHANNELS_PER_PAGE )  break;
		j++;
	    	DisplayChannelLogo( i, selectedSvc );							// display the logo
//break;
	}
	
	DisplayChannelLogo( selectedLogo, selectedSvc );					// redraw the highlight (makes things a little tidier)
	DisplayChannelSelection();
}
Beispiel #2
0
// 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;
}
Beispiel #3
0
//------------
//
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, &currentChInfo );			// 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, &currentChInfo );
		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;
}
void ReDrawAllLogos( void )
{
	int countTvSvc = 0, countRadioSvc = 0;
	int svcCount = 0, i = 0;

	TAP_Osd_FillBox( rgn, 53, 70, 614, 420, FILL_COLOUR );				// Clear the main portion of the screen
	
	TAP_Channel_GetTotalNum( &countTvSvc, &countRadioSvc );
	if ( selectedSvc == 0 ) svcCount = countTvSvc; else svcCount = countRadioSvc;
	
	for ( i=0; i<svcCount ; i++)										// for each channel (service)
	{
		if ( i >= MAX_CHANNELS_PER_PAGE) break;
	    DisplayChannelLogo( i, selectedSvc );							// display the logo
	}
	
	DisplayChannelLogo( selectedLogo, selectedSvc );					// redraw the highlight (makes things a little tidier)
	DisplayChannelSelection();
}
void ChannelListKeyHandler( dword key )
{
	int svcCount = 0, i = 0;
	int countTvSvc = 0, countRadioSvc = 0;
	int oldSelection = 0;
	char buffer2 [256];

	
	TAP_Channel_GetTotalNum( &countTvSvc, &countRadioSvc );
	if ( selectedSvc == 0 ) svcCount = countTvSvc; else svcCount = countRadioSvc;

	oldPageNumber = pageNumber; 
	
	switch ( key )
	{
		case RKEY_VolUp :	oldSelection = selectedLogo;
							selectedLogo++;										// move the cursor across one logo
							
							if ( selectedLogo >= svcCount) selectedLogo = 0;

					pageNumber = ( selectedLogo / MAX_CHANNELS_PER_PAGE ); 

					if ( pageNumber == oldPageNumber)
					{ 
//TAP_SPrint(buffer2, "1: %d %d %d",pageNumber, oldPageNumber,selectedLogo);
//DisplayMessageWindow(buffer2, "Press OK", "", &dummy);
						DisplayChannelLogo( oldSelection, selectedSvc);		// redraw the old logo without the highlight
						DisplayChannelLogo( selectedLogo, selectedSvc);		// and redraw the new selection with the highlight
						DisplayChannelSelection();
					}
					else
					{
						ReDrawAllLogosInPage(pageNumber);	
						//DisplayChannelLogo( selectedLogo, selectedSvc);		// and redraw the new selection with the highlight
						//DisplayChannelSelection();
					}
							
					break;

		case RKEY_VolDown :oldSelection = selectedLogo;	

							if ( selectedLogo > 0 ) selectedLogo--;				// move the cursor left one logo
							else selectedLogo = svcCount-1;

					pageNumber = ( selectedLogo / MAX_CHANNELS_PER_PAGE ); 
					if ( pageNumber == oldPageNumber)
					{ 
//TAP_SPrint(buffer2, "2: %d %d %d",pageNumber, oldPageNumber,selectedLogo);
//DisplayMessageWindow(buffer2, "Press OK", "", &dummy);
						DisplayChannelLogo(oldSelection, selectedSvc);		// redraw the old logo without the highlight
						DisplayChannelLogo(selectedLogo, selectedSvc);		// and redraw the new selection with the highlight
						DisplayChannelSelection();
					}
					else
					{
						ReDrawAllLogosInPage(pageNumber);	
						//DisplayChannelLogo(selectedLogo, selectedSvc);		// and redraw the new selection with the highlight
						//DisplayChannelSelection();
					}

							break;
							
							
		case RKEY_ChDown :	oldSelection = selectedLogo;
							selectedLogo += NUM_LOGO_ON_X_AXIS;					// move the cursor down one line
							
					if ( selectedLogo >= svcCount)
					{
//TAP_SPrint(buffer2, "3a: %d %d %d",pageNumber, oldPageNumber,selectedLogo);
//DisplayMessageWindow(buffer2, "Press OK", "", &dummy);
						 selectedLogo = (selectedLogo % NUM_LOGO_ON_X_AXIS);	// keep in same column when scrolling off bottom
//TAP_SPrint(buffer2, "3b: %d %d %d",pageNumber, oldPageNumber,selectedLogo);
//DisplayMessageWindow(buffer2, "Press OK", "", &dummy);
					}
							
					pageNumber = ( selectedLogo / MAX_CHANNELS_PER_PAGE ); 
//TAP_SPrint(buffer2, "3c: %d %d %d",pageNumber, oldPageNumber,selectedLogo);
//DisplayMessageWindow(buffer2, "Press OK", "", &dummy);
					if ( pageNumber == oldPageNumber)
					{ 
//TAP_SPrint(buffer2, "3d (one): %d %d %d",pageNumber, oldPageNumber,selectedLogo);
//DisplayMessageWindow(buffer2, "Press OK", "", &dummy);
						DisplayChannelLogo(oldSelection, selectedSvc);		// redraw the old logo without the highlight
						DisplayChannelLogo(selectedLogo, selectedSvc);		// and redraw the new selection with the highlight
						DisplayChannelSelection();
					}
					else
					{
//TAP_SPrint(buffer2, "3e (entering redraw): %d %d %d",pageNumber, oldPageNumber,selectedLogo);
//DisplayMessageWindow(buffer2, "Press OK", "", &dummy);
						ReDrawAllLogosInPage(pageNumber);	
						//DisplayChannelLogo(selectedLogo, selectedSvc);		// and redraw the new selection with the highlight
						//DisplayChannelSelection();
					}
							
							break;

							
		case RKEY_ChUp :	oldSelection = selectedLogo;

							if ( selectedLogo >= NUM_LOGO_ON_X_AXIS ) selectedLogo -= NUM_LOGO_ON_X_AXIS;	// move the cursor up one line
							else
							{													// keep the same column when scroll off top
								while (selectedLogo <= svcCount-1) { selectedLogo += NUM_LOGO_ON_X_AXIS; }
								selectedLogo -= NUM_LOGO_ON_X_AXIS;
							}


					pageNumber = ( selectedLogo / MAX_CHANNELS_PER_PAGE ); 
					if ( pageNumber == oldPageNumber)
					{ 
//TAP_SPrint(buffer2, "4: %d %d %d",pageNumber, oldPageNumber,selectedLogo);
//DisplayMessageWindow(buffer2, "Press OK", "", &dummy);
						DisplayChannelLogo( oldSelection, selectedSvc);		// redraw the old logo without the highlight
						DisplayChannelLogo(selectedLogo, selectedSvc);		// and redraw the new selection with the highlight
						DisplayChannelSelection();
					}
					else
					{
						ReDrawAllLogosInPage(pageNumber);	
						//DisplayChannelLogo(selectedLogo, selectedSvc);		// and redraw the new selection with the highlight
						//DisplayChannelSelection();
					}
							
							break;

							
		case RKEY_Forward :
		case RKEY_Rewind :                                          			// swap between TV and Radio
				
		case RKEY_TvRadio :	if ( selectedSvc == 0 )
							{
								selectedSvc= 1;
								if ( selectedLogo >= countRadioSvc ) selectedLogo = 0;
							}
							else
							{
							    selectedSvc = 0;
								if ( selectedLogo >= countTvSvc ) selectedLogo = 0;
							}

							ReDrawAllLogosInPage(pageNumber);
							break;
				
		case RKEY_Record :							
		case RKEY_Ok :
							CloseChannelListWindow( TRUE );							// go back to the timer edit screen
							break;

							
		case RKEY_Exit :	CloseChannelListWindow( TRUE );							// go back to the timer edit screen
							break;


		default :
			break;
	}
}
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);

  }