Files
GUI/src/device/DeviceManager.h

45 lines
890 B
C
Raw Normal View History

//
// 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
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;
}
2022-01-12 15:55:10 +08:00
void emitErrorCallback(const char * msg);
signals:
void raiseGlobalError(QString msg);
protected:
2022-01-11 16:58:03 +08:00
void timerEvent(QTimerEvent* event) override;
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;
bool endLoop = false;
bool errorOccurred = false;
QThread* previewDataCaller;
};
#endif //GUI_DEVICEMANAGER_H