FireBirdLib - Topfield TMS PVR TAP Programming Library
Appl_GetSameTimeEvent.c
Go to the documentation of this file.
1#include "EPG/FBLib_EPG.h"
2
3void *Appl_GetSameTimeEvent(byte SatIndex, word NetID, word TSID, word ServiceID)
4{
6
7 dword CurrentGMT;
8 dword *TreeByHashStart, *TreeByHashCurrent;
9 TYPE_EvtInfo *EventInfoCurrent;
10
11
12 TreeByHashStart = Appl_GetEvtListHeadInHash(NetID, TSID, ServiceID);
13 CurrentGMT = LocalTime2UTC(Now(NULL), NULL);
14 TreeByHashCurrent = (dword*)*TreeByHashStart;
15 if(TreeByHashCurrent != TreeByHashStart)
16 {
17 do
18 {
19 EventInfoCurrent = (TYPE_EvtInfo*)(TreeByHashCurrent - 8); //8 dwords == 0x20 bytes
20
21 if((EventInfoCurrent->ServiceID == ServiceID) &&
22 (EventInfoCurrent->TSID == TSID) &&
23 (EventInfoCurrent->NetworkID == NetID) &&
24 (EventInfoCurrent->SatIndex == SatIndex) &&
25 ((EventInfoCurrent->DataStatus & 3) != 0) &&
26 (EventInfoCurrent->StartTime <= CurrentGMT) &&
27 (EventInfoCurrent->EndTime > CurrentGMT))
28 {
29 //Success
30 TRACEEXIT();
31 return EventInfoCurrent;
32 }
33 TreeByHashCurrent = (dword*)*TreeByHashCurrent;
34 }while(TreeByHashCurrent != TreeByHashStart);
35 }
36
37 TRACEEXIT();
38 return NULL;
39}
dword * Appl_GetEvtListHeadInHash(word NetID, word TSID, word ServiceID)
void * Appl_GetSameTimeEvent(byte SatIndex, word NetID, word TSID, word ServiceID)
dword LocalTime2UTC(dword LocalTime, short *Offset)
Definition: LocalTime2UTC.c:3
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243
dword Now(byte *Sec)
Definition: Now.c:3
word SatIndex
Definition: FBLib_EPG.h:57
word ServiceID
Definition: FBLib_EPG.h:56
word NetworkID
Definition: FBLib_EPG.h:54
dword DataStatus
Definition: FBLib_EPG.h:42
dword EndTime
Definition: FBLib_EPG.h:51
dword StartTime
Definition: FBLib_EPG.h:50