QUsb Class

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

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

Note: All functions in this class are reentrant.

Public Types

class Config
class Id
ConfigList
IdList
enum LogLevel { logNone, logError, logWarning, logInfo, logDebug, logDebugAll }

Properties

Public Functions

virtual ~QUsb()
int findDevice(const QUsb::Id &id, const QUsb::IdList &list) const
bool isPresent(const QUsb::Id &id) const
QUsb::LogLevel logLevel() const
void setLogLevel(QUsb::LogLevel level)

Public Slots

bool addDevice(const QUsb::Id &id)
bool removeDevice(const QUsb::Id &id)

Signals

void deviceInserted(QUsb::Id id)
void deviceRemoved(QUsb::Id id)

Static Public Members

QUsb::IdList devices()

Protected Slots

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

Detailed Description

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

See also QUsbDevice.

Member Type Documentation

QUsb::ConfigList

List of Config structs.

QUsb::IdList

List of Id structs.

enum QUsb::LogLevel

ConstantValueDescription
QUsb::logNone0No debug output
QUsb::logError1Errors only
QUsb::logWarning2Warning and abose
QUsb::logInfo3Info and above
QUsb::logDebug4Everything
QUsb::logDebugAll5Everything + libusb debug output

Property Documentation

logLevel : QUsb::LogLevel

Various properties.

Member Function Documentation

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

Add an id device to the list.

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

[protected slot] void QUsb::checkDevices()

Check devices present in system.

This gets called by the internal timer.

[signal] void QUsb::deviceInserted(QUsb::Id id)

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

[signal] void QUsb::deviceRemoved(QUsb::Id id)

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

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

Add a list to monitor.

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

Remove id device from the list.

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

[virtual] QUsb::~QUsb()

Unregister callbacks and close the usb context.

[static] QUsb::IdList QUsb::devices()

Returns all present devices.

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

Search an id device in a device list.

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

bool QUsb::isPresent(const QUsb::Id &id) const

Check if id device is present.

Return bool true if present.

QUsb::LogLevel QUsb::logLevel() const

Get current log level.

Note: Getter function for property logLevel.

See also setLogLevel().

void QUsb::setLogLevel(QUsb::LogLevel level)

Set log level (only hotplug/detection).

Note: Setter function for property logLevel.

See also logLevel().