-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguncon_usb.h
40 lines (32 loc) · 861 Bytes
/
guncon_usb.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef GUNCON_USB_H
#define GUNCON_USB_H
#include <QObject>
#include <QUsb>
const quint8 USB_PIPE_IN = 0x2; /* Bulk output endpoint for responses */
const quint8 USB_PIPE_OUT = 0x82; /* Bulk input endpoint for commands */
const quint16 USB_TIMEOUT_MSEC = 30;
class guncon_usb : public QObject
{
Q_OBJECT
public:
explicit guncon_usb(QObject *parent = 0);
~guncon_usb();
void setupDevice(void);
bool openDevice(void);
bool closeDevice(void);
qint16 read(QByteArray *buf);
void write(QByteArray *buf);
QByteArray decode(QByteArray data2);
bool isOpen();
signals:
void new_readed_data(QByteArray &);
public slots:
void new_read();
private:
QUsbManager mUsbManager;
QUsbDevice* mUsbDev;
QtUsb::DeviceFilter mFilter;
QtUsb::DeviceConfig mConfig;
bool opened;
};
#endif // GUNCON_USB_H