QCanBusDeviceInfo Class

The QCanBusDeviceInfo provides information about CAN bus interfaces. More...

Header: #include <QCanBusDeviceInfo>
CMake: find_package(Qt6 REQUIRED COMPONENTS SerialBus)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus)
qmake: QT += serialbus

Public Functions

QCanBusDeviceInfo(const QCanBusDeviceInfo &other)
~QCanBusDeviceInfo()
(since 6.0) QString alias() const
int channel() const
QString description() const
bool hasFlexibleDataRate() const
bool isVirtual() const
QString name() const
(since 6.2) QString plugin() const
QString serialNumber() const
void swap(QCanBusDeviceInfo &other)
QCanBusDeviceInfo &operator=(const QCanBusDeviceInfo &other)
QCanBusDeviceInfo &operator=(QCanBusDeviceInfo &&other)

Detailed Description

Each plugin may support one or more interfaces with different capabilities. This class provides information about available functions.

Member Function Documentation

QCanBusDeviceInfo::QCanBusDeviceInfo(const QCanBusDeviceInfo &other)

Constructs a copy of other.

[noexcept] QCanBusDeviceInfo::~QCanBusDeviceInfo()

Destroys the CAN bus device info.

[since 6.0] QString QCanBusDeviceInfo::alias() const

Returns a user defineable alias associated with this CAN bus interface.

Some CAN bus interfaces can have a user defined alias associated. This is mostly done with the CAN hardware vendors tools. The alias allows to identify this hardware later, especially when multiple interfaces are connected.

Note: In contrast to serialNumber(), the alias is not guaranteed to be unique.

If this function is not supported by the CAN plugin, an empty string is returned.

This function was introduced in Qt 6.0.

See also serialNumber().

int QCanBusDeviceInfo::channel() const

Returns the sequential channel number of the CAN bus interface, starting with zero. For example, a two channel CAN interface may have the channels 0 and 1. If the interface has only one channel or if no information about the channel is available, zero is returned.

QString QCanBusDeviceInfo::description() const

Returns a textual description of the CAN bus interface, if available. Example output: "PCAN USB Pro FD". If no description is available, an empty string is returned.

bool QCanBusDeviceInfo::hasFlexibleDataRate() const

Returns true, if the CAN bus interface is CAN FD (flexible data rate) capable.

If this information is not available, false is returned.

bool QCanBusDeviceInfo::isVirtual() const

Returns true, if the CAN bus interface is virtual (i.e. not connected to real CAN hardware).

If this information is not available, false is returned.

QString QCanBusDeviceInfo::name() const

Returns the interface name of this CAN bus interface, e.g. "can0".

This corresponds to the interfaceName parameter of QCanBus::createDevice().

[since 6.2] QString QCanBusDeviceInfo::plugin() const

Returns the plugin name of this CAN bus interface, e.g. "peakcan".

This corresponds to the plugin parameter of QCanBus::createDevice().

This function was introduced in Qt 6.2.

QString QCanBusDeviceInfo::serialNumber() const

Returns the serial number of the CAN bus interface as string, if available. Otherwise, an empty string is returned.

See also alias().

[noexcept] void QCanBusDeviceInfo::swap(QCanBusDeviceInfo &other)

Swaps this CAN bus device info with other. This operation is very fast and never fails.

QCanBusDeviceInfo &QCanBusDeviceInfo::operator=(const QCanBusDeviceInfo &other)

Assigns other to this CAN bus device info and returns a reference to this CAN bus device info.

[noexcept] QCanBusDeviceInfo &QCanBusDeviceInfo::operator=(QCanBusDeviceInfo &&other)

Move-assigns other to this QCanBusDeviceInfo instance.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.