添加项目文件。

This commit is contained in:
ldh
2026-11-06 14:45:09 +08:00
parent fb76f2ed7d
commit 24cbecc2cc
3437 changed files with 895900 additions and 0 deletions
+112
View File
@@ -0,0 +1,112 @@
#ifndef DEVICEMANAGER_H
#define DEVICEMANAGER_H
#include <string>
#include <vector>
#include "../Public/util.h"
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include "../Spectrometer/spectrometer.h"
#ifdef CAVITY_USE_ARIS_BRIDGE
// MSVC 构建:通过 MinGW 编译的 aris_bridge.dll 驱动真实 ARIS SDK(纯 C 接口)
#include "arisbridge.h"
#else
#include "spectrometercallback.h"
#endif
namespace std
{
//class vector;
}
#ifndef CAVITY_USE_ARIS_BRIDGE
class ZioLinkProtocol;
#endif
// 两种后端:
// * CAVITY_USE_ARIS_BRIDGE(MSVC + aris_bridge.dll):不继承 SDK 的回调类
// * 否则直接链接 ARIS SDK(MinGW)或兼容桩(aris_stub.dll)
#ifdef CAVITY_USE_ARIS_BRIDGE
class DeviceManager : public QObject
#else
class DeviceManager : public QObject, public SpectrometerCallback
#endif
{
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(); //关闭所有设备
// 用波长校准文件覆盖设备的波长表;文件缺失/格式错误时退回设备自带波长
void loadDeviceWavelengths(Spectrometer *device, const std::vector<float> &fallback);
// 把光谱数据转成 Qt 信号发出去(可能来自设备的采集线程)
void handleData(const std::string &serialNumber,
const std::vector<float> &wavelengthList,
const std::vector<float> &intensityList);
bool bStartMeasure;
bool stopscanning = true;
int iRecvCnt;
int iCurExecTimes;
int iDataLen;
#ifdef CAVITY_USE_ARIS_BRIDGE
// 桥接 DLL 的数据回调(静态,转给当前实例)
static void onBridgeData(const std::string &serialNumber,
const std::vector<float> &wavelengthList,
const std::vector<float> &intensityList);
#else
ZioLinkProtocol* m_pZio;
#endif
public slots:
void onDetectDeviceLst();
#ifndef CAVITY_USE_ARIS_BRIDGE
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 ;
#endif
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