canlib.kvrlib

Wrapper for the Kvaser kvrlib library

Some Kvaser devices, known as remote devices, can be connected via Ethernet (E.g. Kvaser Ethercan Light HS and Kvaser BlackBird v2) and you need to configure those devices before they are connected to your computer. This is where kvrlib comes into play with functions to discover and connect to a Kvaser Device on the network, making it accessible for the CANlib functions. The kvrlib also has functions to configure how the remote device connects to the network (e.g. dynamic/static IP). It also contains extra functions for wireless setup, such as scanning and getting connection status.

class canlib.kvrlib.Accessibility[source]

Bases: canlib.cenum.CEnum

kvrAccessibility_xxx

Remote device accessability status.

PRIVATE = 3
PROTECTED = 2
PUBLIC = 1
UNKNOWN = 0
class canlib.kvrlib.AddressTypeFlag(*args, **kwds)[source]

Bases: canlib.cenum.CFlag

kvrAddressTypeFlag_xxx

Flags for setting what addresses that should be returned by kvrDiscoveryGetDefaultAddresses().

ALL = <AddressTypeFlag.ALL: 255>
BROADCAST = <AddressTypeFlag.BROADCAST: 1>
STORED = <AddressTypeFlag.STORED: 2>
class canlib.kvrlib.Availability(*args, **kwds)[source]

Bases: canlib.cenum.CFlag

kvrAvailability_xxx

Device avalability flags.

FOUND_BY_SCAN = <Availability.FOUND_BY_SCAN: 1>
NONE = <Availability.NONE: 0>
STORED = <Availability.STORED: 2>
class canlib.kvrlib.BasicServiceSet[source]

Bases: canlib.cenum.CEnum

kvrBss_xxx

Basic Service Set.

ANY = 2
INDEPENDENT = 1
INFRASTRUCTURE = 0
class canlib.kvrlib.DeviceUsage[source]

Bases: canlib.cenum.CEnum

kvrDeviceUsage_xxx

Remote device usage status.

CONFIG = 4
FREE = 1
REMOTE = 2
UNKNOWN = 0
USB = 3
class canlib.kvrlib.Error[source]

Bases: canlib.cenum.CEnum

BLANK = -6
CHECKSUM = -3
DUPLICATED_DEVICE = -13
GENERIC = -2
NOT_IMPLEMENTED = -9
NOT_INITIALIZED = -1
NO_ANSWER = -8
NO_DEVICE = -7
NO_SERVICE = -12
OUT_OF_SPACE = -11
PARAMETER = -4
PASSWORD = -5
PERMISSION_DENIED = -10
exception canlib.kvrlib.KvrBlank[source]

Bases: canlib.kvrlib.exceptions.KvrError

status = -6
exception canlib.kvrlib.KvrError[source]

Bases: canlib.exceptions.DllException

class canlib.kvrlib.KvrLib(debug=None)[source]

Bases: object

Deprecated wrapper class for the Kvaser kvrlib.

Deprecated since version 1.5.

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

# deprecated
from canlib import kvrlib
cl = kvrlib.KvrLib()  # or kvrlib.Kvrlib()
cl.functionName()

# use this instead
from canlib import kvrlib
kvrlib.functionName()
dll = <canlib.kvrlib.dll.KvrlibDll object>
ean2ean_hi[source]

Using KvrLib static functions is deprecated, all functionality has been moved to the kvrlib module itself.

ean2ean_lo[source]

Using KvrLib static functions is deprecated, all functionality has been moved to the kvrlib module itself.

ean_hi_lo2ean[source]

Using KvrLib static functions is deprecated, all functionality has been moved to the kvrlib module itself.

class canlib.kvrlib.NetworkState[source]

Bases: canlib.cenum.CEnum

kvrNetworkState_xxx

States for network connection.

AUTHENTICATING = 8
AUTHENTICATION_FAILED = 9
CONNECTED = 7
CONNECTING = 6
CONNECTION_DELAY = 5
FAILED_MIC = 11
INITIALIZING = 3
INVALID = 1
NOT_CONNECTED = 4
ONLINE = 10
STARTUP = 2
UNKNOWN = 0
class canlib.kvrlib.RegulatoryDomain[source]

Bases: canlib.cenum.CEnum

kvrRegulatoryDomain_xxx

Regulatory domain.

CHINA_MII = 4
EUROPE_ETSI = 1
JAPAN_TELEC = 0
NORTH_AMERICA_FCC = 2
WORLD = 3
class canlib.kvrlib.RemoteState[source]

Bases: canlib.cenum.CEnum

kvrRemoteState_xxx

State of connection to device.

AVAILABLE = 1
CLOSING = 10
CONFIG_CHANGED = 13
CONNECTION_DOWN = 5
CONNECTION_UP = 6
DISCOVERED = 2
INSTALLING = 15
REDISCOVER = 7
REDISCOVER_PENDING = 9
REMOVE_ME = 11
STANDBY = 12
STARTED = 4
STARTING = 3
STOPPING = 14
UNWILLING = 8
VOID = 0
class canlib.kvrlib.ServiceState[source]

Bases: canlib.cenum.CEnum

kvrServiceState_xxx

Current service state.

AVAILABLE = 1
CLOSING = 10
CONFIG_CHANGED = 13
CONNECTION_DOWN = 5
CONNECTION_UP = 6
DISCOVERED = 2
INSTALLING = 15
REDISCOVER = 7
REDISCOVER_PENDING = 9
REMOVE_ME = 11
STANDBY = 12
STARTED = 4
STARTING = 3
STOPPING = 14
UNWILLING = 8
VOID = 0
class canlib.kvrlib.StartInfo[source]

