ChannelData¶
- class canlib.canlib.ChannelData(channel_number)[source]¶
Object for querying various information about a channel
After instantiating a
ChannelDataobject with a channel number, a variety of information is available as attributes. Most attributes are named after the C constant used to retrieve the information and are found in the list below.Other information does not follow the C implementation completely, and are documented as separate properties further down.
There is also the
rawfunction, that is used internally to get all information and can also be used to interact more directly with the dll.- Variables
bus_type – A member of the
BusTypeGroupenum. Not implemented in Linux.card_firmware_rev – A
canlib.VersionNumberobject with the version of the card’s firmware.card_hardware_rev – A
canlib.VersionNumberobject with the version of the card’s hardware.card_number – An
intwith the card’s number in the computer. Each card type is numbered separately.card_serial_no – An
intwith the serial number of the card, or 0 if it doesn’t have a serial number.card_type – A member of the
HardwareTypeenum representing the hardware type of the card.card_upc_no – An
canlib.EANobject with the EAN of the card, orNoneif it doesn’t one.chan_no_on_card – An
intof the channel number on the card.channel_cap – A
ChannelCapobject with the capabilities of the channel as flags. Also seeChannelData.channel_cap_mask.channel_cap_ex – A tuple of
ChannelCapExwith the extended capabilities of the channel (added in v1.17).channel_cap_mask – A
ChannelCapwith which flags this device knows about.channel_flags – A
ChannelFlagsobject with the status of the channel as flags.channel_quality – An
intbetween 0 and 100 (inclusively) with the quality of the channel in percent of optimal quality. Not implemented in Linux.clock_info – A
ClockInfoobject with clock characteristics for the device (added in v1.16).devdescr_ascii – A
strwith the product name of the device.devdescr_unicode – A
strwith the product name of the device. Not implemented in Linux.device_physical_position – An
intwith the address of the device on its underlying bus. Not implemented in Linux.devname_ascii – A
strwith the current device name. Not implemented in Linux.dll_file_version – A
canlib.VersionNumberwith the version of the dll file.dll_filetype – 1 if “kvalapw.dll” is used, 2 if “kvalapw2.dll”
dll_product_version – A
canlib.VersionNumberwith the product version of the dll.driver_file_version – A
canlib.VersionNumberwith the version of the kernel-mode driver. Not implemented in Linux.driver_name – A
strwith the name of the device driver.driver_product_version – A
canlib.VersionNumberwith the product version of the kernel-mode driver. Not implemented in Linux.feature_ean – An
canlib.EANobject with an internal EAN. This is only intended for internal use.hw_status – Six
intwith hardware status codes. This is only intended for internal use.is_remote – A
boolfor whether the device is currently connected as a remote device. Not implemented in Linux.logger_type – A member of the
LoggerTypeenum. Not implemented in Linux.max_bitrate – An
intwith the maximum bitrate of the device. Zero means no limit on the bitrate.mfgname_ascii – A
strwith the manufacturer’s name.mfgname_unicode – A
strwith the manufacturer’s name. Not implemented in Linux.remote_host_name – A
strwith the remote host name of the device. Not implemented in Linux.remote_mac – A
strwith the remote mac address of the device. Not implemented in Linux.remote_operational_mode – A member of the
OperationalModeenum. Not implemented in Linux.remote_profile_name – A
strwith the remote profile name of the device. Not implemented in Linux.remote_type – A member of the
RemoteTypeenum. Not implemented in Linux.roundtrip_time – An
intwith the roundtrip time measured in milliseconds. Not implemented in Linux.time_since_last_seen – An
intwith the time in milliseconds since last communication occured. Not implemented in Linux.timesync_enabled – A
boolfor whether legacy time synchronization is enabled. Not implemented in Linux.trans_cap – A
DriverCapobject with the capabilities of the transceiver as flags. Not implemented in Linux.trans_serial_no – An
intwith the serial number of the transceiver, or 0 if it doesn’t have a serial number. Not implemented in Linux.trans_type – A member of the
TransceiverTypeenum.trans_upc_no – An
canlib.EANobject with the EAN of the transceiver, orNoneif it doesn’t have one. Not implemented in Linux.ui_number – An
intwith the number associated with the device that can be displayed in the user interface. Not implemented in Linux.
- property bus_param_limits¶
Get device’s bus parameter limits
Example usage:
>>> chd = canlib.ChannelData(channel_number=2) >>> limits = chd.bus_param_limits >>> limits.arbitration_min._asdict() {'tq': 0, 'phase1': 1, 'phase2': 1, 'sjw': 1, 'prescaler': 1, 'prop': 0} >>> limits.arbitration_max._asdict() {'tq': 0, 'phase1': 512, 'phase2': 32, 'sjw': 16, 'prescaler': 8192, 'prop': 0} >>> limits.data_min._asdict() {'tq': 0, 'phase1': 1, 'phase2': 1, 'sjw': 1, 'prescaler': 1, 'prop': 0} >>> limits.data_max._asdict() {'tq': 0, 'phase1': 512, 'phase2': 32, 'sjw': 16, 'prescaler': 8192, 'prop': 0}
The
tqfield is always zero, and is reserved for possible other uses in future releases.If
propis zero for bothminandmaxvalues, that means that the device does not distinguish between phase segment one and the propagation segment, i.e. thephase1limit applies to (phase1+prop).- Returns
New in version 1.20.
- property channel_name¶
The product channel name.
Retrieves a clear text name of the channel. The name is returned as a string.
- Type
str
- property custom_name¶
The custom channel name if set, or an empty string otherwise
- Type
str
- property device_name¶
Deprecated since version 1.7.
- raw(item, ctype=<class 'ctypes.c_ulong'>)[source]¶
A raw call to
canGetChannelData- Parameters
item (
ChannelDataItem) – The information to be retrieved.ctype – The
ctypestype that the information should be interpreted as.
- class canlib.canlib.HandleData(channel)[source]¶
Object for querying various information about a handle
This is identical to the
ChannelDataobject but it’s constructor takes acanlib.Channelinstead of a channel number.New in version 1.13.
- Variables
bus_type – A member of the
BusTypeGroupenum. Not implemented in Linux.card_firmware_rev – A
canlib.VersionNumberobject with the version of the card’s firmware.card_hardware_rev – A
canlib.VersionNumberobject with the version of the card’s hardware.card_number – An
intwith the card’s number in the computer. Each card type is numbered separately.card_serial_no – An
intwith the serial number of the card, or 0 if it doesn’t have a serial number.card_type – A member of the
HardwareTypeenum representing the hardware type of the card.card_upc_no – An
canlib.EANobject with the EAN of the card, orNoneif it doesn’t one.chan_no_on_card – An
intof the channel number on the card.channel_cap – A
ChannelCapobject with the capabilities of the channel as flags. Also seeChannelData.channel_cap_mask.channel_cap_ex – A tuple of
ChannelCapExwith the extended capabilities of the channel (added in v1.17).channel_cap_mask – A
ChannelCapwith which flags this device knows about.channel_flags – A
ChannelFlagsobject with the status of the channel as flags.channel_quality – An
intbetween 0 and 100 (inclusively) with the quality of the channel in percent of optimal quality. Not implemented in Linux.clock_info – A
ClockInfoobject with clock characteristics for the device (added in v1.16).devdescr_ascii – A
strwith the product name of the device.devdescr_unicode – A
strwith the product name of the device. Not implemented in Linux.device_physical_position – An
intwith the address of the device on its underlying bus. Not implemented in Linux.devname_ascii – A
strwith the current device name. Not implemented in Linux.dll_file_version – A
canlib.VersionNumberwith the version of the dll file.dll_filetype – 1 if “kvalapw.dll” is used, 2 if “kvalapw2.dll”
dll_product_version – A
canlib.VersionNumberwith the product version of the dll.driver_file_version – A
canlib.VersionNumberwith the version of the kernel-mode driver. Not implemented in Linux.driver_name – A
strwith the name of the device driver.driver_product_version – A
canlib.VersionNumberwith the product version of the kernel-mode driver. Not implemented in Linux.feature_ean – An
canlib.EANobject with an internal EAN. This is only intended for internal use.hw_status – Six
intwith hardware status codes. This is only intended for internal use.is_remote – A
boolfor whether the device is currently connected as a remote device. Not implemented in Linux.logger_type – A member of the
LoggerTypeenum. Not implemented in Linux.max_bitrate – An
intwith the maximum bitrate of the device. Zero means no limit on the bitrate.mfgname_ascii – A
strwith the manufacturer’s name.mfgname_unicode – A
strwith the manufacturer’s name. Not implemented in Linux.remote_host_name – A
strwith the remote host name of the device. Not implemented in Linux.remote_mac – A
strwith the remote mac address of the device. Not implemented in Linux.remote_operational_mode – A member of the
OperationalModeenum. Not implemented in Linux.remote_profile_name – A
strwith the remote profile name of the device. Not implemented in Linux.remote_type – A member of the
RemoteTypeenum. Not implemented in Linux.roundtrip_time – An
intwith the roundtrip time measured in milliseconds. Not implemented in Linux.time_since_last_seen – An
intwith the time in milliseconds since last communication occured. Not implemented in Linux.timesync_enabled – A
boolfor whether legacy time synchronization is enabled. Not implemented in Linux.trans_cap – A
DriverCapobject with the capabilities of the transceiver as flags. Not implemented in Linux.trans_serial_no – An
intwith the serial number of the transceiver, or 0 if it doesn’t have a serial number. Not implemented in Linux.trans_type – A member of the
TransceiverTypeenum.trans_upc_no – An
canlib.EANobject with the EAN of the transceiver, orNoneif it doesn’t have one. Not implemented in Linux.ui_number – An
intwith the number associated with the device that can be displayed in the user interface. Not implemented in Linux.
- raw(item, ctype=<class 'ctypes.c_ulong'>)[source]¶
A raw call to
canGetHandleData- Parameters
item (
ChannelDataItem) – The information to be retrieved.ctype – The
ctypestype that the information should be interpreted as.