User Documentation

Table Of Contents
Data recorder
System manual
2696790000/02/04.2020
90
ReturnIfNot(rc == DataRecApiResultOk);
rc = DataRecApiSetSampleHook(sP1Id, UpdateMinMaxTemp, 0);
ReturnIfNot(rc == DataRecApiResultOk);
}
Callback function:
static int32_t sMinTemp = INT32_MAX, sMaxTemp = INT32_MIN;
/
*****************************************************************************
*/
static void UpdateMinMaxTemp(
uint64_t timeStampUs, /**< [in] time stamp (μs since the epoch) */
DataRecApiPos pos, /**< [in] sample position */
DataRecApiVarSample *pSamples, /**< [in] variable samples */
int32_t sampleCnt, /**< [in] length of \em pSamples */
void *arg /**< [in] user argument */
) {
int i;
for (i = 0; i < sampleCnt; ++i) {
if (pSamples[i].var == sTempId) {
int32_t curTemp = pSamples[i].value.valSINT32;
if (curTemp < sMinTemp) {
sMinTemp = curTemp;
}
if (curTemp > sMaxTemp) {
sMaxTemp = curTemp;
}
}
return;
}
}
14.7.3 Profile with triggered recording
The following example uses manual recording, whereby the span of record-
ing time is limited by a start trigger and a stop trigger. Both of the two trigger
conditions refer to the active Boolean variable created by the application.
The start of the recording should be actuated by a transition from FALSE to
TRUE, while the stop should be actuated by a transition from TRUE to
FALSE. These conditions can be specified using the undershoot and over-
shoot operators. To do so, the active variable must initially have the value
FALSE.
To be able to specify the path of the variables in the variable tree, they must
be registered, like the recorded variables, by means of MemApi. However,
unlike the monitored variables of a change-based recording, it does not need
to be registered in the profile.
If a person sets the active variable to TRUE, and then a few seconds later
back to FALSE again (in the example, not a component part of the applica-
tion code), within the time span, the variables temperature and pressure
are recorded. After the recording has been stopped, the number of the sam-
ples results from the difference of the trigger positions + 1, since the stop po-
sition indicates the position of the last sample.
/
*****************************************************************************
* constants
*/
enum { cFALSE = 0, cTRUE = 1 };