#ifndef QUSBENDPOINT_H
#define QUSBENDPOINT_H
#include "qusbdevice.h"
#include "qusb.h"
#include <QIODevice>
#include <QObject>
class QUsbEndpointPrivate;
class Q_USB_EXPORT QUsbEndpoint : public QIODevice
{
Q_OBJECT
Q_DECLARE_PRIVATE(QUsbEndpoint)
public:
enum Type : quint8 {
controlEndpoint = 0,
isochronousEndpoint,
bulkEndpoint,
interruptEndpoint,
streamEndpoint
};
Q_ENUM(Type)
enum Status : quint8 {
transferCompleted,
transferError,
transferTimeout,
transferCanceled,
transferStall,
transferNoDevice,
transferOverflow,
};
Q_ENUM(Status)
enum bmRequestType : quint8 {
requestStandard = (0x00 << 5),
requestClass = (0x01 << 5),
requestVendor = (0x02 << 5),
requestReserved = (0x03 << 5),
recipientDevice = 0x00,
recipientInterface = 0x01,
recipientEndpoint = 0x02,
recipientOther = 0x03
};
Q_ENUM(bmRequestType)
enum bRequest : quint8 {
requestGetStatus = 0x00,
requestClearFeature = 0x01,
requestSetFeature = 0x03,
requestSetAddress = 0x05,
requestGetDescriptor = 0x06,
requestSetDescriptor = 0x07,
requestGetConfiguration = 0x08,
requestSetConfiguration = 0x09,
requestGetInterface = 0x0A,
requestSetInterface = 0x0B,
requestSynchFrame = 0x0C,
requestSetSel = 0x30,
requestIsochDelay = 0x31
};
Q_ENUM(bRequest)
Q_PROPERTY(Type type READ type)
Q_PROPERTY(quint8 endpoint READ endpoint)
Q_PROPERTY(bool polling READ polling WRITE setPolling)
explicit QUsbEndpoint(QUsbDevice *dev, Type type, quint8 ep);
~QUsbEndpoint();
bool open(QIODevice::OpenMode mode);
void close();
Type type() const;
quint8 endpoint() const;
Status status() const;
bool isSequential() const;
qint64 bytesAvailable() const;
qint64 bytesToWrite() const;
bool waitForBytesWritten(int msecs);
bool waitForReadyRead(int msecs);
void makeControlPacket(char *buffer,
QUsbEndpoint::bmRequestType bmRequestType,
QUsbEndpoint::bRequest bRequest, quint16 wValue,
quint16 wIndex, quint16 wLength) const;
void setPolling(bool enable);
bool polling();
bool poll();
public slots:
void cancelTransfer();
Q_SIGNALS:
void error(QUsbEndpoint::Status error);
protected:
qint64 readData(char *data, qint64 maxSize);
qint64 writeData(const char *data, qint64 maxSize);
private:
QUsbEndpointPrivate *const d_dummy;
Q_DISABLE_COPY(QUsbEndpoint)
Status m_status;
const QUsbDevice *m_dev;
const Type m_type;
const quint8 m_ep;
};
#endif // QUSBENDPOINT_H
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
usb.rar (28个子文件)
include
QUsbDevice 24B
qhiddevice.h 889B
QHidDevice 24B
qusbglobal.h 36B
QUsb 18B
QUsbEndpoint 26B
qusb.h 2KB
QtUsbVersion 26B
qusbdevice.h 3KB
qusbendpoint.h 3KB
qtusbversion.h 192B
QtUsbDepends 170B
QtUsb 231B
lib
libQt5Usb.la 697B
cmake
Qt5Usb
Qt5UsbConfig.cmake 15KB
Qt5UsbConfigVersion.cmake 287B
ExtraSourceIncludes.cmake 354B
pkgconfig
Qt5Usb.pc 418B
libQt5Usb.prl 1KB
libQt5Usb.a 8.64MB
libhidapi-hidraw.so.0 26KB
libhidapi-hidraw.so 26KB
libhidapi-hidraw.a 19KB
libhidapi-libusb.so.0.0.0 41KB
libhidapi-hidraw.so.0.0.0 26KB
libhidapi-libusb.so 41KB
libhidapi-libusb.so.0 41KB
libhidapi-libusb.a 31KB
共 28 条
- 1
资源评论
Simple_core
- 粉丝: 269
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功