FireBirdLib - Topfield TMS PVR TAP Programming Library
FlashFavoritesFindService.c
Go to the documentation of this file.
1#include <string.h>
2#include "FBLib_flash.h"
3
4int FlashFavoritesFindService(int SvcType, int SvcNum)
5{
7
8 tFavorites Favs;
9 int i, j, NrFavs;
10
11 //SvcType out of range
12 if((SvcType < 0) || (SvcType > SVC_TYPE_Radio))
13 {
14 TRACEEXIT();
15 return FALSE;
16 }
17
18 //SvcNum out of range
19 if((SvcNum < 0) || (SvcNum >= FlashServiceGetTotal(SvcType)))
20 {
21 TRACEEXIT();
22 return FALSE;
23 }
24
25
26 NrFavs = FlashFavoritesGetTotal();
27 for(i = 0; i < NrFavs; i++)
28 {
29 if(FlashFavoritesGetInfo(i, &Favs))
30 {
31 for(j = 0; j < Favs.NrEntries; j++)
32 if((Favs.SvcType[j] == SvcType) && (Favs.SvcNum[j] == SvcNum))
33 {
34 TRACEEXIT();
35 return i;
36 }
37 }
38 }
39
40 TRACEEXIT();
41 return -1;
42}
int FlashFavoritesFindService(int SvcType, int SvcNum)
bool FlashFavoritesGetInfo(int FavNum, tFavorites *Favorites)
int FlashFavoritesGetTotal(void)
int FlashServiceGetTotal(int SvcType)
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243
byte NrEntries
Definition: libFireBird.h:1736
byte SvcType[100]
Definition: libFireBird.h:1735
word SvcNum[100]
Definition: libFireBird.h:1734