FireBirdLib - Topfield TMS PVR TAP Programming Library
FlashTransponderTablesGetInfo.c
Go to the documentation of this file.
1#include <string.h>
2#include "FBLib_flash.h"
3
4bool FlashTransponderTablesGetInfo(int SatNum, int TransponderNum, tFlashTransponderTable *TransponderTable)
5{
7
8 bool ret;
9
10 //TransponderTable is NULL
11 if(!TransponderTable)
12 {
13 TRACEEXIT();
14 return FALSE;
15 }
16
17 //SatNum out of range
18 if((SatNum < 0) || (SatNum >= FlashSatTablesGetTotal()))
19 {
20 TRACEEXIT();
21 return FALSE;
22 }
23
24 //TransponderNum out of range
25 if((TransponderNum < 0) || (TransponderNum >= FlashTransponderTablesGetTotal(SatNum)))
26 {
27 TRACEEXIT();
28 return FALSE;
29 }
30
31 ret = FALSE;
32 switch(GetSystemType())
33 {
34 //Unknown and old 5k/6k systems are not supported
35 case ST_UNKNOWN:
36 case ST_S:
37 case ST_ST:
38 case ST_T:
39 case ST_C:
40 case ST_CT:
41 case ST_T5700:
42 case ST_T5800:
43 case ST_TF7k7HDPVR: break;
44
45 case ST_TMSS:
46 {
47 TYPE_TpInfo_TMSS *p;
48 int d, i, TPIdx;
49
50 p = (TYPE_TpInfo_TMSS*)(FIS_vFlashBlockTransponderInfo());
51 if(!p)
52 {
53 TRACEEXIT();
54 return FALSE;
55 }
56
58 TPIdx = 0;
59 for(i = 0; i < d; i++)
60 {
61 if(p->SatIdx == SatNum)
62 {
63 if(TPIdx == TransponderNum) break;
64
65 TPIdx++;
66 }
67 p++;
68 }
69 if((i >= d) || (p->SatIdx != SatNum) || (TPIdx != TransponderNum))
70 {
71 TRACEEXIT();
72 return FALSE;
73 }
74
75 ret = FlashTransponderTablesDecode(p, TransponderTable);
76 break;
77 }
78
79 case ST_TMST:
80 {
81 TYPE_TpInfo_TMST *p;
82
83 p = (TYPE_TpInfo_TMST*)FIS_vFlashBlockTransponderInfo();
84 if(!p)
85 {
86 TRACEEXIT();
87 return FALSE;
88 }
89
90 p = p + TransponderNum;
91
92 ret = FlashTransponderTablesDecode(p, TransponderTable);
93 break;
94 }
95
96 case ST_TMSC:
97 {
98 TYPE_TpInfo_TMSC *p;
99
100 p = (TYPE_TpInfo_TMSC*)FIS_vFlashBlockTransponderInfo();
101 if(!p)
102 {
103 TRACEEXIT();
104 return FALSE;
105 }
106 p = p + TransponderNum;
107
108 ret = FlashTransponderTablesDecode(p, TransponderTable);
109 break;
110 }
111
112 case ST_NRTYPES: break;
113 }
114
115 TRACEEXIT();
116 return ret;
117}
dword FIS_vFlashBlockTransponderInfo(void)
int FlashSatTablesGetTotal(void)
bool FlashTransponderTablesGetInfo(int SatNum, int TransponderNum, tFlashTransponderTable *TransponderTable)
int FlashTransponderTablesGetTotal(int SatNum)
bool FlashTransponderTablesDecode(void *Data, tFlashTransponderTable *TransponderTable)
SYSTEM_TYPE GetSystemType(void)
Definition: GetSystemType.c:3
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243
@ ST_CT
Definition: libFireBird.h:77
@ ST_T
Definition: libFireBird.h:69
@ ST_TMSC
Definition: libFireBird.h:74
@ ST_UNKNOWN
Definition: libFireBird.h:67
@ ST_T5700
Definition: libFireBird.h:71
@ ST_TMST
Definition: libFireBird.h:73
@ ST_T5800
Definition: libFireBird.h:75
@ ST_TMSS
Definition: libFireBird.h:72
@ ST_ST
Definition: libFireBird.h:76
@ ST_NRTYPES
Definition: libFireBird.h:79
@ ST_TF7k7HDPVR
Definition: libFireBird.h:78
@ ST_S
Definition: libFireBird.h:68
@ ST_C
Definition: libFireBird.h:70