QUsbInfo Class

This class handles hotplug and device detection. More...

Header: #include <QUsbInfo>
qmake: QT += usb
Inherits: QObject

Note: All functions in this class are reentrant.

Properties

  • 1 property inherited from QObject

Public Functions

QUsbInfo(QObject *parent = Q_NULLPTR)
~QUsbInfo(void)
int findDevice(const QUsbDevice::Id &id, const QUsbDevice::IdList &list) const
QUsbDevice::IdList getPresentDevices() const
bool isPresent(const QUsbDevice::Id &id) const
QUsbDevice::LogLevel logLevel() const
void setLogLevel(QUsbDevice::LogLevel level)
  • 32 public functions inherited from QObject

Public Slots

bool addDevice(const QUsbDevice::Id &id)
bool removeDevice(const QUsbDevice::Id &id)
  • 1 public slot inherited from QObject

Signals

void deviceInserted(QUsbDevice::IdList list)
void deviceRemoved(QUsbDevice::IdList list)

Protected Slots

void checkDevices()
void monitorDevices(const QUsbDevice::IdList &list)

Additional Inherited Members

  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

This class handles hotplug and device detection.

Handles USB events and searching. Can be used to monitor events for a list of devices or all system devices.

See also QUsbDevice.

Property Documentation

logLevel : QUsbDevice::LogLevel

This property holds the log level for hotplug/detection.

Access functions:

QUsbDevice::LogLevel logLevel() const
void setLogLevel(QUsbDevice::LogLevel level)

Member Function Documentation

QUsbInfo::QUsbInfo(QObject *parent = Q_NULLPTR)

Default constructs an instance of QUsbInfo.

QUsbInfo::~QUsbInfo(void)

Destroys the instance of QUsbInfo.

[slot] bool QUsbInfo::addDevice(const QUsbDevice::Id &id)

Add an id device to the list.

Returns false if device was already in the list, else true.

[protected slot] void QUsbInfo::checkDevices()

Check devices present in system.

This gets called by the internal timer.

[signal] void QUsbInfo::deviceInserted(QUsbDevice::IdList list)

This is signal is emited when one or more new devices are detected, providing a list.

[signal] void QUsbInfo::deviceRemoved(QUsbDevice::IdList list)

This is signal is emited when one or more new devices are removed, providing a list.

int QUsbInfo::findDevice(const QUsbDevice::Id &id, const QUsbDevice::IdList &list) const

Search an id device in a device list.

Return index of the filter, returns -1 if not found.

QUsbDevice::IdList QUsbInfo::getPresentDevices() const

Gets a list of devices present in the system.

bool QUsbInfo::isPresent(const QUsbDevice::Id &id) const

Check if id device is present.

Return bool true if present.

QUsbDevice::LogLevel QUsbInfo::logLevel() const

Get current log level.

Note: Getter function for property logLevel.

See also setLogLevel().

[protected slot] void QUsbInfo::monitorDevices(const QUsbDevice::IdList &list)

Add a list to monitor.

[slot] bool QUsbInfo::removeDevice(const QUsbDevice::Id &id)

Remove id device from the list.

Return bool false if device was not in the list, else true.

void QUsbInfo::setLogLevel(QUsbDevice::LogLevel level)

Set log level (only hotplug/detection).

Note: Setter function for property logLevel.

See also logLevel().