canlib.kvmlib

Wrapper for the Kvaser kvmlib library

The kvmlib is used to interact with Kvaser Memorator devices that can record CAN messages (E.g. Kvaser Memorator Professional 5xHS). You can download configuration data (e.g. triggers, filters, scripts) allowing you to disconnect the device from your computer, connect the device to a CAN bus and let it record the traffic autonomously. When done, you can reconnect the device with your computer and use kvmlib to get the recorded data.

class canlib.kvmlib.Device[source]

Bases: canlib.cenum.CEnum

kvmDEVICE_xxx

Device type, used to connect to a Memorator device.

MHYDRA = 0
MHYDRA_EXT = 1
class canlib.kvmlib.Error[source]

Bases: canlib.cenum.CEnum

CONFIG_ERROR = -41
CRC_ERROR = -21
DEVICE_COMM_ERROR = -37
DISKFULL_DATA = -26
DISKFULL_DIR = -25
DISK_ERROR = -24
EOF = -12
FAIL = -1
FATAL_ERROR = -31
FILE_ERROR = -23
FILE_NOT_FOUND = -33
FILE_SYSTEM_CORRUPT = -28
FIRMWARE = -40
ILLEGAL_REQUEST = -32
LOGFILEOPEN = -8
LOGFILEREAD = -14
LOGFILEWRITE = -11
NOLOGMSG = -10
NOSTARTTIME = -9
NOT_FORMATTED = -34
NOT_IMPLEMENTED = -30
NO_DISK = -13
OCCUPIED = -38
PARAM = -3
QUEUE_FULL = -20
SECTOR_ERASED = -22
SEQ_ERROR = -27
TIMEOUT = -36
UNSUPPORTED_VERSION = -29
USER_CANCEL = -39
WRITE_PROT = -42
WRONG_DISK_TYPE = -35
class canlib.kvmlib.FileType[source]

Bases: canlib.cenum.CEnum

kvmFILE_xxx

KME file type, a binary file format representing log data.

KME24 = 0
KME25 = 1
KME40 = 2
KME50 = 3
exception canlib.kvmlib.KvmDiskError[source]

Bases: canlib.kvmlib.exceptions.KvmError

status = -24
exception canlib.kvmlib.KvmDiskNotFormated[source]

Bases: canlib.kvmlib.exceptions.KvmDiskError

status = -34
exception canlib.kvmlib.KvmError[source]

Bases: canlib.exceptions.DllException

class canlib.kvmlib.KvmLib[source]

Bases: object

Wrapper class for the Kvaser kvmlib.

This class wraps the Kvaser kvmlib dll. For more info, see the kvmlib help files which are availible in the CANlib SDK. https://www.kvaser.com/developer/canlib-sdk/

close()[source]
closeDevice[source]

Deprecated function

Deprecated since version 1.5: Use close instead.

deviceFormatDisk(reserveSpace=10, dbaseSpace=2, fat32=True)[source]
deviceGetDiskSize()[source]
deviceGetDiskStatus()[source]
deviceGetRTC()[source]
deviceGetSerialNumber()[source]
deviceMountKmf()[source]

Mount device log files (kmf)

Mount the log area on the SD card on a connected Kvaser Memorator and return the logger data format (LDF) version.

Returns:ldfVersion (str) – The logger data format (e.g. ‘5.0’)
deviceOpen(memoNr=0, devicetype=<Device.MHYDRA: 0>)[source]
deviceSetRTC(timestamp)[source]
dll = <canlib.kvmlib.dll.KvmlibDll object>
formatDisk[source]

Deprecated function

Deprecated since version 1.5: Use deviceFormatDisk instead.

getDiskSize[source]

Deprecated function

Deprecated since version 1.5: Use deviceGetDiskSize instead.

getFileSystemUsage[source]

Deprecated function

Deprecated since version 1.5: Use kmfGetUsage instead.

getLogFileCount[source]

Deprecated function

Deprecated since version 1.5: Use logFileGetCount instead.

getRTC[source]

Deprecated function

Deprecated since version 1.5: Use deviceGetRTC instead.

getSerialNumber[source]

