User Documentation

Table Of Contents
Data recorder
System manual
2696790000/02/04.2020
92
MemApiRemoveVar(scVarNameTemp);
MemApiExit();
LogApiTrace(traceid, "TestDataRecApp unloaded");
LogApiRemoveId(traceid);
}
/
****************************************************************************/
void ModuleStart() {
DataRecApiResult rc;
LogApiTrace(traceid, "Starting TestDataRecApp");
rc = DataRecApiStartRecording(sP1Id);
ReturnIfNot(rc == DataRecApiResultOk);
}
/
****************************************************************************/
void ModuleStop() {
DataRecApiResult rc;
LogApiTrace(traceid, "Stopping TestDataRecApp");
rc = DataRecApiStopRecording(sP1Id);
ReturnIfNot(rc == DataRecApiResultOk);
}
/
****************************************************************************/
void ModuleCallback(UserFuncParam *arg, uint32_t provArg) {
DataRecApiSampleValues(sP1Id);
sTemp += 1;
sPres += 0.1;
}
14.7.4 Profile with persistence
The following example is more strongly distinguished from the previous ex-
amples. It uses a profile with persistence and, as such, must cover a number
of cases: For one thing, the profile does not yet exist and must be newly cre-
ated, and for another thing, the profile is already created on the system side
due to the existing persistence, and thus must only be restarted.
The recovery of profiles takes place between the init- and start calls of the
application, because the paths of the configured variables are also persisted
and these are only valid after the initialization of all runtime systems. This re-
quires a change of the application configuration: The determination or the
initial creation of the profile thus takes place in the course of the start call.
This step is integrated into the extra function InitRecording. The remaining
steps are also highlighted in separate functions in order to better uncouple
the recording from the rest of the application code.
Likewise, in the course of the initialization, an application task is created,
which completely persists the profile every 10 seconds. The StartRecord-
ing function triggers the start of the task, while the StopRecording function
enables the task to be terminated.
static void InitRecording() {
DataRecApiInfo info;
DataRecApiResult rc;
char varPath[80];
/*
 * create new profile or get restored profile
 */
sP1Id = DataRecApiGetProfile(scProfileName, &info);