canlib.kvamemolibxml

Wrapper for the Kvaser kvaMemoLibXml library

The kvaMemoLibXML is a library for converting XML settings to a binary param.lif for Kvaser Memorator 2nd Generation

The binary settings used by Kvaser Memorator 2nd Generation are extensive and an API that covers all possibilities would be very complex. A better approach is to use XML to describe the settings and parse them into a binary settings file with an external library.

The XML conversion results in a binary settings file, param.lif, that can be downloaded to a Kvaser Memorator 2nd Generation with the KvmLib API call kvmKmfWriteConfig().

class canlib.kvamemolibxml.Error[source]

Bases: canlib.cenum.CEnum

ATTR_NOT_FOUND = -3
ATTR_VALUE = -4
DTD_VALIDATION = -11
ELEM_NOT_FOUND = -5
FAIL = -1
INTERNAL = -20
POSTFIXEXPR = -9
SCRIPT_ERROR = -12
VALUE_CONSECUTIVE = -8
VALUE_RANGE = -6
VALUE_UNIQUE = -7
XML_PARSER = -10
exception canlib.kvamemolibxml.KvaError[source]

Bases: canlib.exceptions.DllException

class canlib.kvamemolibxml.KvaMemoLibXml[source]

Bases: object

Deprecated wrapper class for the Kvaser kvaMemoLibXml

Deprecated since version 1.5.

All functionality of this class has been moved to the kvamemolibxml module itself:

# deprecated
from canlib import kvamemolibxml
cl = kvamemolibxml.KvaMemoLibXml()  # or kvamemolibxml.kvaMemoLibXml()
cl.functionName()

# use this instead
from canlib import kvamemolibxml
kvamemolibxml.functionName()

Differences:

xmlGetLastError Does not take any argument, and returns a two-tuple.

dll = <canlib.kvamemolibxml.dll.KvaMemoLibXmlDll object>
installDir = 'F:\\Data\\180212~2\\pycanlib\\DEFAUL~2\\\\dll32'
kvaMemoLibXmlDll = <WinDLL 'kvaMemoLibXML.dll', handle 68100000 at 4d5f430>
static xmlGetLastError()[source]

Get the last error message (if any).

Get the last error message (if any) from conversion in human redable format.

Parameters:kvaERR (int) – kvaMemoLibXml error code.
Returns:msg (string) – Error message associated with kvaERR.
class canlib.kvamemolibxml.ValidationError[source]

Bases: canlib.cenum.CEnum

ABORT = -2
DISK_FULL_STARTS_LOG = -7
ELEMENT_COUNT = -13
EXPRESSION = -16
FAIL = -1
MULTIPLE_EXT_TRIGGER = -5
MULTIPLE_START_TRIGGER = -6
NUM_OUT_OF_RANGE = -8
PARSER = -14
SCRIPT = -15
SCRIPT_CONFLICT = -12
SCRIPT_NOT_FOUND = -9
SCRIPT_TOO_LARGE = -10
SCRIPT_TOO_MANY = -11
SILENT_TRANSMIT = -3
UNDEFINED_TRIGGER = -4
class canlib.kvamemolibxml.ValidationWarning[source]

Bases: canlib.cenum.CEnum

ABORT = -100
DISK_FULL_AND_FIFO = -102
IGNORED_ELEMENT = -103
MULTIPLE_EXT_TRIGGER = -104
NO_ACTIVE_LOG = -101
canlib.kvamemolibxml.dllversion()[source]

Get the kvaMemoLibXML DLL version number as a VersionNumber

canlib.kvamemolibxml.getVersion[source]

Get the kvaMemoLibXml DLL version number as a str

Deprecated since version 1.5: Use dllversion instead.

canlib.kvamemolibxml.kvaBufferToXml(conf_lif)[source]

Convert a buffer containg param.lif to XML settings.

Scripts from the param.lif will be written to current working directory.

Parameters:conf_lif (string) – Buffer containing param.lif to convert.
Returns:xml_buf (string) – Buffer containing converted XML settings.
canlib.kvamemolibxml.kvaError

alias of canlib.kvamemolibxml.exceptions.KvaError

canlib.kvamemolibxml.kvaMemoLibXml

alias of canlib.kvamemolibxml.wrapper.KvaMemoLibXml

canlib.kvamemolibxml.kvaXmlToBuffer(conf_xml)[source]

Convert XML settings to param.lif buffer.

Parameters:conf_xml (string) – XML settings to convert.
Returns:lif_buf (string) – Buffer containing converted param.lif.
canlib.kvamemolibxml.kvaXmlToFile(xml_filename, binary_filename)[source]

Convert XML file to binary configuration file.

Parameters:
  • infile (string) – Filename of file containing the XML settings.
  • outfile (string) – Filename of binary configuration.
canlib.kvamemolibxml.kvaXmlValidate(conf_xml)[source]

Validate a buffer with XML settings.

Parameters:conf_xml (string) – string containing the XML settings to validate.
Returns:countErr (int) – Number of XML validation errors. countWarn (int): Number of XML validation warnings.
canlib.kvamemolibxml.xmlGetLastError()[source]

Get the last error message (if any).

Get the last error message (if any) from conversion in human redable format.

Returns:msg (string) – Error message associated with kvaERR. err (int): kvaMemoLibXml error code.
canlib.kvamemolibxml.xmlGetValidationError()[source]

Get validation errors (if any).

Call after kvaXmlValidate() until return status is KvaXmlValidationStatusOK.

Returns:validationStatus (int) – Validation status code. text (string): Validation status message.
canlib.kvamemolibxml.xmlGetValidationStatusCount()[source]

Get the number of validation statuses (if any).

Call after kvaXmlValidate().

Returns:countErr (int) – Number of XML validation errors. countWarn (int): Number of XML validation warnings.
canlib.kvamemolibxml.xmlGetValidationWarning()[source]

Get validation warnings (if any).

Call after kvaXmlValidate() until return status is KvaXmlValidationStatusOK.

Returns:validationStatus (int) – Validation status code. text (string): Validation status message.