QUsbDevice Class
This class handles opening and configuring the device. More...
| Header: | #include <QUsbDevice> |
| qmake: | QT += usb |
| Inherits: | QObject |
Note: All functions in this class are reentrant.
Public Types
| class | Config |
| class | Id |
| typedef | ConfigList |
| enum | DeviceSpeed { unknownSpeed, lowSpeed, fullSpeed, highSpeed, superSpeed, superSpeedPlus } |
| enum | DeviceStatus { statusOK, statusIoError, statusInvalidParam, statusAccessDenied, ..., StatusUnknownError } |
| typedef | Endpoint |
| typedef | IdList |
| enum | LogLevel { logNone, logError, logWarning, logInfo, logDebug, logDebugAll } |
Properties
- 1 property inherited from QObject
Public Functions
| QUsbDevice(QObject *parent = Q_NULLPTR) | |
| ~QUsbDevice() | |
| Config | config() const |
| Id | id() const |
| bool | isConnected() const |
| LogLevel | logLevel() const |
| quint16 | pid() const |
| void | setConfig(const Config &config) |
| void | setId(const Id &id) |
| void | setLogLevel(LogLevel level) |
| void | setTimeout(quint16 timeout) |
| DeviceSpeed | speed() const |
| QByteArray | speedString() const |
| quint16 | timeout() const |
| quint16 | vid() const |
- 32 public functions inherited from QObject
Public Slots
- 1 public slot inherited from QObject
Static Public Members
| IdList | devices() |
- 10 static public members inherited from QObject
Additional Inherited Members
- 2 signals inherited from QObject
- 1 public variable inherited from QObject
- 9 protected functions inherited from QObject
- 2 protected variables inherited from QObject
Detailed Description
This class handles opening and configuring the device.
Member Type Documentation
typedef QUsbDevice::ConfigList
List of Config structs.
enum QUsbDevice::DeviceSpeed
| Constant | Value | Description |
|---|---|---|
QUsbDevice::unknownSpeed | -1 | Speed is unkown |
QUsbDevice::lowSpeed | 0 | USB 1.0 |
QUsbDevice::fullSpeed | 1 | USB 1.1/2.0 |
QUsbDevice::highSpeed | 2 | USB 2.0 |
QUsbDevice::superSpeed | 3 | USB 3.0/3.1 G1 |
QUsbDevice::superSpeedPlus | 4 | USB 3.1 G2 |
enum QUsbDevice::DeviceStatus
| Constant | Value | Description |
|---|---|---|
QUsbDevice::statusOK | 0 | Success (no error) |
QUsbDevice::statusIoError | -1 | Input/output error |
QUsbDevice::statusInvalidParam | -2 | Invalid parameter |
QUsbDevice::statusAccessDenied | -3 | Access denied (insufficient permissions) |
QUsbDevice::statusNoSuchDevice | -4 | No such device (it may have been disconnected) |
QUsbDevice::statusNotFound | -5 | Entity not found |
QUsbDevice::statusBusy | -6 | Resource busy |
QUsbDevice::statusTimeout | -7 | Operation timed out |
QUsbDevice::statusOverflow | -8 | Overflow |
QUsbDevice::statusPipeError | -9 | Pipe error |
QUsbDevice::statusInterrupted | -10 | System call interrupted (perhaps due to signal) |
QUsbDevice::statusNoMemory | -11 | Insufficient memory |
QUsbDevice::statusNotSupported | -12 | Operation not supported or unimplemented on this platform |
QUsbDevice::StatusUnknownError | -99 | Other error |
typedef QUsbDevice::Endpoint
An endpoint ID.
typedef QUsbDevice::IdList
List of Id structs.
enum QUsbDevice::LogLevel
| Constant | Value | Description |
|---|---|---|
QUsbDevice::logNone | 0 | No debug output |
QUsbDevice::logError | 1 | Errors only |
QUsbDevice::logWarning | 2 | Warning and abose |
QUsbDevice::logInfo | 3 | Info and above |
QUsbDevice::logDebug | 4 | Everything |
QUsbDevice::logDebugAll | 5 | Everything + libusb debug output |
Property Documentation
config : Config
Various properties.
Access functions:
| Config | config() const |
| void | setConfig(const Config &config) |
id : Id
Various properties.
Access functions:
| Id | id() const |
| void | setId(const Id &id) |
logLevel : LogLevel
Various properties.
Access functions:
| LogLevel | logLevel() const |
| void | setLogLevel(LogLevel level) |
pid : const quint16
Various properties.
Access functions:
| quint16 | pid() const |
speed : const DeviceSpeed
Various properties.
Access functions:
| DeviceSpeed | speed() const |
timeout : quint16
Various properties.
Access functions:
| quint16 | timeout() const |
| void | setTimeout(quint16 timeout) |
vid : const quint16
Various properties.
Access functions:
| quint16 | vid() const |
Member Function Documentation
QUsbDevice::QUsbDevice(QObject *parent = Q_NULLPTR)
Default constructs an instance of QUsbDevice.
QUsbDevice::~QUsbDevice()
Destructor.
[slot] void QUsbDevice::close()
Close the device.
Config QUsbDevice::config() const
Returns the current config.
Note: Getter function for property config.
See also setConfig().
[static] IdList QUsbDevice::devices()
Returns all present devices.
Id QUsbDevice::id() const
Returns the device id.
Note: Getter function for property id.
See also setId().
bool QUsbDevice::isConnected() const
Returns true if connected.
LogLevel QUsbDevice::logLevel() const
Returns the log level.
Note: Getter function for property logLevel.
See also setLogLevel().
[slot] qint32 QUsbDevice::open()
Open the device. Returns 0 on success
quint16 QUsbDevice::pid() const
Return the device pid. (Product id)
Note: Getter function for property pid.
void QUsbDevice::setLogLevel(LogLevel level)
Set the log level.
Note: Setter function for property logLevel.
See also logLevel().
void QUsbDevice::setTimeout(quint16 timeout)
Set the device timeout.
Note: Setter function for property timeout.
See also timeout().
DeviceSpeed QUsbDevice::speed() const
Returns the device speed.
Note: Getter function for property speed.
QByteArray QUsbDevice::speedString() const
Returns the current speed as a human readable string.
quint16 QUsbDevice::timeout() const
Return the timeout.
Note: Getter function for property timeout.
See also setTimeout().
quint16 QUsbDevice::vid() const
Return the device vid. (Vendor id)
Note: Getter function for property vid.