Deprecated function

Deprecated since version 1.5: Use deviceGetSerialNumber instead.

getVersion()[source]

Get the kvmlib version number.

Returns the kvmlib version number from the kvmlib DLL currently in use.

Deprecated since version 1.5: Use dllversion instead.

Parameters:None
Returns:version (kvmVersion) – Major and minor version number
isDiskPresent[source]

Deprecated function

Deprecated since version 1.5: Use deviceGetDiskStatus instead.

kmeCloseFile()[source]
kmeCountEvents()[source]
kmeCreateFile(filename, filetype=<FileType.KME40: 2>)[source]
kmeOpenFile(filename, filetype=<FileType.KME40: 2>)[source]
kmeReadEvent()[source]
kmeReadEventLogFormat()[source]
kmeScanFileType(filename)[source]

Scan KME file and report version

Open and read the file filename and try to decode what version of KME it contains. Returns type as kvmFILE_xxx.

kmeWriteEvent(logevent)[source]
kmfGetUsage()[source]
kmfOpen(filename, deviceType=<Device.MHYDRA: 0>)[source]
kmfOpenEx(filename, deviceType=<Device.MHYDRA: 0>)[source]
kmfReadConfig()[source]
kmfValidate(fix=0)[source]
kmfWriteConfig(lifData)[source]
logCloseFile[source]

Deprecated function

Deprecated since version 1.5: Use logFileDismount instead.

logFileDeleteAll()[source]
logFileDismount()[source]
logFileGetCount()[source]
logFileGetStartTime()[source]
logFileMount(fileIndx)[source]
logFileReadEvent()[source]
logFileReadEventLogFormat()[source]
logFileReadEvents()[source]
logOpenFile[source]

Deprecated function

Deprecated since version 1.5: Use logFileMount instead.

logReadEventEx[source]

Deprecated function

Deprecated since version 1.5: Use logFileReadEvent instead.

logReadEvents[source]

Deprecated function

Deprecated since version 1.5: Use logFileReadEvents instead.

openDeviceEx[source]

Deprecated function

Deprecated since version 1.5: Use deviceOpen instead.

openLog[source]

Deprecated function

Deprecated since version 1.5: Use deviceMountKmf instead.

readConfig[source]

Deprecated function

Deprecated since version 1.5: Use kmfReadConfig instead.

readEvents[source]

Deprecated function

Deprecated since version 1.5: Use logFileReadEvents instead.

setRTC[source]

Deprecated function

Deprecated since version 1.5: Use deviceSetRTC instead.

validateDisk[source]

Deprecated function

Deprecated since version 1.5: Use kmfValidate instead.

writeConfig(config)[source]
writeConfigLif[source]

writeConfig

Deprecated since version 1.5: Use kmfWriteConfig instead.

exception canlib.kvmlib.KvmNoDisk[source]

Bases: canlib.kvmlib.exceptions.KvmDiskError

status = -13
exception canlib.kvmlib.KvmNoLogMsg[source]

Bases: canlib.kvmlib.exceptions.KvmError

status = -10
class canlib.kvmlib.LoggerDataFormat[source]

Bases: canlib.cenum.CEnum

kvmLDF_MAJOR_xxx

Logged data format (LDF) version.

MAJOR_CAN = 3
MAJOR_CAN64 = 5
class canlib.kvmlib.MessageEvent(id=None, channel=None, dlc=None, flags=None, data=None, timestamp=None)[source]

Bases: canlib.kvmlib.events.LogEvent

asframe()[source]
class canlib.kvmlib.RTCEvent(calendartime=None, timestamp=None)[source]

Bases: canlib.kvmlib.events.LogEvent

class canlib.kvmlib.TriggerEvent(type=None, timestamp=None, pretrigger=None, posttrigger=None, trigno=None)[source]

Bases: canlib.kvmlib.events.LogEvent

class canlib.kvmlib.VersionEvent(lioMajor, lioMinor, fwMajor, fwMinor, fwBuild, serialNumber, eanHi, eanLo)[source]

Bases: canlib.kvmlib.events.LogEvent