Bases: canlib.cenum.CEnum

kvrStartInfo_xxx

Current start information.

ERR_CONFIGURING = 5
ERR_ENCRYPTION_PWD = 7
ERR_IN_USE = 2
ERR_NOTME = 4
ERR_PARAM = 6
ERR_PWD = 3
NONE = 0
START_OK = 1
canlib.kvrlib.addressFromString(type, address)[source]
canlib.kvrlib.configActiveProfileGet(channel)[source]
canlib.kvrlib.configActiveProfileSet(channel, profile_number)[source]
canlib.kvrlib.configNoProfilesGet(channel)[source]
canlib.kvrlib.deviceGetServiceStatus(device_info)[source]
canlib.kvrlib.deviceGetServiceStatusText(device_info)[source]
canlib.kvrlib.dllversion()[source]

Get the kvrlib version number as a str

canlib.kvrlib.ean2ean_hi(ean)[source]

Return EAN high part.

Returns the high part of the supplied EAN as an integer. Calling ean2ean_hi(ean=”73-30130-00671-3”) returns 0x73301.

canlib.kvrlib.ean2ean_lo(ean)[source]

Return EAN low part.

Returns the low part of the supplied EAN as an integer. Calling ean2ean_lo(ean=”73-30130-00671-3”) returns 0x30006713.

canlib.kvrlib.ean_hi_lo2ean(ean_hi, ean_lo)[source]

Build EAN from high and low part.

Returns the EAN as a string built from high and low parts in integer format. Calling ean_hi_lo2ean(ean_hi=0x73301, ean_lo=0x30006713) returns “73-30130-00671-3”.

canlib.kvrlib.getVersion[source]

Get the kvrlib version number as a str

Deprecated since version 1.5: Use dllversion instead.

canlib.kvrlib.initializeLibrary()[source]
canlib.kvrlib.kvrAccessibility

alias of canlib.kvrlib.enums.Accessibility

class canlib.kvrlib.kvrAddress[source]

Bases: _ctypes.Structure

TypeText = {0: 'UNKNOWN', 1: 'IPV4', 2: 'IPV6', 3: 'IPV4_PORT', 4: 'MAC'}
Type_IPV4 = 1
Type_IPV4_PORT = 3
Type_IPV6 = 2
Type_MAC = 4
Type_UNKNOWN = 0
address

Structure/Union member

type

Structure/Union member

class canlib.kvrlib.kvrAddressList(num_of_structs=20)[source]

Bases: _ctypes.Structure

STRUCT_ARRAY

Structure/Union member

elements

Structure/Union member

canlib.kvrlib.kvrAvailability

alias of canlib.kvrlib.enums.Availability

canlib.kvrlib.kvrBlank

alias of canlib.kvrlib.exceptions.KvrBlank

class canlib.kvrlib.kvrConfig(kvrlib=None, channel=0, mode=0, password='', profile_no=0)[source]

Bases: object

MODE_ERASE = 2
MODE_R = 0
MODE_RW = 1
XML_BUFFER_SIZE = 2046
clear()[source]
close()[source]
getXml()[source]
openEx(channel=None, mode=None, password=None, profile_no=None)[source]
setXml()[source]
class canlib.kvrlib.kvrDeviceInfo[source]

Bases: _ctypes.Structure

accessibility

Structure/Union member

accessibility_pwd

Structure/Union member

availability

Structure/Union member

base_station_id

Structure/Union member

client_address

Structure/Union member

connect()[source]
device_address

Structure/Union member

disconnect()[source]
ean_hi

Structure/Union member

ean_lo

Structure/Union member

encryption_key

Structure/Union member

fw_build_ver

Structure/Union member

fw_major_ver

Structure/Union member

fw_minor_ver

Structure/Union member

host_name

Structure/Union member

name

Structure/Union member

request_connection

Structure/Union member

reserved1

Structure/Union member

reserved2

Structure/Union member

ser_no

Structure/Union member

struct_size

Structure/Union member

usage

Structure/Union member

class canlib.kvrlib.kvrDeviceInfoList(deviceInfos)[source]

Bases: _ctypes.Structure

STRUCT_ARRAY

Structure/Union member

elements

Structure/Union member

canlib.kvrlib.kvrDeviceUsage

alias of canlib.kvrlib.enums.DeviceUsage

class canlib.kvrlib.kvrDiscovery(kvrlib=None)[source]

Bases: object

clearDevicesAtExit(onoff)[source]
close()[source]
classmethod getDefaultAddresses(addressTypeFlag=<AddressTypeFlag.BROADCAST: 1>, listSize=20)[source]
getResults()[source]
setAddresses(addressList)[source]
setEncryptionKey(device_info, key)[source]
setPassword(device_info, password)[source]
setScanTime(delay_ms, timeout_ms)[source]
start(delay_ms=None, timeout_ms=None)[source]
storeDevices(deviceInfos)[source]
canlib.kvrlib.kvrError

alias of canlib.kvrlib.exceptions.KvrError

class canlib.kvrlib.kvrVersion[source]

Bases: _ctypes.Structure

major

Structure/Union member

minor

Structure/Union member

canlib.kvrlib.kvrlib

alias of canlib.kvrlib.wrapper.KvrLib

canlib.kvrlib.stringFromAddress(address)[source]
canlib.kvrlib.unload()[source]