Reader

Functions

KvlcStatus kvlcCreateReader (KvlcHandle *handle, const char *filename, int format)
 
KvlcStatus kvlcDeleteReader (KvlcHandle handle)
 
KvlcStatus kvlcReadInfo (KvlcHandle handle, kvlcReaderInfo *info, unsigned int maxEvents)
 
KvlcStatus kvlcReadNextEvent (KvlcHandle handle, kvlcLogEventEx *e)
 
KvlcStatus kvlcReadFirstEventAtOrAfter (KvlcHandle handle, time_int64 timestamp, kvlcLogEventEx *e)
 

Detailed Description

Function Documentation

◆ kvlcCreateReader()

KvlcStatus kvlcCreateReader ( KvlcHandle handle,
const char *  filename,
int  format 
)

Create a new reader for reading events from a log file.

Parameters
[out]handleAn open handle to a reader.
[in]filenameInput filename, a pointer to a NULL terminated array of chars.
[in]formatInput format, use FILE_FORMAT_xxx.
Returns
kvlcOK (zero) if success
kvlcERR_xxx (negative) if failure
Note
No more than 128 reader handles can be open at the same time.
See also
kvlcDeleteReader()

◆ kvlcDeleteReader()

KvlcStatus kvlcDeleteReader ( KvlcHandle  handle)

Delete a reader and close the input file.

Parameters
[in]handleAn open handle to a reader.
Returns
kvlcOK (zero) if success
kvlcERR_xxx (negative) if failure
See also
kvlcCreateReader()

◆ kvlcReadFirstEventAtOrAfter()

KvlcStatus kvlcReadFirstEventAtOrAfter ( KvlcHandle  handle,
time_int64  timestamp,
kvlcLogEventEx e 
)

Rewind the input file and return the first event whose timestamp (in nanoseconds) is greater than or equal to timestamp.

On success the reader is positioned immediately after the returned event, so subsequent kvlcReadNextEvent calls continue from that point.

Parameters
[in]handleAn open handle to a reader.
[in]timestampRelative timestamp in nanoseconds.
[out]ePointer to a kvlcLogEventEx buffer to receive the event.
Returns
kvlcOK (zero) if an event was found
kvlcEOF if no event at or after timestamp exists in the file
kvlcERR_xxx (negative) if failure
See also
kvlcCreateReader(), kvlcReadNextEvent()

◆ kvlcReadInfo()

KvlcStatus kvlcReadInfo ( KvlcHandle  handle,
kvlcReaderInfo info,
unsigned int  maxEvents 
)

Read information about the open input file.

Up to maxEvents events are read from the file to populate kvlcReaderInfo::channelMask, kvlcReaderInfo::canChannelMask, kvlcReaderInfo::linChannelMask and kvlcReaderInfo::directionMask. The file position is reset to the beginning before the function returns.

Parameters
[in]handleAn open handle to a reader.
[out]infoPointer to a kvlcReaderInfo struct to fill.
[in]maxEventsMaximum number of events to scan; use KVLC_DEFAULT_SCAN_EVENT_COUNT for the recommended default.
Returns
kvlcOK (zero) if success
kvlcERR_INVALID_LOG_EVENT if the same channel is observed as both LIN and CAN/CAN FD
kvlcERR_xxx (negative) if failure
See also
kvlcCreateReader()

◆ kvlcReadNextEvent()

KvlcStatus kvlcReadNextEvent ( KvlcHandle  handle,
kvlcLogEventEx e 
)

Read the next event from the input file.

Parameters
[in]handleAn open handle to a reader.
[out]ePointer to a kvlcLogEventEx buffer to receive the event.
Returns
kvlcOK (zero) if success
kvlcEOF if the end of file has been reached
kvlcERR_xxx (negative) if failure
See also
kvlcCreateReader(), kvlcReadInfo()