2021-10-13 17:38:31 +08:00
|
|
|
//
|
|
|
|
|
// Created by Krad on 2021/10/12.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef GUI_DEVICEMANAGER_H
|
|
|
|
|
#define GUI_DEVICEMANAGER_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
2021-10-22 14:48:55 +08:00
|
|
|
#include <QThread>
|
2021-10-13 17:38:31 +08:00
|
|
|
class DeviceManager:public QObject {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
static DeviceManager* Default(){
|
|
|
|
|
static DeviceManager manager;
|
|
|
|
|
return &manager;
|
|
|
|
|
}
|
|
|
|
|
void initDevice();
|
2021-10-26 13:08:11 +08:00
|
|
|
void setErrorOccurred(bool v){
|
|
|
|
|
errorOccurred = v;
|
|
|
|
|
}
|
|
|
|
|
bool getErrorOccurred(){
|
|
|
|
|
return errorOccurred;
|
|
|
|
|
}
|
2021-10-13 17:38:31 +08:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void timerEvent(QTimerEvent* event) override ;
|
|
|
|
|
|
|
|
|
|
private:
|
2021-10-20 15:55:15 +08:00
|
|
|
void processScan(const char * json,bool empty = false);
|
2021-10-13 17:38:31 +08:00
|
|
|
int timerID = -1;
|
2021-10-14 17:52:43 +08:00
|
|
|
int deviceInfTimerID = -1;
|
2021-10-13 17:38:31 +08:00
|
|
|
int lastStatus=-1;
|
|
|
|
|
bool previewing = false;
|
2021-10-22 14:48:55 +08:00
|
|
|
bool endLoop = false;
|
2021-10-26 13:08:11 +08:00
|
|
|
bool errorOccurred = false;
|
2021-10-22 14:48:55 +08:00
|
|
|
QThread* previewDataCaller;
|
2021-10-13 17:38:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //GUI_DEVICEMANAGER_H
|