User Documentation

Datenrekorder
Systemhandbuch
2696780000/02/04.2020
96
ReturnIfNot(rc == DataRecApiResultOk);
}
/
****************************************************************************/
static void ExitRecording() {
if (sStarted) {
while (!sTerminated) {
LogApiTrace(traceid, "waiting for LowPriorTask to terminate...");
sleep(1/*secs*/);
}
}
}
/
****************************************************************************/
void ModuleInit() {
/*
 * create variables to be recorded
*/
MemApiInit();
MemApiAddVar(scVarNameTemp, MemApiSInt32, &sTemp, sizeof sTemp);
MemApiAddVar(scVarNamePres, MemApiReal, &sPres, sizeof sPres);
}
/
****************************************************************************/
void ModuleExit() {
ExitRecording();
MemApiRemoveVar(scVarNamePres);
MemApiRemoveVar(scVarNameTemp);
MemApiExit();
}
/
****************************************************************************/
void ModuleStart() {
/*
 * now all variables are available such that profiles can be restored and
 * variables can be added to profiles
 */
InitRecording();
sTemp = 0;
sPres = 0.0;
StartRecording();
}
/
****************************************************************************/
void ModuleStop() {
StopRecording();
}
Implementierung der Persistierung im Abstand von 10 Sekunden (mit zu-
sätzlicher Terminierungsprüfung pro Sekunde):
/* libk2ctrl exports for advanced applications */
extern int CreateTask(const char *name, void (*fctAddr)(void *), void *param,
int prior, int stackSize);
extern int ResumeTask(int hdl);
/
*****************************************************************************
* static variables
*/
static int sTaskHdl;
static int sRun, sStarted, sTerminated;
/
****************************************************************************/
void LowPriorTask(void *arg) {