User Documentation

Table Of Contents
Data recorder
System manual
2696790000/02/04.2020
95
Information
Upon the creation of free-running tasks by means of CreateTask, the ap-
plication takes over co-responsibility for the stability of the system.
After the recurrence of the exit function (end of the application), make sure
that all created tasks have been terminated or these no longer execute
calls of the offered APIs (among others, DataRecApi)!
14.7.5 Evaluation of recordings
The following code supplements the preceding examples by the evaluation
of recordings that have been carried out. The parameters of the PrintSam-
ples example function specify the buffer area to be read in the vertical (pos,
cnt) and horizontal direction (maxVarCnt).
static void PrintSamples(int maxVarCnt, DataRecApiPos pos, int cnt) {
char *pBuf;
DataRecApiSample *pSample;
DataRecApiVarSample *p;
int actVarCnt, i, k, rc;
pBuf = malloc(DataRecApiUtilGetSampleMemSize(maxVarCnt, cnt));
ReturnIfNot(pBuf != 0);
pSample = (DataRecApiSample *)pBuf;
rc = DataRecApiReadSamples(sP1Id, maxVarCnt, &pos, pSample, &cnt);
ReturnIfNot(rc == DataRecApiResultOk);
for (i = 0; i < cnt; ++i) {
actVarCnt = pSample->header.varSampleCnt;
printf("[%d] recNo=%d, varSampleCnt=%d, timeStampUs=[%s]:\n",
i,
pSample->header.sampleRecNo,
actVarCnt,
TimeStamp2DateStr(pSample->timeStampUs));
for (k = 0, p = pSample->varSamples; k < actVarCnt; ++k, ++p) {
switch (p->type) {
case DataRecApiVarType_SINT32:
 printf(" name=%s, value=%d (size=%d)\n", VarIdToName(p->var), p-
>value.valSINT32, p->size);
 break;
case DataRecApiVarType_REAL:
 printf(" name=%s, value=%f (size=%d)\n", VarIdToName(p->var), p-
>value.valREAL, p->size);
 break;
default:
 printf(" name=%s, value=%" PRIx64 " (type=%d, size=%d)\n",
VarIdToName(p->var), p->value.valNONE, p->type, p->size);
 break;
}
}
pSample = (DataRecApiSample *)&pSample->varSamples[maxVarCnt];
}
free(pBuf);
}
Example call
PrintSamples(5, DataRecApiPosNewest, 1000);