Files
GUI/src/device/DeviceManager.h
2022-05-07 14:39:10 +08:00

48 lines
981 B
C++

//
// Created by Krad on 2021/10/12.
//
#ifndef GUI_DEVICEMANAGER_H
#define GUI_DEVICEMANAGER_H
#include <QObject>
#include <QThread>
class DeviceManager :public QObject {
Q_OBJECT
public:
static DeviceManager* Default(){
static DeviceManager manager;
return &manager;
}
void initDevice();
void close();
void setErrorOccurred(bool v){
errorOccurred = v;
}
QString getSoftwareVersion();
QString getScanOutputPath();
bool getErrorOccurred(){
return errorOccurred;
}
void emitErrorCallback(const char * msg);
signals:
void raiseGlobalError(QString msg);
protected:
void timerEvent(QTimerEvent* event) override;
private:
void processScan(const char* json, bool empty = false);
int timerID = -1;
int deviceInfTimerID = -1;
int lastStatus = -1;
bool previewing = false;
volatile bool endLoop = false;
bool errorOccurred = false;
QThread* previewDataCaller;
};
#endif //GUI_DEVICEMANAGER_H