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
enum | DeviceSpeed { unknownSpeed, lowSpeed, fullSpeed, highSpeed, superSpeed, superSpeedPlus } |
enum | DeviceStatus { statusOK, statusIoError, statusInvalidParam, statusAccessDenied, statusNoSuchDevice, …, StatusUnknownError } |
Properties
Public Functions
virtual | ~QUsbDevice() |
QUsb::Config | config() const |
QUsb::Id | id() const |
bool | isConnected() const |
QUsb::LogLevel | logLevel() const |
quint16 | pid() const |
void | setConfig(const QUsb::Config &config) |
void | setId(const QUsb::Id &id) |
void | setLogLevel(QUsb::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
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 |
Property Documentation
[read-only]
pid : const quint16
[read-only]
speed : const DeviceSpeed
timeout : quint16
[read-only]
vid : const 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.
QUsb::Config QUsbDevice::config() const
Returns the current config
.
Note: Getter function for property config.
See also setConfig().
QUsb::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.
QUsb::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 QUsb::Config &config)
Set the device config.
Note: Setter function for property config.
See also config().
void QUsbDevice::setId(const QUsb::Id &id)
Set the device id.
Note: Setter function for property id.
See also id().
void QUsbDevice::setLogLevel(QUsb::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.