# ChannelData

class canlib.canlib.ChannelData(channel_number)

  Object for querying various information about a channel

  After instantiating a `ChannelData` object 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 `raw` function, 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 `BusTypeGroup` enum. Not implemented in Linux.

    - card_firmware_rev – A `canlib.VersionNumber` object with the version of the card’s firmware.

    - card_hardware_rev – A `canlib.VersionNumber` object with the version of the card’s hardware.

    - card_number – An `int` with the card’s number in the computer. Each card type is numbered separately.

    - card_serial_no – An `int` with the serial number of the card, or 0 if it doesn’t have a serial number.

    - card_type – A member of the `HardwareType` enum representing the hardware type of the card.

    - card_upc_no – An `canlib.EAN` object with the EAN of the card, or `None` if it doesn’t one.

    - chan_no_on_card – An `int` of the channel number on the card.

    - channel_cap – A `ChannelCap` object with the capabilities of the channel as flags. Also see `ChannelData.channel_cap_mask`.

    - channel_cap_ex – A tuple of `ChannelCapEx` with the extended capabilities of the channel (added in v1.17).

    - channel_cap_mask – A `ChannelCap` with which flags this device knows about.

    - channel_flags – A `ChannelFlags` object with the status of the channel as flags.

    - channel_quality – An `int` between 0 and 100 (inclusively) with the quality of the channel in percent of optimal quality. Not implemented in Linux.

    - clock_info – A `ClockInfo` object with clock characteristics for the device (added in v1.16).

    - devdescr_ascii – A `str` with the product name of the device.

    - devdescr_unicode – A `str` with the product name of the device. Not implemented in Linux.

    - device_physical_position – An `int` with the address of the device on its underlying bus. Not implemented in Linux.

    - devname_ascii – A `str` with the current device name. Not implemented in Linux.

    - dll_file_version – A `canlib.VersionNumber` with the version of the dll file.

    - dll_filetype – 1 if “kvalapw.dll” is used, 2 if “kvalapw2.dll”

    - dll_product_version – A `canlib.VersionNumber` with the product version of the dll.

    - driver_file_version – A `canlib.VersionNumber` with the version of the kernel-mode driver. Not implemented in Linux.

    - driver_name – A `str` with the name of the device driver.

    - driver_product_version – A `canlib.VersionNumber` with the product version of the kernel-mode driver. Not implemented in Linux.

    - feature_ean – An `canlib.EAN` object with an internal EAN. This is only intended for internal use.

    - hw_status – Six `int` with hardware status codes. This is only intended for internal use.

    - is_remote – A `bool` for whether the device is currently connected as a remote device. Not implemented in Linux.

    - logger_type – A member of the `LoggerType` enum. Not implemented in Linux.

    - max_bitrate – An `int` with the maximum bitrate of the device. Zero means no limit on the bitrate.

    - mfgname_ascii – A `str` with the manufacturer’s name.

    - mfgname_unicode – A `str` with the manufacturer’s name. Not implemented in Linux.

    - remote_host_name – A `str` with the remote host name of the device. Not implemented in Linux.

    - remote_mac – A `str` with the remote mac address of the device. Not implemented in Linux.

    - remote_operational_mode – A member of the `OperationalMode` enum. Not implemented in Linux.

    - remote_profile_name – A `str` with the remote profile name of the device. Not implemented in Linux.

    - remote_type – A member of the `RemoteType` enum. Not implemented in Linux.

    - roundtrip_time – An `int` with the roundtrip time measured in milliseconds. Not implemented in Linux.

    - time_since_last_seen – An `int` with the time in milliseconds since last communication occured. Not implemented in Linux.

    - timesync_enabled – A `bool` for whether legacy time synchronization is enabled. Not implemented in Linux.

    - trans_cap – A `DriverCap` object with the capabilities of the transceiver as flags. Not implemented in Linux.

    - trans_serial_no – An `int` with 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 `TransceiverType` enum.

    - trans_upc_no – An `canlib.EAN` object with the EAN of the transceiver, or `None` if it doesn’t have one. Not implemented in Linux.

    - ui_number – An `int` with 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 `tq` field is always zero, and is reserved for possible other uses in future releases.

    If `prop` is zero for both `min` and `max` values, that means that the device does not distinguish between phase segment one and the propagation segment, i.e. the `phase1` limit applies to (`phase1` + `prop`).

    Returns

      `busparams.BusParamTqLimits`

    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'>)

    A raw call to `canGetChannelData`

    Parameters

      - item (`ChannelDataItem`) – The information to be retrieved.

      - ctype – The `ctypes` type that the information should be interpreted as.