canlib.kvmlib.dllversion()[source]

Get the kvmlib version number as a VersionNumber

canlib.kvmlib.kvmDiskError

alias of canlib.kvmlib.exceptions.KvmDiskError

canlib.kvmlib.kvmDiskNotFormated

alias of canlib.kvmlib.exceptions.KvmDiskNotFormated

canlib.kvmlib.kvmError

alias of canlib.kvmlib.exceptions.KvmError

canlib.kvmlib.kvmNoDisk

alias of canlib.kvmlib.exceptions.KvmNoDisk

canlib.kvmlib.kvmNoLogMsg

alias of canlib.kvmlib.exceptions.KvmNoLogMsg

canlib.kvmlib.kvmlib

alias of canlib.kvmlib.wrapper.KvmLib

class canlib.kvmlib.logMsg(*args, **kwargs)

Bases: canlib.kvmlib.events.MessageEvent, object

Deprecated name for MessageEvent

logMsg has been renamed MessageEvent, using the old name (logMsg) is deprecated.

class canlib.kvmlib.memoLogEventEx[source]

Bases: _ctypes.Structure

MEMOLOG_TYPE_CLOCK = 1
MEMOLOG_TYPE_INVALID = 0
MEMOLOG_TYPE_MSG = 2
MEMOLOG_TYPE_TRIGGER = 3
MEMOLOG_TYPE_VERSION = 4
createMemoEvent()[source]
event

Structure/Union member

class canlib.kvmlib.memoLogMrtEx[source]

Bases: _ctypes.Union

msg

Structure/Union member

raw

Structure/Union member

rtc

Structure/Union member

trig

Structure/Union member

ver

Structure/Union member

class canlib.kvmlib.memoLogMsgEx[source]

Bases: _ctypes.Structure

channel

Structure/Union member

data

Structure/Union member

dlc

Structure/Union member

evType

Structure/Union member

flags

Structure/Union member

id

Structure/Union member

timeStamp

Structure/Union member

class canlib.kvmlib.memoLogRaw[source]

Bases: _ctypes.Structure

data

Structure/Union member

evType

Structure/Union member

class canlib.kvmlib.memoLogRtcClockEx[source]

Bases: _ctypes.Structure

calendarTime

Structure/Union member

evType

Structure/Union member

padding

Structure/Union member

timeStamp

Structure/Union member

class canlib.kvmlib.memoLogTriggerEx[source]

Bases: _ctypes.Structure

evType

Structure/Union member

padding

Structure/Union member

postTrigger

Structure/Union member

preTrigger

Structure/Union member

timeStampHi

Structure/Union member

timeStampLo

Structure/Union member

trigNo

Structure/Union member

type

Structure/Union member

class canlib.kvmlib.memoLogVersionEx[source]

Bases: _ctypes.Structure

eanHi

Structure/Union member

eanLo

Structure/Union member

evType

Structure/Union member

fwBuild

Structure/Union member

fwMajor

Structure/Union member

fwMinor

Structure/Union member

lioMajor

Structure/Union member

lioMinor

Structure/Union member

serialNumber

Structure/Union member

class canlib.kvmlib.memoMsg(*args, **kwargs)

Bases: canlib.kvmlib.events.LogEvent, object

Deprecated name for LogEvent

memoMsg has been renamed LogEvent, using the old name (memoMsg) is deprecated.

class canlib.kvmlib.rtcMsg(*args, **kwargs)

Bases: canlib.kvmlib.events.RTCEvent, object

Deprecated name for RTCEvent

rtcMsg has been renamed RTCEvent, using the old name (rtcMsg) is deprecated.

class canlib.kvmlib.trigMsg(*args, **kwargs)

Bases: canlib.kvmlib.events.TriggerEvent, object

Deprecated name for TriggerEvent

trigMsg has been renamed TriggerEvent, using the old name (trigMsg) is deprecated.

class canlib.kvmlib.verMsg(*args, **kwargs)

Bases: canlib.kvmlib.events.VersionEvent, object

Deprecated name for VersionEvent

verMsg has been renamed VersionEvent, using the old name (verMsg) is deprecated.