-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathqUSBListener.h
38 lines (31 loc) · 921 Bytes
/
qUSBListener.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
#ifndef QUSBLISTENER_H
#define QUSBLISTENER_H
#include <QMainWindow>
#include <QVector>
#include <windows.h>
#include <dbt.h>
#include "usbdevice.h"
class qUSBListener : public QMainWindow
{
Q_OBJECT
public:
qUSBListener();
bool start(const uint16_t vid = 0, const uint16_t pid = 0, const QString sn = "");
bool stop();
QVector<usbDevice> getDevList();
signals:
void USBConnected(usbDevice name);
void USBDisconnected(usbDevice name);
void PortConnected(QString portName);
void PortDisconnected(QString portName);
protected:
virtual bool nativeEvent(const QByteArray & eventType,
void * message,
long * result);
bool getDevData(LPARAM lParamDev, usbDevice &newDevice);
inline QString getQstring(void* stringPtr);
private:
HDEVNOTIFY devNotify;
usbDevice* targetDev;
};
#endif // QUSBLISTENER_H