FireBirdLib - Topfield TMS PVR TAP Programming Library
cronRegisterEvent.c
Go to the documentation of this file.
1
#include <stdlib.h>
2
#include "
FBLib_time.h
"
3
4
extern
int
cronItemCount
;
5
extern
TYPE_CRONTAB
cronTable
[
MAX_CRON_EVENTS
];
6
extern
bool
cronInit
;
7
8
int
cronRegisterEvent
(
long
frequency, dword firstExecution,
void
*callback)
9
{
10
TRACEENTER
();
11
12
bool
ret;
13
int
i;
14
TYPE_CRONTAB
*pcronTable;
15
ret = -1;
16
17
if
(!
cronInit
)
cronUnregisterAllEvents
();
18
19
if
((
cronItemCount
<
MAX_CRON_EVENTS
) && (frequency) && (callback))
20
{
21
pcronTable =
cronTable
;
22
for
(i = 0; i <=
MAX_CRON_EVENTS
-1; i++)
23
{
24
if
(!
cronTable
[i].active)
25
{
26
pcronTable->
active
= TRUE;
27
pcronTable->
function
= callback;
28
pcronTable->
frequency
= frequency;
29
if
(!firstExecution) firstExecution = TAP_GetTick() + abs(frequency);
30
pcronTable->
nextExecution
= firstExecution;
31
cronItemCount
++;
32
ret = i;
33
break
;
34
}
35
pcronTable++;
36
}
37
}
38
39
TRACEEXIT
();
40
return
ret;
41
}
FBLib_time.h
MAX_CRON_EVENTS
#define MAX_CRON_EVENTS
Definition:
FBLib_time.h:25
cronRegisterEvent
int cronRegisterEvent(long frequency, dword firstExecution, void *callback)
Definition:
cronRegisterEvent.c:8
cronTable
TYPE_CRONTAB cronTable[MAX_CRON_EVENTS]
Definition:
cronEventHandler.c:4
cronInit
bool cronInit
Definition:
cronEventHandler.c:5
cronItemCount
int cronItemCount
Definition:
cronEventHandler.c:3
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
cronUnregisterAllEvents
void cronUnregisterAllEvents(void)
Definition:
cronUnregisterAllEvents.c:7
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
TYPE_CRONTAB
Definition:
FBLib_time.h:18
TYPE_CRONTAB::function
void * function
Definition:
FBLib_time.h:21
TYPE_CRONTAB::frequency
int frequency
Definition:
FBLib_time.h:22
TYPE_CRONTAB::active
bool active
Definition:
FBLib_time.h:19
TYPE_CRONTAB::nextExecution
dword nextExecution
Definition:
FBLib_time.h:20
time
cronRegisterEvent.c
Generated on Fri Apr 29 2022 13:34:01 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3