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 | IdList |
| enum | LogLevel { logNone, logError, logWarning, logInfo, logDebug, logDebugAll } |
Properties
Public Functions
| virtual | ~QUsbDevice() |
| QUsbDevice::Config | config() const |
| QUsbDevice::Id | id() const |
| bool | isConnected() const |
| QUsbDevice::LogLevel | logLevel() const |
| quint16 | pid() const |
| void | setConfig(const QUsbDevice::Config &config) |
| void | setId(const QUsbDevice::Id &id) |
| void | setLogLevel(QUsbDevice::LogLevel level) |
| void | setTimeout(quint16 timeout) |
| QUsbDevice::DeviceSpeed | speed() const |
| QByteArray | speedString() const |
| QUsbDevice::DeviceStatus | status() const |
| quint16 | timeout() const |
| quint16 | vid() const |
Public Slots
Signals
| void | connectionChanged(bool connected) |
| void | statusChanged(QUsbDevice::DeviceStatus status) |
Detailed Description
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 | ? | Other error |
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
id : Id
logLevel : LogLevel
pid : const quint16
vid : const quint16
speed : const DeviceSpeed
timeout : quint16
Various properties.
Member Function Documentation
[slot] void QUsbDevice::close()
Close the device.
[slot] qint32 QUsbDevice::open()
Open the device. Returns 0 on success
[virtual] QUsbDevice::~QUsbDevice()
Destructor.
QUsbDevice::Config QUsbDevice::config() const
Returns the current config.
Note: Getter function for property config.
See also setConfig().
QUsbDevice::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.
Note: Getter function for property connected.
QUsbDevice::LogLevel QUsbDevice::logLevel() const
Returns the log level.
Note: Getter function for property logLevel.
See also setLogLevel().
quint16 QUsbDevice::pid() const
Return the device pid. (Product id)
Note: Getter function for property pid.
void QUsbDevice::setConfig(const QUsbDevice::Config &config)
Set the device config.
Note: Setter function for property config.
See also config().
void QUsbDevice::setId(const QUsbDevice::Id &id)
Set the device id.
Note: Setter function for property id.
See also id().
void QUsbDevice::setLogLevel(QUsbDevice::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().
QUsbDevice::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.