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>
|
2022-01-11 16:58:03 +08:00
|
|
|
class DeviceManager :public QObject {
|
|
|
|
|
Q_OBJECT
|
2021-10-13 17:38:31 +08:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
static DeviceManager* Default(){
|
|
|
|
|
static DeviceManager manager;
|
|
|
|
|
return &manager;
|
|
|
|
|
}
|
|
|
|
|
void initDevice();
|
2022-01-14 14:19:56 +08:00
|
|
|
void close();
|
2021-10-26 13:08:11 +08:00
|
|
|
void setErrorOccurred(bool v){
|
|
|
|
|
errorOccurred = v;
|
|
|
|
|
}
|
2022-03-16 17:00:03 +08:00
|
|
|
QString getSoftwareVersion();
|
2022-05-07 14:39:10 +08:00
|
|
|
QString getScanOutputPath();
|
2021-10-26 13:08:11 +08:00
|
|
|
bool getErrorOccurred(){
|
|
|
|
|
return errorOccurred;
|
|
|
|
|
}
|
2022-01-12 15:55:10 +08:00
|
|
|
void emitErrorCallback(const char * msg);
|
|
|
|
|
signals:
|
|
|
|
|
void raiseGlobalError(QString msg);
|
2021-10-13 17:38:31 +08:00
|
|
|
|
|
|
|
|
protected:
|
2022-01-11 16:58:03 +08:00
|
|
|
void timerEvent(QTimerEvent* event) override;
|
2021-10-13 17:38:31 +08:00
|
|
|
|
|
|
|
|
private:
|
2022-01-11 16:58:03 +08:00
|
|
|
void processScan(const char* json, bool empty = false);
|
|
|
|
|
int timerID = -1;
|
|
|
|
|
int deviceInfTimerID = -1;
|
|
|
|
|
int lastStatus = -1;
|
|
|
|
|
bool previewing = false;
|
2022-01-14 14:19:56 +08:00
|
|
|
volatile bool endLoop = false;
|
2022-01-11 16:58:03 +08:00
|
|
|
bool errorOccurred = false;
|
|
|
|
|
QThread* previewDataCaller;
|
2021-10-13 17:38:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //GUI_DEVICEMANAGER_H
|