User Documentation

Table Of Contents
Data recorder
System manual
2696790000/02/04.2020
94
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();
}
Implementation of the persistence in 10 second intervals (with additional ter-
mination assessment per second):
/* 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) {
enum { cSaveStatePeriodSecs = 10 };
int cnt = cSaveStatePeriodSecs;
DataRecApiResult rc;
while (sRun) {
sleep(1/*secs*/);
if (--cnt == 0) {
rc = DataRecApiSaveState(sP1Id);
cnt = cSaveStatePeriodSecs;
}
}
sTerminated = 1;
}