class canlib.canlib.HandleData(channel)

  Object for querying various information about a handle

  This is identical to the `ChannelData` object but it’s constructor takes a `canlib.Channel` instead of a channel number.

  New in version 1.13.

  Variables

    - bus_type – A member of the `BusTypeGroup` enum. Not implemented in Linux.

    - card_firmware_rev – A `canlib.VersionNumber` object with the version of the card’s firmware.

    - card_hardware_rev – A `canlib.VersionNumber` object with the version of the card’s hardware.

    - card_number – An `int` with the card’s number in the computer. Each card type is numbered separately.

    - card_serial_no – An `int` with the serial number of the card, or 0 if it doesn’t have a serial number.

    - card_type – A member of the `HardwareType` enum representing the hardware type of the card.

    - card_upc_no – An `canlib.EAN` object with the EAN of the card, or `None` if it doesn’t one.

    - chan_no_on_card – An `int` of the channel number on the card.

    - channel_cap – A `ChannelCap` object with the capabilities of the channel as flags. Also see `ChannelData.channel_cap_mask`.

    - channel_cap_ex – A tuple of `ChannelCapEx` with the extended capabilities of the channel (added in v1.17).

    - channel_cap_mask – A `ChannelCap` with which flags this device knows about.

    - channel_flags – A `ChannelFlags` object with the status of the channel as flags.

    - channel_quality – An `int` between 0 and 100 (inclusively) with the quality of the channel in percent of optimal quality. Not implemented in Linux.

    - clock_info – A `ClockInfo` object with clock characteristics for the device (added in v1.16).

    - devdescr_ascii – A `str` with the product name of the device.

    - devdescr_unicode – A `str` with the product name of the device. Not implemented in Linux.

    - device_physical_position – An `int` with the address of the device on its underlying bus. Not implemented in Linux.

    - devname_ascii – A `str` with the current device name. Not implemented in Linux.

    - dll_file_version – A `canlib.VersionNumber` with the version of the dll file.

    - dll_filetype – 1 if “kvalapw.dll” is used, 2 if “kvalapw2.dll”

    - dll_product_version – A `canlib.VersionNumber` with the product version of the dll.

    - driver_file_version – A `canlib.VersionNumber` with the version of the kernel-mode driver. Not implemented in Linux.

    - driver_name – A `str` with the name of the device driver.

    - driver_product_version – A `canlib.VersionNumber` with the product version of the kernel-mode driver. Not implemented in Linux.

    - feature_ean – An `canlib.EAN` object with an internal EAN. This is only intended for internal use.

    - hw_status – Six `int` with hardware status codes. This is only intended for internal use.

    - is_remote – A `bool` for whether the device is currently connected as a remote device. Not implemented in Linux.

    - logger_type – A member of the `LoggerType` enum. Not implemented in Linux.

    - max_bitrate – An `int` with the maximum bitrate of the device. Zero means no limit on the bitrate.

    - mfgname_ascii – A `str` with the manufacturer’s name.

    - mfgname_unicode – A `str` with the manufacturer’s name. Not implemented in Linux.

    - remote_host_name – A `str` with the remote host name of the device. Not implemented in Linux.

    - remote_mac – A `str` with the remote mac address of the device. Not implemented in Linux.

    - remote_operational_mode – A member of the `OperationalMode` enum. Not implemented in Linux.

    - remote_profile_name – A `str` with the remote profile name of the device. Not implemented in Linux.

    - remote_type – A member of the `RemoteType` enum. Not implemented in Linux.

    - roundtrip_time – An `int` with the roundtrip time measured in milliseconds. Not implemented in Linux.

    - time_since_last_seen – An `int` with the time in milliseconds since last communication occured. Not implemented in Linux.

    - timesync_enabled – A `bool` for whether legacy time synchronization is enabled. Not implemented in Linux.

    - trans_cap – A `DriverCap` object with the capabilities of the transceiver as flags. Not implemented in Linux.

    - trans_serial_no – An `int` with 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 `TransceiverType` enum.

    - trans_upc_no – An `canlib.EAN` object with the EAN of the transceiver, or `None` if it doesn’t have one. Not implemented in Linux.

    - ui_number – An `int` with 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'>)

    A raw call to `canGetHandleData`

    Parameters

      - item (`ChannelDataItem`) – The information to be retrieved.

      - ctype – The `ctypes` type that the information should be interpreted as.