82 lines
2.2 KiB
Plaintext
82 lines
2.2 KiB
Plaintext
#ifndef DEVICEMANAGER_H
|
|
#define DEVICEMANAGER_H
|
|
#include <string>
|
|
#include <vector>
|
|
#include "../Public/util.h"
|
|
|
|
#include <QtSerialPort/QSerialPort>
|
|
#include <QtSerialPort/QSerialPortInfo>
|
|
#include "spectrometercallback.h"
|
|
#include "../Spectrometer/spectrometer.h"
|
|
|
|
namespace std
|
|
{
|
|
//class vector;
|
|
}
|
|
|
|
class ZioLinkProtocol;
|
|
|
|
|
|
class DeviceManager : public QObject, public SpectrometerCallback
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
|
|
DeviceManager(QObject *parent = nullptr);
|
|
~DeviceManager();
|
|
|
|
std::vector<float> readWavelengthCalibratedFile(const string &serialNumber);
|
|
std::vector<Spectrometer*> DetectDeviceLst(); //检测设备列表,并激活(打开设备)
|
|
void CloseAllDevice(); //关闭所有的设备
|
|
|
|
std::vector<Spectrometer*> GetDeviceList();//获取设备列表
|
|
|
|
static unsigned int m_nDeviceNum ; //实际已连接的设备数量
|
|
|
|
static std::vector<Spectrometer*> m_pDeviceLst;
|
|
|
|
int pixelCount;
|
|
|
|
private:
|
|
|
|
bool IsAllDevicesReady(); //检测所有设备是否都已准备就绪
|
|
void DeactivateDeviceLst(); //关闭所有设备
|
|
|
|
bool bStartMeasure;
|
|
bool stopscanning = true;
|
|
|
|
int iRecvCnt;
|
|
int iCurExecTimes;
|
|
int iDataLen;
|
|
|
|
ZioLinkProtocol* m_pZio;
|
|
|
|
public slots:
|
|
|
|
void onDetectDeviceLst();
|
|
|
|
void onDataReceived(std::string deviceIndex,const std::vector<float> &wavelength,
|
|
const std::vector<float> &spectrum) override;
|
|
|
|
// 批量测量回调(ARIS 0411 版 SDK 新增的纯虚函数,必须实现,否则本类仍是抽象类)
|
|
void onDataReceivedBanch(std::string deviceIndex,const std::vector<float> &wavelength,
|
|
const std::vector<std::vector<float>> &spectrum) override;
|
|
|
|
// 回调函数,当发生错误时被调用
|
|
void onError(std::string,
|
|
const std::string& error) override ;
|
|
|
|
int StartMeasure(int integrationTime, int nrAverages);
|
|
void stopMeasure();
|
|
|
|
signals:
|
|
void DetectDeviceFinish(std::vector<Spectrometer*> m_pDeviceLst);
|
|
|
|
|
|
void spectrumDataReady(QString deviceIndex,
|
|
const QVector<float>& wavelengthList,
|
|
const QVector<float>& spectrumList);
|
|
};
|
|
|
|
#endif // DEVICEMANAGER_H
|