Compare commits

...

11 Commits
master ... dev

Author SHA1 Message Date
edff1888cf 修改测量服务参数配置 2026-05-14 17:54:19 +08:00
81cba45eb2 添加测量gvf数据发送处理 2026-04-22 11:36:54 +08:00
738f07624c 添加GVF数据处理线程 2026-04-16 21:53:03 +08:00
64e0113290 调整测量服务架构 2026-04-16 20:26:41 +08:00
ef452e95e3 修改通信为长连接 2026-04-14 21:32:01 +08:00
871de1e005 调试修改 2026-04-14 10:16:36 +08:00
09be8c7efa 调试修改 2026-04-08 19:52:53 +08:00
e0648db32b 添加断开设备 2026-04-08 15:44:32 +08:00
eb6f1f946c 调试测量服务修改 2026-04-07 19:16:35 +08:00
e3b44605b3 更新DeviceManage.dll 2026-04-06 23:26:19 +08:00
a78c30fdee 初步完成测量服务 2026-04-06 22:03:00 +08:00
49 changed files with 13388 additions and 0 deletions

View File

@ -0,0 +1,6 @@
INCLUDEPATH += \
$${PWD}/include
win32 {
LIBS += -L$${PWD}/lib -lDeviceManage
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,582 @@
#ifndef _ANALYZESPECTURMEXPORT_H_
#define _ANALYZESPECTURMEXPORT_H_
#ifdef ANALYZESPECTURM_EXPORTS
#define ANALYZESPECTURM_API(type) __declspec(dllexport) type __stdcall
#else
#define ANALYZESPECTURM_API(type) __declspec(dllimport) type __stdcall
#endif
#include "NuclideLibraryDefine.h"
#include "PeakInfoDefine.h"
#define MSS_SPECTURMDATA_MAXSIZE 65536
#pragma pack(push,1)
//s - Peak fails shape tests.
//D - Peak area deconvoluted.
//M - Peak is close to a library peak.
enum ePeakUseFlag
{
ePUF_PEAK_FAILED_SHAPE_TEST,
ePUF_PEAK_DECONVOLUTED,
ePUF_PEAK_FIT_NUCLIDE,
ePUF_PEAK_SMALL_POS,
eNF_ACTIVITY_AVG_CALC = 16,
eNF_PEAK_TOO_WIDE,
eNF_PEAK_MULT_AREA_NEG,
eNF_PEAK_TOO_NARROW,
eNF_PEAK_FWH25M_WIDE,
eNF_PEAK_FAILED_SENS_TEST,
eNF_PEAK_IDTY_FIRST_PEAK_FIALED,
eNF_LARGE_INCALC_ACTIVITY,
eNF_SMALL_INCALC_ACTIVITY,
eNF_PEAK_OUTSIDE_ANS_ENERGY_RANGE,
eNF_PEAK_CENTROID_IS_NOT_CLOSE_TO_LIB,
eNF_PEAK_BACKGROUND_COR,
};
#define IS_POS_CHECKED(flag,pos) ( (flag & (1 << pos)) == (1 << pos) )
#define SET_SHAPE_CHECK_FAILED(flag) (flag |= (1 << ePUF_PEAK_FAILED_SHAPE_TEST))
#define SET_SHAPE_CHECK_SUCCESS(flag) (flag &= ~(1 << ePUF_PEAK_FAILED_SHAPE_TEST))
#define SET_PEAK_DECONVOLUTED(flag) (flag |= (1 << ePUF_PEAK_DECONVOLUTED))
#define RESET_PEAK_DECONVOLUTED(flag) (flag &=~(1 << ePUF_PEAK_DECONVOLUTED))
#define SET_PEAK_FIT_NUCLIDE(flag) (flag |= (1 << ePUF_PEAK_FIT_NUCLIDE))
#define RESET_PEAK_FIT_NUCLIDE(flag) (flag &=~(1 << ePUF_PEAK_FIT_NUCLIDE))
#define IS_PEAK_FIT_NUCLIDE(flag) IS_POS_CHECKED( flag,ePUF_PEAK_FIT_NUCLIDE)
#define SET_PEAK_SMALL(flag) (flag |= (1 << ePUF_PEAK_SMALL_POS))
#define RESET_PEAK_SMALL(flag) (flag &=~(1 << ePUF_PEAK_SMALL_POS))
#define IS_PEAK_SMALL(flag) IS_POS_CHECKED( flag,ePUF_PEAK_SMALL_POS)
#define IS_NI_FLAG_CHECKED(flag,v) ( (flag &( 1 << v)) == (1 << v))
#define SET_NI_FLAG(flag,v) (flag |= (1 << v))
#define RESET_NI_FLAG(flag,v) (flag &= ~(1 << v))
#define IS_NI_KEY_LINE(flag) IS_NI_FLAG_CHECKED(flag,eNI_K)
#define IS_NI_NOT_IN_AVG(flag) IS_NI_FLAG_CHECKED(flag,eNI_A)
#define SET_ACTIVITY_AVG_CALC(flag) SET_NI_FLAG(flag,eNF_ACTIVITY_AVG_CALC)
#define IS_ACTIVITY_AVG_CALC_SET(flag) IS_NI_FLAG_CHECKED(flag,eNF_ACTIVITY_AVG_CALC)
#define SET_LARGE_INCALC_ACTIVITY(flag) SET_NI_FLAG(flag,eNF_LARGE_INCALC_ACTIVITY)
#define SET_SMALL_INCALC_ACTIVITY(flag) SET_NI_FLAG(flag,eNF_SMALL_INCALC_ACTIVITY)
#define SET_PEAK_FAILED_SENS_TEST(flag) SET_NI_FLAG(flag,eNF_PEAK_FAILED_SENS_TEST)
enum eLinearFitType
{
eLFTNone,
// 线性插值
eInterpolative,
// 一次函数2个未知数
eLine2,
// 二次函数,3个未知数
eLine3,
// 多次函数
eEFTPloy,
// 一次函数2个未知数,有权重拟合
eLine2WithW,
// 二次函数,3个未知数,有权重拟合
eLine3WithW,
eLine4,// 三次函数拟合
};
typedef struct sLinearFitResult
{
eLinearFitType type;
double a;
double b;
double c;
double d;
double e;
double f;
double sa;
double sb;
double sc;
double sd;
double se;
double sf;
double chisq;
}sLinearFitResult;
class NuclideLibrary;
struct sDataInfo
{
int *pOrgData;
int Orglen;
double dRealTime;
double dLiveTime;
int iPeakBeginCh; // 峰开始道址
NuclideLibrary *pNuclideLibaray;
};
typedef struct sSmoothConfig
{
int bUseGaussSmoothNum;
int bUseGaussSmoothTimes;
}sSmoothConfig;
typedef struct sPeakSearchConfig
{
double dSerachSensity;
int iChNumOnEachSide;
double dSfwhmRadioFwhmMaxValue;
double dSheightRadioHeightValue;
}sPeakSearchConfig;
typedef struct sResolvePeakConfig
{
double dnofwhmofpeak;
double dnofwhmofSideBaseLine;
}sResolvePeakConfig;
typedef struct sMatchPeaksConfig
{
double toler;
double dprob;
}sMatchPeaksConfig;
typedef struct sPeakInfoConfig
{
BOOL isroi;
int leftch;
int righch;
int n;
int cursorpeak;
}sPeakInfoConfig;
typedef struct sCursorOnePeakInfo
{
double dChannel; // 峰所在道址
double dEnergy; // 峰所在的能量
int iNIChannel;
double dNIEnergy;
int iLeftChannel;
int iRightChannel;
char cNName[32];
double fwhm;
double fwh5m;
double dGrossArea;
double dGrossAreaCountRate;
double dNetArea;
double dNetAreaCountRate;
double dNetAreaUncertain;
double dcA; // counting activity,
}sCursorOnePeakInfo;
typedef struct sPeakInfoResult
{
double* pSmoothData;
int iSmoothDataLen;
double* pSecDiffData;
int iSecDiffDataLen;
sCursorOnePeakInfo peakinfo;
}sPeakInfoResult;
typedef struct sConfigInfo
{
sSmoothConfig smoothconfig;
sPeakSearchConfig peaksearchconfig;
sResolvePeakConfig resolvepeakconfig;
sLinearFitResult energycal; // 能量刻度
sMatchPeaksConfig matchpeakconfig;
sPeakInfoConfig peakInfoConfig;
}sConfigInfo;
typedef struct OneValue
{
double v;
double sv;
}OneValue;
typedef struct sOneBaseLineInfo
{
eLinearFitType type;
int leftch;
int rightch;
OneValue a;
OneValue b;
OneValue c;
OneValue d;
double chisq;
double leftsmoothpoint;
double rightsmoothpoint;
double leftvalue;
double rightvalue;
double peakpos;
double grossarea;
double bdarea;
OneValue netarea;
double directfitnetarea;
}sOneBaseLineInfo;
typedef struct sOnePeakInfo
{
OneValue height;
OneValue centor;
OneValue width;
// 半高宽,道址
OneValue fwhm;
////y = a*exp(-b*(x-c)^2)); fwhmwidth = b
double fwhmwidth;
// 半高宽,道址
OneValue fittedfwhm;
// //y = a*exp(-b*(x-c)^2)); fittedwidth = b
OneValue fittedwidth;
OneValue area;
OneValue bdarea;
double leftch;
double rightch;
double energy;
int flag;
double leftsmoothpoint;
double rightsmoothpoint;
double leftvalue;
double rightvalue;
// 活度 校正到开始测量时的活度
OneValue activity;
// MDA
OneValue mda;
sOneNuclideInfo oni;
sOneEnergyLine onl;
sOneBaseLineInfo obli;
}sOnePeakInfo;
typedef struct sMulPeakInfo
{
int MulPeakNum;
sOnePeakInfo peakinfo;
}sMulPeakInfo;
typedef struct sBaseLineInfo
{
sOneBaseLineInfo leftbaseline;
sOneBaseLineInfo rightbaseline;
sOneBaseLineInfo peakbaseline;
}sBaseLineInfo;
class _sOneNuclideActivity;
typedef struct sResultInfo
{
char measureDate[32];
double dRealTime;
double dLiveTime;
int sprtLen;
double* pSmoothData;
int iSmoothDataLen;
double* pSecDiffData;
int iSecDiffDataLen;
double* pCandidatePeaks;
int iCandidatePeakNum;
int iFinalPeakNum; // 两个作用 inout 传入内存大小,字节单位,传出峰数量
int iNotEnoughMemery;
sOnePeakInfo* pSearchPeakResult;
sLinearFitResult linFitResult;
int iBaseLineNum; // 两个作用 inout 传入内存大小,字节单位,传出数量
int iNotEnoughMemeryofBaseLine;
sBaseLineInfo *pBaselineInfo;
int iMulPeakNum; // 两个作用 inout 传入内存大小,字节单位,传出重叠峰和单峰的数量
int iNotEnoughMemeryofMulPeak;
sMulPeakInfo *pMulPeakInfo;
int iNucResultNum; // 两个作用 inout 传入内存大小,字节单位,传出核素的数量
int iNotEnoughMemeryofNucResult;
_sOneNuclideActivity *pNucResultInfo;
}sResultInfo;
struct sFitData
{
eLinearFitType type;
int size;
double *px;
double *py;
double *pw;
};
typedef struct ASDataInfo
{
int* pHandle; // 设备句柄
int bdidx;
int chidx;
double beginchannel;
double endchannel;
eDisplaSprtInfoType calcType;
double energy;
eCalcSprtSubInfoType sprtSubType;
unsigned char reserve[20];
}ASDataInfo;
enum eSearchPeakSensityLevel
{
eSPS_1,
eSPS_2,
eSPS_3,
eSPS_4,
eSPS_5
};
typedef struct OneDefaultConfig
{
BOOL enalbe;
BOOL useInternal;
char path[MAX_PATH];
}OneDefaultConfig;
enum eBackgroundType
{
eBTAuto,
eBTOne,
eBTThree,
eBTFive,
};
typedef struct AnalysisSampleConfig
{
// 描述
char Description[128];
// 分析范围
double beginchannel;
double endchannel;
// 随机相加
double RandomSum;
// 本底类型
eBackgroundType BGType;
// 核素库
OneDefaultConfig NuclideLib;
// 校正文件,能量刻度,效率刻度
OneDefaultConfig Clb;
}AnalysisSampleConfig;
enum eMDAType
{
eMDATP_1
};
enum eASUnit
{
eASUBq,
eASUuCi,
};
typedef struct AnalysisSystemConfig
{
// 实验室名
char LaboratoryName[128];
// 操作员名
char OperatorName[128];
// MDA类型
eMDAType mdaType;
// 寻峰参数
eSearchPeakSensityLevel eSPSLevel;
// 匹配配置
double dlibMatchWidth;
// 分支比限制 100
double dlibFractionLimit;
// 可疑核素库
OneDefaultConfig libSuspect;
// 单位
eASUnit asuUit;
double asuMultiplier;
double asuDivisor;
char asuActivity[32];
double asuSize;
char asuSizeUnit[32];
double asuSizeUncertain;
}AnalysisSystemConfig;
typedef struct AnalysisDecayConfig
{
// 衰减校正
BOOL bDecayCorrection;
// 衰减校正 yyyy-MM-dd HH:mm:ss
char bDCDateTime[32];
// 谱线采集校正
BOOL bAcquisitionCorr;
// 样品采集时间校正
BOOL bSampleCorrect;
// 样品采集时间校正 yyyy-MM-dd HH:mm:ss
char bSCStartDateTime[32];
// 样品采集时间校正yyyy-MM-dd HH:mm:ss
char bSCStopDateTime[32];
}AnalysisDecayConfig;
enum eUncertainReportUnitType
{
eUPUTPercent,
eUPUTActivity
};
enum eUncertainReportValueType
{
eUPVTCouting,
eUPTVTotal
};
enum eUncertainLevel
{
eULOne,
eULTwo,
eULThree,
};
enum eOutputType
{
eOTPrinter,
eFile,
eProgram,
};
typedef struct AnalysisReportConfig
{
// 报告峰信息
int dReportOption;
// 不确定度报告单位
eUncertainReportUnitType URUTType;
// 不确定度报告值类型
eUncertainReportUnitType URVTType;
// 不确定度水平
eUncertainLevel UncertainLevel;
// 输出类型
eOutputType OTType;
// 显示解谱结果
BOOL bDisplayAnalysisResult;
// 输出文件配置
char FileProgramInfo[260];
// 输出程序配置
char ProgramInfo[260];
// 报告器配置
char ReporterInfo[260];
}AnalysisReportConfig;
typedef struct AnalysisMethodConfig
{
// 额外误差 %
double dSystematic;
// 随机误差
double dRandom;
}AnalysisMethodConfig;
typedef struct AnalysisCorrectionConfig
{
// 峰本底校正
OneDefaultConfig PBC;
// 几何校正
OneDefaultConfig GeometryC;
// 衰减校正
OneDefaultConfig AttenuationC;
}AnalysisCorrectionConfig;
typedef struct AnalysisDataDealConfig
{
int bUseGaussSmoothNum;
int bUseGaussSmoothTimes;
// 峰形测试
double dSfwhmRadioFwhmMaxValue;
double dSheightRadioHeightValue;
// 解谱
double dnofwhmofpeak;
double dnofwhmofSideBaseLine;
unsigned char reserve[128];
}AnalysisDataDealConfig;
typedef struct AnalysisSpecturmConfig
{
AnalysisSampleConfig ascSample;
AnalysisSystemConfig ascSystem;
AnalysisDecayConfig ascDecay;
AnalysisReportConfig ascReport;
AnalysisMethodConfig ascMethod;
AnalysisCorrectionConfig ascCorrection;
AnalysisDataDealConfig ascDataDeal;
unsigned char reserve[128];
}AnalysisSpecturmConfig;
class _sOneNuclideActivity
{
public:
sOneNuclideInfo info;
OneValue activity;
OneValue totalActivityUncertain;
OneValue mda;
};
typedef struct AnalyzeSpecturmConfigInfo
{
int head;
int version;
char CreateTime[32];
char LastModifyTime[32];
char Desc[128];
unsigned char reserve[256];
}AnalyzeSpecturmConfigInfo;
#pragma pack(pop)
#ifdef __cplusplus
extern "C" {
#endif
ANALYZESPECTURM_API(int) NuclideIndentifaction(int*pInst, sDataInfo* pSpecturmData, sConfigInfo *pConfig, sResultInfo *pResultInfo, char *ErrorInfo);
ANALYZESPECTURM_API(int) NuclideIndentifactionV2(int*pInst, ASDataInfo* pASDI, sConfigInfo *pConfig, sResultInfo *pResultInfo, char *ErrorInfo);
ANALYZESPECTURM_API(int) NuclideIndentifactionV3(int*pInst, ASDataInfo* pASDI, sResultInfo *pResultInfo, char *ErrorInfo);
ANALYZESPECTURM_API(int) FitLinear(int*pInst, sFitData* pSpecturmData, sLinearFitResult *pResultInfo, char *ErrorInfo);
ANALYZESPECTURM_API(int*) GetInst(char *ErrorInfo);
ANALYZESPECTURM_API(int) FreeInst(int*pInst);
ANALYZESPECTURM_API(int) GetAnalyzeSpecturmConfig(AnalyzeSpecturmConfigInfo *pInfo, AnalysisSpecturmConfig *pconfig, char *ErrMsg);
ANALYZESPECTURM_API(int) SetAnalyzeSpecturmConfig(AnalyzeSpecturmConfigInfo *pInfo, AnalysisSpecturmConfig *pconfig, char *ErrMsg);
ANALYZESPECTURM_API(int) SaveAnalyzeSpecturmConfig(const char *path, char *ErrMsg);
ANALYZESPECTURM_API(int) ReadAnalyzeSpecturmConfig(const char *path, char *ErrMsg);
ANALYZESPECTURM_API(int) GetCusorNuclideInfo(int*pInst, ASDataInfo* pASDI, sResultInfo *pResultInfo, char *ErrorInfo);
#ifdef __cplusplus
}
#endif
#endif // _ANALYZESPECTURMEXPORT_H_

View File

@ -0,0 +1,371 @@
#pragma once
#include "UAVrtp.h"
// #ifdef DEVICEMANAGE_EXPORTS
// #include "UserConfigInfo.h"
// #include "OneChannelConfigInfo.h"
// #include "OneDeviceComptonSuppressSetting.h"
// #endif
#ifdef DEVICEMANAGE_EXPORTS
#define DEVICEMANAGE_API(type) extern "C" _declspec(dllexport) type _stdcall
#else
#define DEVICEMANAGE_API(type) extern "C" _declspec(dllexport) type _stdcall
#endif
// #include "OneComptonResultDataExport.h"
#ifdef __cplusplus
extern "C" {
#endif
enum eMCSystemType
{
eReserve,
eHPGEDEFAULE = 1,
eCombineDevice = 2,
eProxyDevice = 3,
eRoundMC = 10,
eRoundMCV1 = 11, // 第二通道计数
eRoundMCHightThroughtput = 12, // 圆筒多道高计数率
eFP5XMC = 13,
eDMCA2023 = 14,
eHPGEMC = 30,
eMulParamMC = 50,
eDP3402PLUSMC = 51,
eMulParam863MC = 60,
eNeutronCount = 70,
eAnalogMC = 80,
eAnalogDigtalMC = 81,
eHightThroughtMC=90,
eHightThroughtMCCh2 = 91,
eGeneralMC = 92,
eAlphaMC = 93,
eHVDevice = 100,
};
// 添加新的采样率后需要注意在DeviceInfo.cpp中添加对应的索引
// 添加新的采样率后需要注意在DeviceInfo.h 中修改SampleRateInMbpsToSampleRate修改
enum eSampleRate
{
eNone,
e80M,
e250M,
e500M,
e50M,
e200M,
e1G,
e125M,
};
#pragma pack(push,1)
struct sDeviceInfo
{
char GUID[64];
char SystemVersion[16];
char CommVersion[16];
eMCSystemType type;
char MacAddr[32];
char FilePath[MAX_PATH];
unsigned char reserve[60];
};
class ChannelOpInfo
{
public:
BOOL canop;
double adcperiod;
eSampleRate samplerate;
double lmperiod;
int adcmaxvalue;
double adcvoltageinmv;
};
typedef struct sDeviceDataPtr
{
int totalNum;
void *pData[64];
}sDeviceDataPtr;
class DeviceData
{
public:
int len = 1024*1024;
BYTE pdata[1024*1024];
};
enum eDeviceManageOperate
{
eAddDevice,
eRemoveDevice,
};
enum eDeviceType
{
// 硬件设备
eHardwareDevice,
// 回放设备
eReplayDevice,
// 文件设备
eFileDevice,
// 硬件组合设备
eHardwareCombineDevice,
// 回放组合设备
eReplayCombineDevice,
// 代理设备
eDTProxyDevice,
};
enum eSprtOptType
{
eAdd,
eDec,
};
enum eDisplaSprtInfoType;
typedef struct sOneSprtOptInfo
{
void *pdev;
int bdidx;
int chidx;
eSprtOptType opttype;
eDisplaSprtInfoType sprttype;
}sOneSprtOptInfo;
class OneNeutronData
{
public:
int chnum;
__int64 measuretime;
__int64 lowercount;
__int64 betweencount;
__int64 ttlcount;
unsigned char reserve[32];
};
#ifndef DEVICEMANAGE_EXPORTS
#define ALIAS_NALE_LEN 64
enum eTransferMode
{
eSpecturmMode,
eFormWaveMode,
eADCMode,
eListMode,
eABMode,
};
enum eAutoSteadyStatus
{
a, // 未开启,
b, // 稳谱中,
c, // 稳谱完成,
d, // 不支持,
e, // 校准中,
f, // 稳谱失败,
g, // 校准失败,
h, // 等待中,
};
typedef struct sAutoSteadyParam
{
BOOL bEnable;
eAutoSteadyStatus status;
float offset; // 10
float a;
float b;
float c;
unsigned short maxchanneldivfactor;
unsigned short peakchannel; // 26
unsigned short steadyPeriodInSec; // 28
unsigned short peakhalfwidth; // 30
double dc;
}sAutoSteadyParam;
class UserConfigInfo
{
public:
char m_cAliasName[ALIAS_NALE_LEN];
char _strMCName[32];
int _iBDNum;
int _iChNum;
BOOL _bDisplayOrgCptSprt;
BOOL _bDisplayComptonCptSprt;
BOOL _bDisplayAntiComptonCptSprt;
BOOL _bDisplayLMSprt;
BOOL _bDisplayRiseTimeSprt;
BOOL _bDisplayFallTimeSprt;
__int64 _i64AdjustTickCount;
__int64 _i64MinAllowTickCount;
__int64 _i64MaxAllowTickCount;
BOOL _bDisplayConfig;
BOOL _bSaveLMData;
BOOL _bWork;
sAutoSteadyParam asp;
char m_cReserve[16];
};
class OneChannelConfigInfo
{
public:
void *__vfp;
/// <summary>
/// 数据传输模式
/// </summary>
eTransferMode m_eTransferModel = eSpecturmMode;
/// <summary>
/// 硬件增益
/// </summary>
int m_iDeviceGain = 1;
/// <summary>
/// 硬件增益
/// </summary>
int m_iDeviceGainSelectIndex = 1;
/// <summary>
/// 软件增益
/// </summary>
int m_iSoftGain = 3000;
/// <summary>
/// 时间常数
/// </summary>
double m_dConstTime = 45;
/// <summary>
/// 成形时间
/// </summary>
int m_iFormTime = 3;
/// <summary>
/// 快通道触发阈值
/// </summary>
double m_iFastChannelTrigerValue = 10;
/// <summary>
/// 多道分辨率
/// </summary>
int m_iChannelNum = 1024;
int m_iHighVoltage = 0;
// sParamConfig ParamConfig;
/// <summary>
/// 输入12V信号衰减控制1个ASCii字符表示0表示关闭1表示启用衰减偏移量2
/// </summary>
int m_iInputVoltageDesc = 0;
/// <summary>
/// CR微分模式启用1个ASCii字符表示0表示关闭1表示启用CR微分偏移量3。对于复位型前放其输出的为阶梯信号此时应启用CR微分否则可不启用
/// </summary>
int m_iCRDivMode = 0;
/// <summary>
/// 输入信号正负极性选择1个ASCii字符表示0表示负信号1表示正信号偏移量4
/// </summary>
int m_iInputSignalPostive = 0;
/// <summary>
/// 第一位为符号位后四位为数值以mV为单位,譬如’+0200表示直流偏移200mV, 地址偏移量5-9
/// </summary>
int m_iCurrentOffset = 0;
/// <summary>
/// 最大能量范围以keV为单位5个ASCII字符 譬如04000表示最大能量范围为4MeV。设置为全零00000则表示关闭自动稳谱功能。
/// </summary>
int m_iMaxEnergy = 0;
/// <summary>
/// Am峰面积寻峰法的面积比例 例如15表示截取峰顶高度15%的面积用于面积法寻峰
/// </summary>
int m_iAMPeakDiv = 0;
/// <summary>
/// K-40与Am-241的峰位校正系数 例如24513表示K-40与Am-241的峰位换算系数为24.513
/// </summary>
short m_iHVDelt = 0;
short m_iHVCtrl = 0;
int m_iGetSpecturmPeirod = 1;
__int64 m_iTotalMeasureTime = 10;
int m_iTotalMeasureCount = 1;
int m_iTrapeTopShitBit = 0;
int m_iRiseTime = 2;
int m_iTopTime = 2;
BOOL m_bICRCorrect = FALSE;
int m_iCRZAValue = 0;
int m_iZAEnable = 30;
BYTE reserve[128];
UserConfigInfo m_pUserConfigInfo;
};
#endif
typedef void(__stdcall *ONFINDDEVICEFINISHED)(int ret, sDeviceList* pDeviceList);
typedef void(__stdcall *ONUPDATEONEDEVICEBOARDDATA)(void* pHandle, sDeviceDataPtr *pdata);
typedef void(__stdcall *ONUPDATEONEDEVICECOMPTOMSUPRESSDATA)(void* pHandle,void *pComptonSet, sDeviceDataPtr *pdata);
typedef void(__stdcall *ONDEVICEMANAGECHANGED)(eDeviceManageOperate op, int ret, sDeviceList *pDeviceList);
typedef void(__stdcall *ONUPDATE_NEUTRONDATA)(void* pHandle, int ret, OneNeutronData* pData, int iLen);
typedef void(__stdcall *ONUPDATE_DEVICE_CONFIG)(void* pHandle, int bdnum,int chnum, void* pData, int iLen,void *pData2, int iLen2);
typedef void(__stdcall *ONUPDATE_PRESENT_CONFIG)(void* pHandle, int bdnum, int chnum);
// 更新设备配置结构信息
typedef void(__stdcall *ONUPDATE_DEVICE_STRUCT)(void* pHandle,void *pParent,int maxParentNum,void *pChild,int MaxChildNum, void *reserve);
DEVICEMANAGE_API(int) FindDeviceAsync(sFindDeviceConfig *fdc, ONFINDDEVICEFINISHED OnFindFinished);
DEVICEMANAGE_API(int) GetDeviceInfo(void *pHandle, sDeviceInfo *spDi, int budnum, int chnum);
DEVICEMANAGE_API(int) GetDeviceBoardTotalNum(void *pHandle);
DEVICEMANAGE_API(int) GetDeviceChTotalNum(void *pHandle, int bdidx);
DEVICEMANAGE_API(int) GetDeviceUserInfo(void *pHandle, UserConfigInfo *pUCI);
DEVICEMANAGE_API(int) SetDeviceUserInfo(void *pHandle, UserConfigInfo *pUCI);
DEVICEMANAGE_API(int) GetDeviceBoardUserInfo(void *pHandle, UserConfigInfo *pUCI, int bdidx);
DEVICEMANAGE_API(int) GetDeviceBoardChannelUserInfo(void *pHandle, UserConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) SetDeviceBoardChannelUserInfo(void *pHandle, UserConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) GetDeviceBoardChannelConfiginfo(void *pHandle, OneChannelConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCSetHightVoltage(void *pHandle, OneChannelConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCSoftParamConfig(void *pHandle, OneChannelConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCHardDeviceParamConfig(void *pHandle, OneChannelConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCStartMeasure(void *pHandle, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCStopMeasure(void *pHandle, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCGetData(void *pHandle, int totalnum, DeviceData *pDevData, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCCombineGetData(void *pHandle, int totalnum, DeviceData *pDevData, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCSetUpdateDeviceBoardDataCallBack(void *pHandle, ONUPDATEONEDEVICEBOARDDATA d);
DEVICEMANAGE_API(int) DBCSetUpdateDeviceBoardLMPointDataCallBack(void *pHandle, ONUPDATEONEDEVICEBOARDDATA d);
DEVICEMANAGE_API(int) DBCClearData(void *pHandle, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCSaveConfig(void *pHandle);
// DEVICEMANAGE_API(int) DBCSetUpdateDeviceComptonSupressResultCallBack(void *pHandle, ONUPDATEONEDEVICECOMPTOMSUPRESSDATA d);
// DEVICEMANAGE_API(int) DBCGetDeviceAntiComptonSetting(void *pHandle, OneDeviceComptonSuppressSetting *pDevSet);
// DEVICEMANAGE_API(int) DBCGetDeviceOneMainAntiComptonSetting(void *pHandle, OneComptonSuppressSetting *pOneSet, int mainidx);
// DEVICEMANAGE_API(int) DBCGetDeviceOneSubAntiComptonSetting(void *pHandle, OneComptonSuppressSetting *pOneSet, int mainidx, int subidx);
// DEVICEMANAGE_API(int) DBCSetDeviceOneMainAntiComptonSetting(void *pHandle, OneComptonSuppressSetting *pOneSet, int mainidx);
// DEVICEMANAGE_API(int) DBCSetDeviceOneSubAntiComptonSetting(void *pHandle, OneComptonSuppressSetting *pOneSet, int mainidx, int subidx);
DEVICEMANAGE_API(void) DM_Con_Flushout();
DEVICEMANAGE_API(void) DM_Con_KeyPressEvent(char c, int codetype);
DEVICEMANAGE_API(void) DM_Con_Init(char *pStdOutBuff, int pStdOutBuffLen, char *pStdErrBuff, int pStdErrBuffLen);
DEVICEMANAGE_API(void) DM_Con_Exit();
DEVICEMANAGE_API(void) DM_Con_Run();
DEVICEMANAGE_API(void) DM_Con_Free(void *buf);
DEVICEMANAGE_API(int) CloseDevice(void *pHandle);
// 获取板卡通道对应的设备
DEVICEMANAGE_API(void*) DMGetOperateDevice(void *pHandle, int bdidx, int chidx);
// 设置查询保存lmaa格式
// set 参数为FALSE表示读取当前信息如果为TRUE表示设置信息
// DEVICEMANAGE_API(int) DBCSaveAntiLMDataToFile(void *pHandle, int bdidx, int chidx, BOOL set, BOOL *bEnable, char *filename);
#pragma pack(pop)
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,34 @@
#pragma once
#ifdef DEVICEMANAGE_EXPORTS
#define DEVICEMANAGE_API_DM_C(type) extern "C" _declspec(dllexport) type _stdcall
#else
#define DEVICEMANAGE_API_DM_C(type) extern "C" _declspec(dllexport) type _stdcall
#endif
#include "OneChannelDataDefine.h"
#ifdef __cplusplus
extern "C" {
#endif
DEVICEMANAGE_API_DM_C(void*) DMCreateOneFileDevice();
DEVICEMANAGE_API_DM_C(int) DBCSetOneChannelSprtData(sCursorInfo *pci, OneSpecturmDataInfo *osdi);
// ±£´æ¶ÁÈ¡Îļþ
DEVICEMANAGE_API_DM_C(int) DBCSaveDeviceDataToDdf(int *pHandle, const char *path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCSaveDeviceDataToGID(int *pHandle, const char *path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCSaveDeviceDataToSpe(int *pHandle, const char *path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCSaveDeviceDataToChn(int* pHandle, const char* path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCSaveDeviceDataToCnf(int* pHandle, const char* path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCSaveDeviceDataToSpc(int* pHandle, const char* path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCSaveDeviceDataToPHD(int *pHandle, const char *path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCReadDeviceDataFromDdf(const char *path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCReadDeviceDataFromChn(const char* path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCReadDeviceDataFromCnf(const char* path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCReadDeviceDataFromSpc(const char* path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCReadDeviceDataFromSpe(const char *path, char* szErrMsg);
DEVICEMANAGE_API_DM_C(int) DBCReadDeviceDataFromPHD(const char *path, char* szErrMsg);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,116 @@
#pragma once
#pragma pack(push,1)
#ifdef DEVICEMANAGE_EXPORTS
#define DEVICEMANAGE_API_NUCLIB_C(type) extern "C" _declspec(dllexport) type _stdcall
#else
#define DEVICEMANAGE_API_NUCLIB_C(type) extern "C" _declspec(dllexport) type _stdcall
#endif
#define NI_NAME_LEN 32
enum eEnergyType
{
GammaRay,
XRay,
PositronDecay,
SingleEscape,
DoubleEscape
};
enum eHalfLifeUnit
{
Year,
Days,
Hours,
Min,
};
enum eEnergyFlay
{
// KeyLine
eNI_K,
// Not In Average
eNI_A,
};
typedef struct sOneEnergyLine
{
int rank;
double energy;
double percent;
eEnergyType energytype;
int flag;
}sOneEnergyLine;
enum eNuclideFlag
{
eNF_T,
eNF_F,
eNF_I,
eNF_N,
eNF_P,
eNF_C,
eNF_M,
eNF_A
};
typedef struct sOneNuclideInfo
{
char scname[64];
int flag;
double halflife;
eHalfLifeUnit halflifeunit;
double nuclidecertainty;
int energylinecount;
}sOneNuclideInfo;
typedef struct sOneNuclide
{
sOneNuclideInfo info;
sOneEnergyLine *pEnergyLine;
public:
sOneEnergyLine* GetEnergyLineByEnergy(double energy)
{
for (int i = 0; i < info.energylinecount; i++)
{
if (pEnergyLine[i].energy == energy)
{
return pEnergyLine + i;
}
}
return NULL;
}
}sOneNuclide;
typedef struct sNuclideLibraryInfo
{
int head;
int version;
char createtime[NI_NAME_LEN];
char lastmodifytime[NI_NAME_LEN];
char nuclidelibname[NI_NAME_LEN];
int totalnuclidecount;
int totalenergycount;
unsigned char reserve[32];
}sNuclideLibraryInfo;
typedef void(__stdcall *ON_UPDATE_NUCLIDE_CALLBACK)(void *pHandle, sNuclideLibraryInfo* pnli, sOneNuclide *pNuclide, void *reserve);
#pragma pack(pop)
#ifdef __cplusplus
extern "C" {
#endif
DEVICEMANAGE_API_NUCLIB_C(int) NLGetCurNuclideInfo(ON_UPDATE_NUCLIDE_CALLBACK pnli, char *ErrMsg);
DEVICEMANAGE_API_NUCLIB_C(void) NLFreeNuclideLibrary();
DEVICEMANAGE_API_NUCLIB_C(int) NLUpdateCurNuclideToDriver(void *pBuf, int len, char *ErrMsg);
DEVICEMANAGE_API_NUCLIB_C(int) NLSaveNuclideLibraryToFile(void* phandle, char *ErrMsg);
DEVICEMANAGE_API_NUCLIB_C(int) NLSaveAsNuclideLibraryToFile(void* phandle, const char *path, char *ErrMsg);
DEVICEMANAGE_API_NUCLIB_C(void*) NLReadNuclideFromFile(const char *path, char *ErrMsg);
DEVICEMANAGE_API_NUCLIB_C(int) NLGetNuclideInfo(void* phandle, ON_UPDATE_NUCLIDE_CALLBACK pnli, char *ErrMsg);
DEVICEMANAGE_API_NUCLIB_C(int) NLSetCurNuclideLibrary(void* phandle, char *ErrMsg);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,69 @@
#pragma once
#include <Windows.h>
#ifdef DEVICEMANAGE_EXPORTS
#define DEVICEMANAGE_API_DATADEAL_C(type) extern "C" _declspec(dllexport) type _stdcall
#else
#define DEVICEMANAGE_API_DATADEAL_C(type) extern "C" _declspec(dllexport) type _stdcall
#endif
#pragma pack(push,1)
typedef struct sPeriodMeasureInfo
{
BOOL bEnable;
int iTotalMsrCount;
int iCurMsrCount;
int iOneTotalMsrTimeInMs;
unsigned char reserve[16];
}sPeriodMeasureInfo;
#ifndef DEVICEMANAGE_EXPORTS
// 修改该结构后一定要修改OneAntiSatisfyMainAndSubChCountStatistic结构
class OneDataInfo
{
public:
void *virtualptr;
__int64 * m_pData;
int m_iDataLen;
void *m_pDataMutex;
double m_dRealTime;
__int64 m_i64TotalCount;
double m_dCountRate;
int m_LastUpdateTickCount;
__int64 m_BeginTickCount;
__int64 m_TotalTickCount;
double m_DeadTimeInSec;;
// 测量时间
SYSTEMTIME m_sDateTime;
double dreserve;
void *m_pPriveOnfo;
};
class OneSpecturmDataInfo :public OneDataInfo
{
public:
__int64 m_i64ICR;
double m_dLiveTimeSec;
double m_dLiveTimePercent;
sPeriodMeasureInfo m_pmi;
};
class OneRiseTimeStatisticInfo :public OneDataInfo
{
};
class OneFallTimeStatisticInfo :public OneRiseTimeStatisticInfo
{
};
class OneLMDeltTimeStatisticInfo :public OneDataInfo
{
};
#endif
#pragma pack(pop)

View File

@ -0,0 +1,72 @@
#pragma once
#ifndef DEVICEMANAGE_EXPORTS
#pragma pack(push,1)
typedef struct sPeriodMeasureInfo
{
BOOL bEnable;
int iTotalMsrCount;
int iCurMsrCount;
int iOneTotalMsrTimeInMs;
unsigned char reserve[16];
}sPeriodMeasureInfo;
class OneDataInfo
{
public:
void* __vfp;
__int64 * m_pData;
int m_iDataLen;
void *m_pDataMutex;
double m_dRealTime;
__int64 m_i64TotalCount;
double m_dCountRate;
int m_LastUpdateTickCount;
__int64 m_BeginTickCount;
__int64 m_TotalTickCount;
double m_DeadTimeInSec;;
// ²âÁ¿Ê±¼ä
SYSTEMTIME m_sDateTime;
double dreserve;
void *m_pPriveOnfo;
};
class OneSpecturmDataInfo :public OneDataInfo
{
public:
__int64 m_i64ICR;
double m_dLiveTimeSec;
double m_dLiveTimePercent;
sPeriodMeasureInfo m_pmi;
};
typedef struct sLMPointData
{
__int64 time;
int amp;
}sLMPointData;
class OneChannelLMPointData
{
public:
void* __vfp;
sLMPointData * m_pData;
int m_iDataLen;
};
// Æ×ÏßÊý¾Ý
class OneChannelData
{
public:
double m_LastUpdatePresentTime = 0;
OneSpecturmDataInfo m_OrgSprtData;
OneDataInfo m_RiseTimeInfo;
OneDataInfo m_FallTimeInfo;
OneChannelLMPointData m_LMPointData;
OneDataInfo m_LMDeltTimeInfo;
};
#pragma pack(pop)
#endif

View File

@ -0,0 +1,85 @@
#pragma once
#ifdef DEVICEMANAGE_EXPORTS
#define DEVICEMANAGE_API_ROI_C(type) extern "C" _declspec(dllexport) type _stdcall
#else
#define DEVICEMANAGE_API_ROI_C(type) extern "C" _declspec(dllexport) type _stdcall
#endif
#pragma pack(push,1)
struct OneRoiDetailInfo
{
int left;
int right;
unsigned char reserve[8];
void SetTop(int top)
{
int *t = (int*)reserve;
*t = top;
}
void SetBottom(int bot)
{
int *t = (int*)(reserve + 4);
*t = bot;
}
int GetTop()
{
int *t = (int*)reserve;
return *t;
}
int GetBottom()
{
int *t = (int*)(reserve + 4);
return *t;
}
};
enum eROICalcDataType
{
eOrgSprt,
eCoinSprt,
eAntiSprt,
e2DMapSprt,
e2DMapMainCmbSubCmb,
e2DMapMainMulSubCmb,
};
struct OneRoiDatalInfo
{
int version;
eROICalcDataType dataType;
__int64 i64TotalCount;
double dcps;
unsigned char reserve[32];
};
struct OneChannelROIInfo
{
int head;
int version;
int iTotalNum;
unsigned char reserve[32];
};
#pragma pack(pop)
#ifdef __cplusplus
extern "C" {
#endif
DEVICEMANAGE_API_ROI_C(int) DBCAddROI(int *pHandle, int bdidx, int chidx, OneRoiDetailInfo *proi);
DEVICEMANAGE_API_ROI_C(int) DBCRemoveROI(int *pHandle, int bdidx, int chidx, OneRoiDetailInfo *proi);
DEVICEMANAGE_API_ROI_C(int) DBCRemoveAllROI(int *pHandle, int bdidx, int chidx);
DEVICEMANAGE_API_ROI_C(int) DBCGetROIDataInfo(void * pHandle, int bdidx, int chidx, OneRoiDetailInfo *proi, OneRoiDatalInfo *pdata);
DEVICEMANAGE_API_ROI_C(int) DBCSaveROIDataInfoToFile(void * pHandle, int bdidx, int chidx, OneRoiDetailInfo *proi, OneRoiDatalInfo *pdata, char *pDir);
DEVICEMANAGE_API_ROI_C(int) DBCGetROIInfo(int *pHandle, int bdidx, int chidx, OneChannelROIInfo *pinfo);
DEVICEMANAGE_API_ROI_C(int) DBCGetROIDetailInfo(int *pHandle, int bdidx, int chidx, int roiidx, OneRoiDetailInfo *pdetail);
DEVICEMANAGE_API_ROI_C(int) DBCSaveROIToFile(int *pHandle, int bdidx, int chidx, const char *path, char *ErrMsg);
DEVICEMANAGE_API_ROI_C(int) DBCReadROIFromFile(int *pHandle, int bdidx, int chidx, const char *path, char *ErrMsg);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,145 @@
#pragma once
#ifndef DEVICEMANAGE_EXPORTS
#include <Windows.h>
#include "OneChannelDataExport.h"
#include <map>
using namespace std;
#define ANTI_COMPTON_MAX_NAME_LEN 32
#pragma pack(push,1)
enum eComptonFuntion
{
,
,
,
,
};
class OneComptonSuppressSetting
{
public:
char m_strMCName[ANTI_COMPTON_MAX_NAME_LEN];
char m_strMethodName[ANTI_COMPTON_MAX_NAME_LEN];
eComptonFuntion m_eFunction;
int m_iBoardNum;
int m_iChannelNum;
BOOL m_bDisplayOrgCptSprt;
BOOL m_bDisplayNowCptSprt;
BOOL m_bDisplayLMSprt;
BOOL m_bDisplayRiseTimeSprt;
BOOL m_bDisplayFallTimeSprt;
__int64 m_i64AdjustTickCount;
__int64 m_i64MinAllowTickCount;
__int64 m_i64MaxAllowTickCount;
BOOL m_bContainAmpValue;
unsigned char reserve[32];
int m_iSubSettingNum;
OneComptonSuppressSetting *m_pSubComptonSetting;
};
class OneDeviceComptonSuppressSetting
{
public:
int m_iTotalComptonNum;
int m_iTotalChannelNum;
unsigned char reserve[32];
OneComptonSuppressSetting *m_pComptonSetting;
};
struct OneMainAndChCountStatistic
{
__int64 ch;
__int64 count;
};
class OneAntiSatisfyMainAndSubChCountStatistic
{
public:
void* __vfp;
map<__int64, int> *m_pmapData;
OneMainAndChCountStatistic * m_pData;
void* m_mutex;
int m_iMaxDataLen;
int m_iCurDataLen;
double m_dRealTime;
__int64 m_i64TotalCount;
double m_dCountRate;
int m_LastUpdateTickCount;
__int64 m_BeginTickCount;
__int64 m_TotalTickCount;
double m_DeadTimeInSec;
SYSTEMTIME m_sDateTime;
double dreserve;
void *m_pPriveOnfo;
};
class OneAntiComptonStatisticInfoExt
{
public:
OneComptonSuppressSetting *m_pCptSetting;
OneAntiComptonStatisticInfoExt *m_pSub;
OneSpecturmDataInfo m_CoinSprtInfo;
OneSpecturmDataInfo m_AntiCoinSprtInfo;
OneAntiSatisfyMainAndSubChCountStatistic m_MainAndSubChStatistic;
};
class OneAntiComptonSatisfyTimeInfo :public OneDataInfo
{
protected:
int m_iMinTime;
int m_iMaxTime;
};
class AntiSatisfyDatas
{
public:
void* __vfp;
int m_iBufferLen;
int m_iCurLen;
void *m_pAntiSatisfyData;
int m_iBufferLenExt;
int m_iCurLenExt;
void *m_pAntiSatisfyDataExt;
};
class OneAntiComptonStatisticInfoExtForAll
{
public:
OneComptonSuppressSetting *m_pCptSetting;
OneAntiComptonStatisticInfoExt *m_pSub;
OneSpecturmDataInfo m_CoinCmbSprtInfo;
OneSpecturmDataInfo m_AntiCoinSprtInfo;
OneSpecturmDataInfo m_CoinSingleSprtInfo;
OneSpecturmDataInfo m_CoinMulSprtInfo;
// 主多-符合合成
OneSpecturmDataInfo m_MainMulSubCmbSprtInfo;
// 主多-符合无
OneSpecturmDataInfo m_MainMulSubNoneSprtInfo;
OneSpecturmDataInfo m_SubCoinMainCmbSubCmbSprtInfo;
// 符合通道所有,主探测器通道多个
OneSpecturmDataInfo m_SubCoinMainMulSubCmbSprtInfo;
OneAntiComptonSatisfyTimeInfo m_SatisfyTimeInfo;
OneAntiComptonSatisfyTimeInfo m_SatisfyTimeInfoMin;
OneAntiComptonSatisfyTimeInfo m_SatisfyTimeInfoMax;
AntiSatisfyDatas m_SatisfyDatas;
OneAntiSatisfyMainAndSubChCountStatistic m_MainAndSubChStatisticForCmb;
OneAntiSatisfyMainAndSubChCountStatistic m_MainMulAndSubCmbChStatistic;
};
#pragma pack(pop)
#endif

View File

@ -0,0 +1,92 @@
#pragma once
#ifdef DEVICEMANAGE_EXPORTS
#define DEVICEMANAGE_API_EFFIC_C(type) extern "C" _declspec(dllexport) type _stdcall
#else
#define DEVICEMANAGE_API_EFFIC_C(type) extern "C" _declspec(dllexport) type _stdcall
#endif
#include "NuclideLibraryDefine.h"
#include "AnalyzeSpecturmExport.h"
#pragma pack(push,1)
enum eActivityUnit
{
eGPS,
eBq,
euCi,
};
struct Activity
{
double v;
eActivityUnit unit;
double uncertainty;
};
struct OneEFTPoint
{
char isotope[32];
double energy;
double efficency;
double fitefficency;
double deltefficency;
Activity activity;
char ertificateTime[32];
double halfLife;
eHalfLifeUnit halfLifeUnit;
double efficencyuncertain;
double percent;
unsigned char reserve[16];
};
struct OneKneePoint
{
double KneeEnergy;
sLinearFitResult BlowFitResult;
sLinearFitResult AboveFitResult;
unsigned char reserve[64];
};
struct OneEfficienCalibarationInfo
{
int head;
int version;
int curEFTPoint;
int curKneePoint;
unsigned char reserve[32];
};
struct EfficOnePeakInfo
{
OneValue area;
};
class OneEfficientCalibaration;
#ifndef DEVICEMANAGE_EXPORTS
class OneEfficientCalibaration
{
public:
OneEfficienCalibarationInfo info;
OneKneePoint kneepoint[16];
OneEFTPoint eftpoint[256];
};
#endif
#pragma pack(pop)
#ifdef __cplusplus
extern "C" {
#endif
DEVICEMANAGE_API_EFFIC_C(int) DBCGetDeviceBoardChannelEfficCaliinfo(int *pHandle, OneEfficientCalibaration *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API_EFFIC_C(int) DBCAddEFTCaliPoint(int *pHandle, int bdidx, int chidx, OneEFTPoint *point);
DEVICEMANAGE_API_EFFIC_C(int) DBCRemoveEFTCaliPoint(int *pHandle, int bdidx, int chidx, OneEFTPoint *point);
DEVICEMANAGE_API_EFFIC_C(int) DBCSaveEFTCaliToFile(int *pHandle, int bdidx, int chidx, const char *path, char *ErrMsg);
DEVICEMANAGE_API_EFFIC_C(int) DBCReadEFTCaliFromFile(int *pHandle, int bdidx, int chidx, const char *path, char *ErrMsg);
DEVICEMANAGE_API_EFFIC_C(int) DBCGetEFTCaliinfo(int *pHandle, OneEfficientCalibaration *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API_EFFIC_C(int) DBCChangeKneePointInfo(int *pHandle, int bdidx, int chidx, OneKneePoint *proi);
DEVICEMANAGE_API_EFFIC_C(int) DBCCalcEfficient(int *pHandle, int bdidx, int chidx, ASDataInfo* pASDI, EfficOnePeakInfo *popi, OneEFTPoint *poeft);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,66 @@
#pragma once
#ifdef DEVICEMANAGE_EXPORTS
#define DEVICEMANAGE_API_ENG_C(type) extern "C" _declspec(dllexport) type _stdcall
#else
#define DEVICEMANAGE_API_ENG_C(type) extern "C" _declspec(dllexport) type _stdcall
#endif
#include "AnalyzeSpecturmExport.h"
#pragma pack(push,1)
struct OneECPoint
{
double channel;
double energy;
double fitenergy;
double deltaenergy;
int energyfitflag;
double fwhm;
double fitfwhm;
double deltafwhm;
int fwhmfitflag;
};
struct OneEnergyCalibarationInfo
{
int head;
int version;
int curPoint;
int MaxChannel;
sLinearFitResult energylfr;
sLinearFitResult fwhmlfr;
eLinearFitType energyFitType;
unsigned char reserve[28];
};
class OneEnergyCalibaration;
#define MAX_ECPINT_NUM 64
#ifndef DEVICEMANAGE_EXPORTS
class OneEnergyCalibaration
{
public:
OneEnergyCalibarationInfo info;
OneECPoint point[MAX_ECPINT_NUM];
};
#endif
#pragma pack(pop)
#ifdef __cplusplus
extern "C" {
#endif
DEVICEMANAGE_API_ENG_C(int) DBCGetEnergyCaliinfo(int *pHandle, OneEnergyCalibaration *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API_ENG_C(int) DBCAddEnergyCaliPoint(int *pHandle, int bdidx, int chidx, OneECPoint *point);
DEVICEMANAGE_API_ENG_C(int) DBCRemoveEnergyCaliPoint(int *pHandle, int bdidx, int chidx, OneECPoint *point);
DEVICEMANAGE_API_ENG_C(int) DBCChangeEnergyFitType(int *pHandle, int bdidx, int chidx, eLinearFitType lft);
DEVICEMANAGE_API_ENG_C(int) DBCSaveEnergyCaliToFile(int *pHandle, int bdidx, int chidx, const char *path, char *ErrMsg);
DEVICEMANAGE_API_ENG_C(int) DBCReadEnergyCaliFromFile(int *pHandle, int bdidx, int chidx, const char *path, char *ErrMsg);
DEVICEMANAGE_API_ENG_C(int) DBCSaveCaliToFile(int *pHandle, int bdidx, int chidx, const char *path, char *ErrMsg);
DEVICEMANAGE_API_ENG_C(int) DBCReadCaliFromFile(int *pHandle, int bdidx, int chidx, const char *path, char *ErrMsg);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,70 @@
#pragma once
#include <Windows.h>
#pragma pack(push,1)
typedef struct sOnePeakInfoV2
{
double dCursorChannel;
double dCursorCount;
double dCursorEnergy;
BOOL bFindPeak;
double dPeakChannel; // 峰所在道址
double dPeakEnergy; // 峰所在的能量
double dLeftChannel;
double dRightChannel;
char cNName[64];
double iNIChannel;
double dNIEnergy;
double fwhmpercent;
double fwhmenergy;
double fwhxmpercent;
double fwhxmenergy;
// 总计数
double dGrossArea;
// 总计数率
double dGrossAreaCountRate;
// 净计数
double dNetArea;
// 净计数率
double dNetAreaCountRate;
double dNetAreaUncertain;
double dcA; // counting activity
unsigned char reserve[32];
}sOnePeakInfoV2;
enum eDisplaSprtInfoType
{
eOrg,
eCoin,
eAnitCoin,
};
enum eCalcSprtSubInfoType
{
,
,
,
_符合单多,
,
_主单多,
_主多,
};
typedef struct sCursorInfo
{
int* pHandle; // 设备句柄
int bdidx;
int chidx;
double channel;
eDisplaSprtInfoType calcType;
eCalcSprtSubInfoType sprtSubType;
unsigned char reserve[28];
}sCursorInfo;
typedef struct sROICalcConfig
{
int bdCalclen;
double bdCalcUncertainPercent;
}sROICalcConfig;
#pragma pack(pop)

View File

@ -0,0 +1,448 @@
#ifndef _UAV_RTP_H_
#define _UAV_RTP_H_
#include <Windows.h>
#ifdef UAV_EXPORTS
#define UAV_EXPORTS_DLL(type) extern "C" _declspec(dllexport) type _stdcall
#else
#define UAV_EXPORTS_DLL(type) extern "C" _declspec(dllimport) type _stdcall
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef UAV_EXPORTS
#define MSSCOMMUNICATION_API(t) _declspec(dllexport) t __stdcall
#else
#define MSSCOMMUNICATION_API(t) _declspec(dllimport) t __stdcall
#endif
#define MSS_MAX_DEVICE_NUM 64
#pragma pack(push,1)
typedef struct sDeviceList
{
int totalNum;
int *pHandle[MSS_MAX_DEVICE_NUM];
}sDeviceList;
typedef struct sServerInfo
{
unsigned char comType;
unsigned short port;
unsigned char serverIP[4];
unsigned char reserve[28];
}sServerInfo;
typedef struct sFindDeviceConfig
{
BOOL ETHEnable;
char macaddr[128];
char dhcpcfgfile[256];
int useDHCP;
BOOL COMEnable;
BOOL USB20Enable;
BOOL USB30Enable;
}sFindDeviceConfig;
typedef enum _eDataTransferType
{
eDTT_Unkown,
eDTT_TCP,
eDTT_UDP,
eDTT_USB20,
eDTT_USB30,
eDTT_COM,
}eDataTransferType;
#pragma pack(pop)
/*****************************************************************
** : PMSSPROTCOLCMDCALLBACK
** :
**   :
pBuf
iLlen
lpBuf
ilpLen
iCode
msg
** : 0
**   : yl
** : 2015-7-11
** v1.0.0.0
** :
** :
** :
****************************************************************/
typedef void(__stdcall *PMSSPROTCOLCMDCALLBACK)(void* pHandle,void *pBuf, int iLen, void *lpBuf, int ilpLen, int iCode, const char *msg);
/*****************************************************************
** : Mss_SetCmdCallBack(void *pbuf,int len)
** :
**   :
pMssCmdCallBack
** :
0
--------------------------------
-1
-2
-3
-4
-5
-6
-7
-20
--------------------------------
500
501
502
503
504
505
506
507
508
--------------------------------
1
10
11 crc校验失败
12
13
14 flash失败
15
16
**   : yl
** : 2015-7-9
** v1.0.0.0
** :
** :
** :
****************************************************************/
MSSCOMMUNICATION_API(int) Mss_SetCmdCallBack(void *pProtocol,void *pHandle ,PMSSPROTCOLCMDCALLBACK pMssCmdCallBack);
/*****************************************************************
** : Mss_SetLuaCmdCallBack(void *pbuf,int len)
** :
**   :
pMssCmdCallBack
** :
0
--------------------------------
-1
-2
-3
-4
-5
-6
-7
-20
--------------------------------
500
501
502
503
504
505
506
507
508
--------------------------------
1
10
11 crc校验失败
12
13
14 flash失败
15
16
**   : yl
** : 2018-6-4
** v1.0.0.0
** :
** :
** :
****************************************************************/
MSSCOMMUNICATION_API(int) Mss_SetLuaCmdCallBack(void *pProtocol, PMSSPROTCOLCMDCALLBACK pMssCmdCallBack);
/*****************************************************************
** : Mss_Destory
** :
**   :
** :
0
--------------------------------
-1
-2
-3
-4
-5
-6
-7
-20
--------------------------------
500
501
502
503
504
505
506
507
508
--------------------------------
1
10
11 crc校验失败
12
13
14 flash失败
15
16
**   : yl
** : 2015-7-9
** v1.0.0.0
** :
** :
** :
****************************************************************/
MSSCOMMUNICATION_API(int) Mss_Destory();
/*****************************************************************
** : Mss_Init
** :
**   :
** :
0
--------------------------------
-1
-2
-3
-4
-5
-6
-7
-20
--------------------------------
500
501
502
503
504
505
506
507
508
--------------------------------
1
10
11 crc校验失败
12
13
14 flash失败
15
16
**   : yl
** : 2015-7-9
** v1.0.0.0
** :
** :
** :
****************************************************************/
MSSCOMMUNICATION_API(int) Mss_Init();
/*****************************************************************
** : Mss_FindDevice
** : finddevice
**   :
pMssCmdCallBack
** :
0
--------------------------------
-1
-2
-3
-4
-5
-6
-7
-20
--------------------------------
500
501
502
503
504
505
506
507
508
--------------------------------
1
10
11 crc校验失败
12
13
14 flash失败
15
16
**   : yl
** : 2015-7-9
** v1.0.0.0
** :
** :
** :
****************************************************************/
MSSCOMMUNICATION_API(int) Mss_FindDevice(sFindDeviceConfig *pfdc,sServerInfo *pServerInfo, int len, sDeviceList* pDeviceList);
/*****************************************************************
** : FindDevice
** :
**   :
inout 64
** :
0
--------------------------------
-1
-2
-3
-4
-5
-6
-7
-20
--------------------------------
500
501
502
503
504
505
506
507
508
--------------------------------
1
10
11 crc校验失败
12
13
14 flash失败
15
16
**   : yl
** : 2015-7-9
** v1.0.0.0
** :
** :
** :
****************************************************************/
MSSCOMMUNICATION_API(int) FindDevice(sDeviceList *sl, sFindDeviceConfig *pfdc);
/*****************************************************************
** : Mss_SendOneCmd
** :
**   :
in pProtocol finddevice返回的设备列表指针
in buf :
in len
in pretbuf
inout iretlen ,
** :
0
--------------------------------
-1
-2
-3
-4
-5
-6
-7
-20
--------------------------------
500
501
502
503
504
505
506
507
508
--------------------------------
1
10
11 crc校验失败
12
13
14 flash失败
15
16
**   : yl
** : 2015-7-9
** v1.0.0.0
** :
** :
** :
****************************************************************/
MSSCOMMUNICATION_API(int) Mss_SendOneCmd(void *pProtocol, void *buf, int len, void *pretbuf, int *iretlen, PMSSPROTCOLCMDCALLBACK pCmdCallBack);
/*****************************************************************
** : Mss_SendOneCmdAsyn
** :
**   :
in pProtocol finddevice返回的设备列表指针
in buf :
in len
in pretbuf
inout iretlen ,
** :
0
--------------------------------
-1
-2
-3
-4
-5
-6
-7
-20
--------------------------------
500
501
502
503
504
505
506
507
508
--------------------------------
1
10
11 crc校验失败
12
13
14 flash失败
15
16
**   : yl
** : 2015-7-9
** v1.0.0.0
** :
** :
** :
****************************************************************/
MSSCOMMUNICATION_API(int) Mss_SendOneCmdAsyn(void *pProtocol, void *buf, int len);
MSSCOMMUNICATION_API(void) Mss_OnRecvLuaDataProcessFinish(void *pProtocal, void* pHandle, void *pBuf, int iLen, void *lpBuf, int ilpLen, int iCode, const char *msg);
MSSCOMMUNICATION_API(int) Mss_FreeDevice(void *pProtocol);
MSSCOMMUNICATION_API(eDataTransferType) Mss_GetTransferDataType(void *pProtocol);
// 创建通信
MSSCOMMUNICATION_API(void *) Mss_CreateProtocol(int type, char *config);
MSSCOMMUNICATION_API(void) Mss_DeleteProtocol(void *pProtocol);
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

14
3rdlib/QsLog/QsLog.pri Normal file
View File

@ -0,0 +1,14 @@
INCLUDEPATH += \
$${PWD}/include
# DEFINES += QS_LOG_LINE_NUMBERS
CONFIG(debug, debug|release){
win32 {
LIBS += -L$${PWD}/lib -lQsLogd2
} else {
LIBS += -L$${PWD}/lib -lQsLogd
}
} else {
LIBS += -L$${PWD}/lib -lQsLog2
}

BIN
3rdlib/QsLog/bin/QsLog2.dll Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,146 @@
// Copyright (c) 2013, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSLOG_H
#define QSLOG_H
#include "QsLogLevel.h"
#include "QsLogDest.h"
#include <QDebug>
#include <QString>
#define QS_LOG_VERSION "2.0b3"
namespace QsLogging
{
class Destination;
class LoggerImpl; // d pointer
class QSLOG_SHARED_OBJECT Logger
{
public:
static Logger& instance();
static void destroyInstance();
static Level levelFromLogMessage(const QString& logMessage, bool* conversionSucceeded = 0);
~Logger();
//! Adds a log message destination. Don't add null destinations.
void addDestination(DestinationPtr destination);
//! Logging at a level < 'newLevel' will be ignored
void setLoggingLevel(Level newLevel);
//! The default level is INFO
Level loggingLevel() const;
//! Set to false to disable timestamp inclusion in log messages
void setIncludeTimestamp(bool e);
//! Default value is true.
bool includeTimestamp() const;
//! Set to false to disable log level inclusion in log messages
void setIncludeLogLevel(bool l);
//! Default value is true.
bool includeLogLevel() const;
//! The helper forwards the streaming to QDebug and builds the final
//! log message.
class QSLOG_SHARED_OBJECT Helper
{
public:
explicit Helper(Level logLevel) :
level(logLevel),
qtDebug(&buffer)
{}
~Helper();
QDebug& stream(){ return qtDebug; }
private:
void writeToLog();
Level level;
QString buffer;
QDebug qtDebug;
};
private:
Logger();
Logger(const Logger&); // not available
Logger& operator=(const Logger&); // not available
void enqueueWrite(const QString& message, Level level);
void write(const QString& message, Level level);
LoggerImpl* d;
friend class LogWriterRunnable;
};
} // end namespace
//! Logging macros: define QS_LOG_LINE_NUMBERS to get the file and line number
//! in the log output.
#ifndef QS_LOG_LINE_NUMBERS
#define QLOG_TRACE() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::TraceLevel) {} \
else QsLogging::Logger::Helper(QsLogging::TraceLevel).stream()
#define QLOG_DEBUG() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::DebugLevel) {} \
else QsLogging::Logger::Helper(QsLogging::DebugLevel).stream()
#define QLOG_INFO() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::InfoLevel) {} \
else QsLogging::Logger::Helper(QsLogging::InfoLevel).stream()
#define QLOG_WARN() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::WarnLevel) {} \
else QsLogging::Logger::Helper(QsLogging::WarnLevel).stream()
#define QLOG_ERROR() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::ErrorLevel) {} \
else QsLogging::Logger::Helper(QsLogging::ErrorLevel).stream()
#define QLOG_FATAL() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::FatalLevel) {} \
else QsLogging::Logger::Helper(QsLogging::FatalLevel).stream()
#else
#define QLOG_TRACE() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::TraceLevel) {} \
else QsLogging::Logger::Helper(QsLogging::TraceLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_DEBUG() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::DebugLevel) {} \
else QsLogging::Logger::Helper(QsLogging::DebugLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_INFO() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::InfoLevel) {} \
else QsLogging::Logger::Helper(QsLogging::InfoLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_WARN() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::WarnLevel) {} \
else QsLogging::Logger::Helper(QsLogging::WarnLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_ERROR() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::ErrorLevel) {} \
else QsLogging::Logger::Helper(QsLogging::ErrorLevel).stream() << __FILE__ << '@' << __LINE__
#define QLOG_FATAL() \
if (QsLogging::Logger::instance().loggingLevel() > QsLogging::FatalLevel) {} \
else QsLogging::Logger::Helper(QsLogging::FatalLevel).stream() << __FILE__ << '@' << __LINE__
#endif
#ifdef QS_LOG_DISABLE
#include "QsLogDisableForThisFile.h"
#endif
#endif // QSLOG_H

View File

@ -0,0 +1,99 @@
// Copyright (c) 2013, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSLOGDEST_H
#define QSLOGDEST_H
#include "QsLogLevel.h"
#include <QSharedPointer>
#include <QtGlobal>
class QString;
class QObject;
#ifdef QSLOG_IS_SHARED_LIBRARY
#define QSLOG_SHARED_OBJECT Q_DECL_EXPORT
#elif QSLOG_IS_SHARED_LIBRARY_IMPORT
#define QSLOG_SHARED_OBJECT Q_DECL_IMPORT
#else
#define QSLOG_SHARED_OBJECT
#endif
namespace QsLogging
{
class QSLOG_SHARED_OBJECT Destination
{
public:
typedef void (*LogFunction)(const QString &message, Level level);
public:
virtual ~Destination();
virtual void write(const QString& message, Level level) = 0;
virtual bool isValid() = 0; // returns whether the destination was created correctly
};
typedef QSharedPointer<Destination> DestinationPtr;
// a series of "named" paramaters, to make the file destination creation more readable
enum LogRotationOption
{
DisableLogRotation = 0,
EnableLogRotation = 1
};
struct QSLOG_SHARED_OBJECT MaxSizeBytes
{
MaxSizeBytes() : size(0) {}
explicit MaxSizeBytes(qint64 size_) : size(size_) {}
qint64 size;
};
struct QSLOG_SHARED_OBJECT MaxOldLogCount
{
MaxOldLogCount() : count(0) {}
explicit MaxOldLogCount(int count_) : count(count_) {}
int count;
};
//! Creates logging destinations/sinks. The caller shares ownership of the destinations with the logger.
//! After being added to a logger, the caller can discard the pointers.
class QSLOG_SHARED_OBJECT DestinationFactory
{
public:
static DestinationPtr MakeFileDestination(const QString& filePath,
LogRotationOption rotation = DisableLogRotation,
const MaxSizeBytes &sizeInBytesToRotateAfter = MaxSizeBytes(),
const MaxOldLogCount &oldLogsToKeep = MaxOldLogCount());
static DestinationPtr MakeDebugOutputDestination();
// takes a pointer to a function
static DestinationPtr MakeFunctorDestination(Destination::LogFunction f);
// takes a QObject + signal/slot
static DestinationPtr MakeFunctorDestination(QObject *receiver, const char *member);
};
} // end namespace
#endif // QSLOGDEST_H

View File

@ -0,0 +1,52 @@
// Copyright (c) 2013, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSLOGDESTCONSOLE_H
#define QSLOGDESTCONSOLE_H
#include "QsLogDest.h"
class QString;
class QsDebugOutput
{
public:
static void output(const QString& a_message);
};
namespace QsLogging
{
// debugger sink
class DebugOutputDestination : public Destination
{
public:
virtual void write(const QString& message, Level level);
virtual bool isValid();
};
}
#endif // QSLOGDESTCONSOLE_H

View File

@ -0,0 +1,101 @@
// Copyright (c) 2013, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSLOGDESTFILE_H
#define QSLOGDESTFILE_H
#include "QsLogDest.h"
#include <QFile>
#include <QTextStream>
#include <QtGlobal>
#include <QSharedPointer>
namespace QsLogging
{
class RotationStrategy
{
public:
virtual ~RotationStrategy();
virtual void setInitialInfo(const QFile &file) = 0;
virtual void includeMessageInCalculation(const QString &message) = 0;
virtual bool shouldRotate() = 0;
virtual void rotate() = 0;
virtual QIODevice::OpenMode recommendedOpenModeFlag() = 0;
};
// Never rotates file, overwrites existing file.
class NullRotationStrategy : public RotationStrategy
{
public:
virtual void setInitialInfo(const QFile &) {}
virtual void includeMessageInCalculation(const QString &) {}
virtual bool shouldRotate() { return false; }
virtual void rotate() {}
virtual QIODevice::OpenMode recommendedOpenModeFlag() { return QIODevice::Truncate; }
};
// Rotates after a size is reached, keeps a number of <= 10 backups, appends to existing file.
class SizeRotationStrategy : public RotationStrategy
{
public:
SizeRotationStrategy();
static const int MaxBackupCount;
virtual void setInitialInfo(const QFile &file);
virtual void includeMessageInCalculation(const QString &message);
virtual bool shouldRotate();
virtual void rotate();
virtual QIODevice::OpenMode recommendedOpenModeFlag();
void setMaximumSizeInBytes(qint64 size);
void setBackupCount(int backups);
private:
QString mFileName;
qint64 mCurrentSizeInBytes;
qint64 mMaxSizeInBytes;
int mBackupsCount;
};
typedef QSharedPointer<RotationStrategy> RotationStrategyPtr;
// file message sink
class FileDestination : public Destination
{
public:
FileDestination(const QString& filePath, RotationStrategyPtr rotationStrategy);
virtual void write(const QString& message, Level level);
virtual bool isValid();
private:
QFile mFile;
QTextStream mOutputStream;
QSharedPointer<RotationStrategy> mRotationStrategy;
};
}
#endif // QSLOGDESTFILE_H

View File

@ -0,0 +1,59 @@
// Copyright (c) 2014, Razvan Petru
// Copyright (c) 2014, Omar Carey
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSLOGDESTFUNCTOR_H
#define QSLOGDESTFUNCTOR_H
#include "QsLogDest.h"
#include <QObject>
namespace QsLogging
{
// Offers various types of function-like sinks.
// This is an advanced destination type. Depending on your configuration, LogFunction might be
// called from a different thread or even a different binary. You should not access QsLog from
// inside LogFunction and should not perform any time-consuming operations.
// logMessageReady is connected through a queued connection and trace messages are not included
class FunctorDestination : public QObject, public Destination
{
Q_OBJECT
public:
explicit FunctorDestination(LogFunction f);
FunctorDestination(QObject *receiver, const char *member);
virtual void write(const QString &message, Level level);
virtual bool isValid();
protected:
// int used to avoid registering a new enum type
Q_SIGNAL void logMessageReady(const QString &message, int level);
private:
LogFunction mLogFunction;
};
}
#endif // QSLOGDESTFUNCTOR_H

View File

@ -0,0 +1,22 @@
#ifndef QSLOGDISABLEFORTHISFILE_H
#define QSLOGDISABLEFORTHISFILE_H
#include <QtDebug>
// When included AFTER QsLog.h, this file will disable logging in that C++ file. When included
// before, it will lead to compiler warnings or errors about macro redefinitions.
#undef QLOG_TRACE
#undef QLOG_DEBUG
#undef QLOG_INFO
#undef QLOG_WARN
#undef QLOG_ERROR
#undef QLOG_FATAL
#define QLOG_TRACE() if (1) {} else qDebug()
#define QLOG_DEBUG() if (1) {} else qDebug()
#define QLOG_INFO() if (1) {} else qDebug()
#define QLOG_WARN() if (1) {} else qDebug()
#define QLOG_ERROR() if (1) {} else qDebug()
#define QLOG_FATAL() if (1) {} else qDebug()
#endif // QSLOGDISABLEFORTHISFILE_H

View File

@ -0,0 +1,45 @@
// Copyright (c) 2013, Razvan Petru
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
// * The name of the contributors may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSLOGLEVEL_H
#define QSLOGLEVEL_H
namespace QsLogging
{
enum Level
{
TraceLevel = 0,
DebugLevel,
InfoLevel,
WarnLevel,
ErrorLevel,
FatalLevel,
OffLevel
};
}
#endif // QSLOGLEVEL_H

View File

@ -0,0 +1,40 @@
#ifndef QSLOG_MANAGE_H
#define QSLOG_MANAGE_H
#include "QsLog.h"
#include <QCoreApplication>
#include <QDir>
#include <QProcessEnvironment>
#include <QString>
namespace QsLogManage {
using namespace QsLogging;
static void createLogger()
{
Logger& logger = Logger::instance();
logger.setLoggingLevel(TraceLevel);
QString logs_dir = QDir(qApp->applicationDirPath()).filePath("logs");
QDir logsDir(logs_dir);
if (!logsDir.exists()) {
logsDir.mkdir(logs_dir);
}
QString logFileName = QCoreApplication::applicationName() + QString(".log");
QString logFilePath = logsDir.filePath(logFileName);
MaxSizeBytes maxSize(1024 * 1024 * 10);
MaxOldLogCount count(10);
DestinationPtr fileDestination = DestinationFactory::MakeFileDestination(logFilePath, EnableLogRotation, maxSize, count);
logger.addDestination(fileDestination);
DestinationPtr debugDestination(QsLogging::DestinationFactory::MakeDebugOutputDestination());
logger.addDestination(debugDestination);
}
static void destoryLogger()
{
Logger::instance().destroyInstance();
}
}
#endif // QSLOG_MANAGE_H

BIN
3rdlib/QsLog/lib/QsLog2.lib Normal file

Binary file not shown.

Binary file not shown.

1199
3rdlib/csv/csv.h Normal file

File diff suppressed because it is too large Load Diff

8486
3rdlib/csv/csv.hpp Normal file

File diff suppressed because it is too large Load Diff

2
3rdlib/csv/csv.pri Normal file
View File

@ -0,0 +1,2 @@
INCLUDEPATH += $${PWD}
DEPENDPATH += $${PWD}

18
Common.pri Normal file
View File

@ -0,0 +1,18 @@
# 项目公共引入文件
# 项目工程目录
PROJECT_DIR = $${PWD}
# 可执行文件目录
BUILD_BIN = $${PROJECT_DIR}/bin
# 扩展插件目录
BUILD_PLUGINS = $${PROJECT_DIR}/plugins
# 链接库目录
BUILD_LIB = $${PROJECT_DIR}/lib
# 临时生成文件目录
BUILD_TMP = $${PROJECT_DIR}/tmp
BUILD_MOC = $${BUILD_TMP}
BUILD_OBJ = $${BUILD_TMP}
BUILD_RCC = $${BUILD_TMP}
BUILD_UI = $${BUILD_TMP}

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \
src
OTHER_FILES += \
$${PWD}/Common.pri

View File

@ -0,0 +1,259 @@
#include "MeasureDeviceController.h"
#include "DeviceManage.h"
#include "QsLog.h"
#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <QRegExp>
typedef int* DeviceHandler;
static sDeviceList s_device_list;
static DeviceHandler GetDeviceHandler(const QString &device_guid) {
DeviceHandler device_handler = DeviceHandler(0x01); // nullptr;
for (int i = 0; i < s_device_list.totalNum; i++) {
sDeviceInfo di;
int ret = GetDeviceInfo(s_device_list.pHandle[i], &di,-1,-1);
if (ret == 0) {
if (QString(di.MacAddr) == device_guid) {
device_handler = s_device_list.pHandle[i];
}
} else {
QLOG_ERROR() << QStringLiteral(u"处理查找测量设备结果信息失败: GetDeviceInfo调用失败索引%1 [%2]").arg(i).arg(ret);
}
}
return device_handler;
}
MeasureDeviceController::InitFinishedHandler MeasureDeviceController::s_init_finished_handler = nullptr;
MeasureDeviceController* MeasureDeviceController::_s_instance = nullptr;
MeasureDeviceController::MeasureDeviceController(QObject *parent)
: QObject{parent}
{
}
MeasureDeviceController *MeasureDeviceController::Instance()
{
if (!_s_instance) {
_s_instance = new MeasureDeviceController();
}
return _s_instance;
}
MeasureDeviceController::~MeasureDeviceController()
{
}
void MeasureDeviceController::InitFindMeasureDevice()
{
sFindDeviceConfig fdc;
fdc.useDHCP = false;
fdc.USB20Enable = false;
fdc.USB30Enable = true;
fdc.ETHEnable = FALSE;
fdc.COMEnable = true;
int ret = FindDeviceAsync(&fdc, onFindDeviceFinishedCallback);
if (ret != 1) {
QLOG_ERROR() << QStringLiteral(u"调用查找测量设备失败:[返回代码%1]").arg(ret);
}
}
void MeasureDeviceController::DisconnectMeasureDevice(const QString &device_guid)
{
DeviceHandler device_handler = GetDeviceHandler(device_guid);
if (!device_handler) {
return;
}
int ret = CloseDevice(device_handler);
if (ret != 1) {
QLOG_ERROR() << QStringLiteral(u"断开测量设备失败:[返回代码%1]").arg(ret);
}
}
void MeasureDeviceController::onFindDeviceFinishedCallback(int ret, sDeviceList* pDeviceList)
{
bool init_ok = true;
if (ret == 0) {
s_device_list = *pDeviceList;
if ( s_device_list.totalNum == 0 ) {
init_ok &= false;
QLOG_WARN() << QStringLiteral(u"未找到测量设备!");
} else {
QLOG_DEBUG() << s_device_list.totalNum << GetMeasureDeviceList();
}
} else {
init_ok &= false;
QLOG_ERROR() << QStringLiteral(u"查找测量设备失败:[返回代码%1]").arg(ret);
}
s_init_finished_handler(init_ok);
}
void MeasureDeviceController::SetInitFinishedHandler(InitFinishedHandler handler)
{
s_init_finished_handler = handler;
}
QStringList MeasureDeviceController::GetMeasureDeviceList()
{
QStringList device_guid_list;
for (int i = 0; i < s_device_list.totalNum; i++) {
sDeviceInfo di;
int ret = GetDeviceInfo(s_device_list.pHandle[i], &di, 0, 1);
if (ret == 0) {
device_guid_list.append(QString(di.MacAddr));
} else {
QLOG_ERROR() << QStringLiteral(u"处理查找测量设备结果信息失败: GetDeviceInfo调用失败索引%1,[返回代码%2]").arg(i).arg(ret);
}
}
return device_guid_list;
}
bool MeasureDeviceController::SetDeviceMeasureConfigParams(const QString &device_guid, int board_id, int channel_id, const QVariantMap &cfg_params)
{
bool ok = true;
DeviceHandler device_handler = GetDeviceHandler(device_guid);
if (!device_handler) {
ok = false;
return ok;
}
OneChannelConfigInfo config;
int ret = GetDeviceBoardChannelConfiginfo(device_handler, &config, board_id, channel_id);
if (ret != 0) {
QLOG_ERROR() << QStringLiteral(u"板卡%1通道%2获取参数配置失败:返回代码[%3]").arg(board_id).arg(channel_id).arg(ret);
ok = false;
return ok;
}
config.m_eTransferModel = eTransferMode(cfg_params.value("TransferMode", 3).toInt());
config.m_iDeviceGain = cfg_params.value("DeviceGain", 1).toInt();
config.m_iDeviceGainSelectIndex = cfg_params.value("DeviceGainSelectIndex", 1).toInt();
config.m_iSoftGain = cfg_params.value("SoftGain", 10000000).toInt();
config.m_iChannelNum = cfg_params.value("AddrCount", 4096).toInt();
config.m_dConstTime = cfg_params.value("TimeConst", 1).toDouble();
config.m_iCurrentOffset = cfg_params.value("DcOffset", 0).toInt();
config.m_iFormTime = cfg_params.value("FormTime", 2).toInt();
config.m_iFastChannelTrigerValue = cfg_params.value("FastChannelTrigerValue", 100).toDouble();
config.m_iCRDivMode = cfg_params.value("CRDivMode", 0).toInt();
config.m_iInputSignalPostive = cfg_params.value("InputSignalPostive", 0).toInt();
memset(config.reserve, 0, 128);
ret = DBCSoftParamConfig(device_handler, &config, board_id, channel_id);
if (ret == 0) {
QLOG_INFO() << QStringLiteral(u"板卡%1通道%2启动测量成功:返回代码[%3]").arg(board_id).arg(channel_id).arg(ret);
} else {
QLOG_ERROR() << QStringLiteral(u"板卡%1通道%2启动测量失败:返回代码[%3]").arg(board_id).arg(channel_id).arg(ret);
ok = false;
return ok;
}
return ok;
}
bool MeasureDeviceController::StartMeasure(const QString& device_guid, int board_id, int channel_id)
{
bool ok = true;
DeviceHandler device_handler = GetDeviceHandler(device_guid);
if (!device_handler) {
ok = false;
return ok;
}
int ret = DBCStartMeasure(device_handler, board_id, channel_id);
if (ret == 0) {
QLOG_INFO() << QStringLiteral(u"板卡%1通道%2启动测量成功:返回代码[%3]").arg(board_id).arg(channel_id).arg(ret);
} else {
QLOG_ERROR() << QStringLiteral(u"板卡%1通道%2启动测量失败:返回代码[%3]").arg(board_id).arg(channel_id).arg(ret);
ok = false;
return ok;
}
_measure_start_time = QDateTime::currentDateTime();
return ok;
}
bool MeasureDeviceController::StopMeasure(const QString& device_guid, int board_id, int channel_id)
{
bool ok = true;
DeviceHandler device_handler = GetDeviceHandler(device_guid);
if (!device_handler) {
ok = false;
return ok;
}
int ret = DBCStopMeasure(device_handler, board_id, channel_id);
if (ret == 0) {
QLOG_INFO() << QStringLiteral(u"板卡%1通道%2停止测量成功:返回代码[%3]").arg(board_id).arg(channel_id).arg(ret);
} else {
QLOG_ERROR() << QStringLiteral(u"板卡%1通道%2停止测量失败:返回代码[%3]").arg(board_id).arg(channel_id).arg(ret);
ok = false;
return ok;
}
return ok;
}
bool MeasureDeviceController::StopMeasure(const QString &device_guid)
{
bool ok = true;
DeviceHandler device_handler = GetDeviceHandler(device_guid);
if (!device_handler) {
ok = false;
return ok;
}
int board_count = GetDeviceBoardTotalNum(device_handler);
for (int board_id = 0; board_id < board_count; ++board_id) {
int _board_channel_count = GetDeviceChTotalNum(device_handler, board_id);
for (int channel_id = 0; channel_id < _board_channel_count; ++channel_id) {
DBCStopMeasure(device_handler, board_id, channel_id);
}
}
return ok;
}
bool MeasureDeviceController::ClearData(const QString &device_guid)
{
bool ok = true;
DeviceHandler device_handler = GetDeviceHandler(device_guid);
if (!device_handler) {
ok = false;
return ok;
}
int board_count = GetDeviceBoardTotalNum(device_handler);
for (int board_id = 0; board_id < board_count; ++board_id) {
int _board_channel_count = GetDeviceChTotalNum(device_handler, board_id);
for (int channel_id = 0; channel_id < _board_channel_count; ++channel_id) {
int ret = DBCClearData(device_handler, board_id, channel_id);
if (ret != 0) {
QLOG_ERROR() << QStringLiteral(u"板卡%1通道%2清理数据失败:返回代码[%3]").arg(board_id).arg(channel_id).arg(ret);
ok &= false;
}
}
}
return ok;
}
bool MeasureDeviceController::GetData(const QString &device_guid, int board_id, int channel_id)
{
bool ok = false;
return ok;
}
QString MeasureDeviceController::GetMeasureGvfDataFilename()
{
QString measure_gvf_data_filename;
QDir measure_gvf_data_dir(QDir(qApp->applicationDirPath()).filePath("HistoryData"));
if (!measure_gvf_data_dir.exists()) {
return QString();
}
QList<QString> gvf_file_list = measure_gvf_data_dir.entryList(QDir::Files|QDir::NoSymLinks|QDir::NoDotAndDotDot, QDir::Time);
foreach (const QString& gvf_filename , gvf_file_list) {
QFileInfo measure_gvf_data_file_info(measure_gvf_data_dir.filePath(gvf_filename));
if (measure_gvf_data_file_info.exists()) {
if ( measure_gvf_data_file_info.suffix() != QString("gvf") )
continue;
QString measure_gvf_datetime_str = measure_gvf_data_file_info.baseName().remove("GVHD__");
QDateTime data_time = QDateTime::fromString(measure_gvf_datetime_str, "yyyy_MM_dd_hh_mm_ss_zzz");
if ( qAbs(_measure_start_time.toMSecsSinceEpoch() - data_time.toMSecsSinceEpoch()) < (1000 * 10) ) {
measure_gvf_data_filename = measure_gvf_data_file_info.absoluteFilePath();
}
}
}
return measure_gvf_data_filename;
}

View File

@ -0,0 +1,46 @@
#ifndef MEASUREDEVICECONTROLLER_H
#define MEASUREDEVICECONTROLLER_H
#include <QObject>
#include <QStringList>
#include <QDateTime>
#include <functional>
class sDeviceList;
class MeasureDeviceController : public QObject
{
Q_OBJECT
public:
typedef std::function<void(bool)> InitFinishedHandler;
private:
explicit MeasureDeviceController(QObject *parent = nullptr);
static MeasureDeviceController* _s_instance;
public:
static MeasureDeviceController* Instance();
virtual ~MeasureDeviceController();
void InitFindMeasureDevice();
void DisconnectMeasureDevice(const QString &device_guid);
bool SetDeviceMeasureConfigParams(const QString& device_guid, int board_id, int channel_id, const QVariantMap &cfg_params);
bool StartMeasure(const QString& device_guid, int board_id, int channel_id);
bool StopMeasure(const QString& device_guid, int board_id, int channel_id);
bool StopMeasure(const QString& device_guid);
bool ClearData(const QString& device_guid);
bool GetData(const QString& device_guid, int board_id, int channel_id);
QString GetMeasureGvfDataFilename();
static QStringList GetMeasureDeviceList();
public:
static void onFindDeviceFinishedCallback(int ret, sDeviceList* pDeviceList);
void SetInitFinishedHandler(InitFinishedHandler handler);
private:
static InitFinishedHandler s_init_finished_handler;
private:
QDateTime _measure_start_time;
};
#endif // MEASUREDEVICECONTROLLER_H

111
src/MeasureServer.cpp Normal file
View File

@ -0,0 +1,111 @@
#include "MeasureServer.h"
#include "QsLogManage.h"
#include "MeasureDeviceController.h"
#include "MeasureServiceProtocol.h"
#include "RequstDataProcesser.h"
#include <QDataStream>
#include <QFileInfo>
#include <QHostAddress>
#include <QString>
#include <QThread>
#include <QDebug>
MeasureServer::MeasureServer(QObject *parent)
: QTcpServer(parent)
{
}
bool MeasureServer::Start(quint16 port)
{
return this->listen(QHostAddress::LocalHost, port);
}
void MeasureServer::Stop()
{
this->close();
}
void MeasureServer::incomingConnection(qintptr socket_descriptor)
{
QLOG_INFO() << QStringLiteral(u"接收到新的请求连接") << socket_descriptor;
MeasureSession * measure_thread = new MeasureSession(socket_descriptor, this);
connect(measure_thread, &MeasureSession::finished, measure_thread, &MeasureSession::deleteLater);
measure_thread->start();
}
MeasureSession::MeasureSession(int socket_descriptor, QObject* parent)
: QThread(parent)
, _socket_descriptor(socket_descriptor)
, _tcp_socket(nullptr)
, _requst_buffer(new QByteArray)
, _requst_data_len(0)
{
}
MeasureSession::~MeasureSession()
{
QLOG_DEBUG() << QStringLiteral(u"~MeasureSession");
}
void MeasureSession::run()
{
// 在子线程中创建套接字(关键:必须在当前线程创建)
_tcp_socket = new RequstDataProcesser;
// 设置客户端套接字描述符(绑定连接)
if (!_tcp_socket->setSocketDescriptor(_socket_descriptor)) {
QLOG_ERROR() << QStringLiteral(u"套接字初始化失败:") << _tcp_socket->errorString();
return;
}
QLOG_INFO() << QStringLiteral(u"新客户端接入:") << _tcp_socket->peerAddress().toString()
<< QStringLiteral(u"端口:") << _tcp_socket->peerPort()
<< QStringLiteral(u"线程ID:") << QThread::currentThreadId();
// 绑定信号槽(长连接核心:持续监听数据/断开)
connect(_tcp_socket, &QTcpSocket::readyRead, this, &MeasureSession::onClientRequstData, Qt::DirectConnection);
connect(_tcp_socket, &QTcpSocket::disconnected, this, &MeasureSession::onClientDisconnected, Qt::DirectConnection);
connect(_tcp_socket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error), this, &MeasureSession::onSocketError, Qt::DirectConnection);
// 开启线程事件循环(保持长连接,不退出线程)
exec();
// 线程退出后清理资源
_tcp_socket->close();
_tcp_socket->deleteLater();
}
void MeasureSession::onClientRequstData()
{
_requst_buffer->append(_tcp_socket->readAll());
while (true) {
// 读头
if (_requst_data_len == 0) {
if (_requst_buffer->size() < Protocol::HEAD_SIZE)
break;
QByteArray head = _requst_buffer->left(Protocol::HEAD_SIZE);
_requst_data_len = Protocol::UnpackDataLen(head);
_requst_buffer->remove(0, Protocol::HEAD_SIZE);
}
// 读满完整数据
if (_requst_buffer->size() >= _requst_data_len) {
QByteArray requst_data = _requst_buffer->left(_requst_data_len);
_requst_buffer->remove(0, _requst_data_len);
QLOG_INFO() << QStringLiteral(u"接收请求数据长度%1").arg(requst_data.size());
QThread* process_thread = QThread::create(&RequstDataProcesser::ProcessRequstData, _tcp_socket, requst_data);
connect(process_thread, &QThread::finished, process_thread, &QThread::deleteLater);
process_thread->start();
_requst_data_len = 0;
} else {
break;
}
}
}
void MeasureSession::onClientDisconnected()
{
QLOG_INFO() << QStringLiteral(u"客户端%1断开连接").arg(_tcp_socket->peerAddress().toString());
quit();
}
void MeasureSession::onSocketError(QAbstractSocket::SocketError error)
{
Q_UNUSED(error);
QLOG_INFO() << QStringLiteral(u"套接字错误:").arg(_tcp_socket->errorString());
quit();
}

47
src/MeasureServer.h Normal file
View File

@ -0,0 +1,47 @@
#ifndef MEASURESERVER_H
#define MEASURESERVER_H
#include <QStringList>
#include <QTcpServer>
#include <QTcpSocket>
#include <QThread>
class RequstDataProcesser;
class MeasureServer : public QTcpServer
{
Q_OBJECT
public:
MeasureServer(QObject *parent = nullptr);
bool Start(quint16 port = 9999);
void Stop();
protected:
void incomingConnection(qintptr socket_descriptor) override;
};
class MeasureSession : public QThread
{
Q_OBJECT
public:
MeasureSession(int socket_descriptor, QObject *parent = nullptr);
virtual ~MeasureSession();
void run() override;
private slots:
void onClientRequstData();
void onClientDisconnected();
void onSocketError(QAbstractSocket::SocketError error);
private:
int _socket_descriptor;
RequstDataProcesser * _tcp_socket;
QByteArray * _requst_buffer;
qint32 _requst_data_len;
};
#endif

View File

@ -0,0 +1,34 @@
#ifndef MEASURESERVICEPROTOCOL_H
#define MEASURESERVICEPROTOCOL_H
#include <QByteArray>
namespace Protocol {
// 固定协议头长度8字节
const int HEAD_SIZE = 8;
// 打包数据:添加长度头
inline QByteArray PackData(const QByteArray &data) {
QByteArray buffer;
buffer.resize(HEAD_SIZE);
// 前4字节 = 数据总长度
qint32 data_len = data.size();
memcpy(buffer.data(), &data_len, 4);
// 后4字节保留
qint32 reserve = 0xFFFFFFFF;
memcpy(buffer.data() + 4, &reserve, 4);
buffer.append(data);
return buffer;
}
// 解包:从头部获取数据长度
inline qint32 UnpackDataLen(const QByteArray &head) {
if (head.size() < HEAD_SIZE)
return 0;
qint32 len = 0;
memcpy(&len, head.constData(), 4);
return len;
}
}
#endif // MEASURESERVICEPROTOCOL_H

220
src/RequstDataProcesser.cpp Normal file
View File

@ -0,0 +1,220 @@
#include "RequstDataProcesser.h"
#include "QsLogManage.h"
#include "MeasureDeviceController.h"
#include "MeasureServiceProtocol.h"
#include <QThread>
#include <QJsonDocument>
#include <QJsonObject>
#include <QDataStream>
#include "SyncGvfFileDataTask.h"
RequstDataProcesser::RequstDataProcesser(QObject *parent)
: QTcpSocket{parent}
{
sync_gvf_data_task = new SyncGvfFileDataTask(this);
connect(sync_gvf_data_task, &SyncGvfFileDataTask::syncGvfData, this, &RequstDataProcesser::OnReplayClient/*, Qt::QueuedConnection*/);
connect(this, &RequstDataProcesser::stopSyncGvfFileDataTask, sync_gvf_data_task, &SyncGvfFileDataTask::OnStop);
}
RequstDataProcesser::~RequstDataProcesser()
{
QLOG_DEBUG() << QStringLiteral(u"~RequstDataProcesser");
}
void RequstDataProcesser::OnReplayClient(const QByteArray& replay_data)
{
if (!this->isOpen()) {
QLOG_WARN() << QStringLiteral(u"未连接,发送失败");
return;
}
QByteArray replay_buf = Protocol::PackData(replay_data);
this->write(replay_buf);
this->flush();
QLOG_DEBUG() << QStringLiteral(u"发送数据大小: %1 字节").arg(replay_buf.size());
}
void RequstDataProcesser::ProcessRequstData(const QByteArray& requst_data)
{
QDataStream requst_data_stream(requst_data);
QString cmd_type, device_guid, cmd_data;
requst_data_stream >> cmd_type >> device_guid;
if (cmd_type == "START") {
requst_data_stream >> cmd_data;
QLOG_INFO() << QStringLiteral(u"处理请求:") << cmd_type << device_guid << cmd_data;
processStartMeasureCmd(device_guid, cmd_data);
} else if (cmd_type == "STOP") {
QLOG_INFO() << QStringLiteral(u"处理请求:") << cmd_type << device_guid;
processStopMeasureCmd(device_guid);
} else if (cmd_type == "SET") {
requst_data_stream >> cmd_data;
QLOG_INFO() << QStringLiteral(u"处理请求:") << cmd_type << device_guid << cmd_data;
processSetDeviceMeasureConfigParamsCmd(device_guid, cmd_data);
} else if (cmd_type == "CLEAR") {
QLOG_INFO() << QStringLiteral(u"处理请求:") << cmd_type << device_guid;
processClearDataCmd(device_guid);
} else if (cmd_type == "DEVICE") {
QLOG_INFO() << QStringLiteral(u"处理请求:") << cmd_type << device_guid;
processGetMeasureDeviceListCmd();
} else {
QByteArray replay_data;
QDataStream replay_data_stream(&replay_data, QIODevice::Append);
replay_data_stream << QString("UNKNOW") << false << QStringLiteral(u"未知请求");
QMetaObject::invokeMethod(this, "OnReplayClient", Qt::QueuedConnection, Q_ARG(QByteArray, replay_data));
}
}
void RequstDataProcesser::processStartMeasureCmd(const QString& device_guid, const QString& cmd_data)
{
QByteArray json_data = cmd_data.toUtf8();
QJsonDocument json_doc = QJsonDocument::fromJson(json_data);
if (json_doc.isNull()) {
return;
}
if (!json_doc.isObject()) {
return;
}
QVariantMap device_config_info = json_doc.object().toVariantMap();
if (!device_config_info.contains(QStringLiteral(u"ChannelConfig"))) {
return;
}
QVariantList channel_config_list = device_config_info[QStringLiteral(u"ChannelConfig")].toList();
if (channel_config_list.isEmpty()) {
return;
}
QStringList errors;
for (auto channel_config : channel_config_list) {
if (!channel_config.isValid())
continue;
QVariantMap channel_config_info = channel_config.toMap();
if (!channel_config_info.contains("BoardId") || !channel_config_info.contains("ChannelId"))
continue;
int board_id = channel_config_info["BoardId"].toInt();
int channel_id = channel_config_info["ChannelId"].toInt();
if (!MeasureDeviceController::Instance()->SetDeviceMeasureConfigParams(device_guid, board_id, channel_id, channel_config_info)) {
const QString error = QStringLiteral(u"启动设置板卡%1通道%2测量参数失败").arg(board_id).arg(channel_id);
errors.append(error);
}
QThread::msleep(100);
}
for (auto channel_config : channel_config_list) {
if (!channel_config.isValid())
continue;
QVariantMap channel_config_info = channel_config.toMap();
if (!channel_config_info.contains("BoardId") || !channel_config_info.contains("ChannelId"))
continue;
int board_id = channel_config_info["BoardId"].toInt();
int channel_id = channel_config_info["ChannelId"].toInt();
if (!MeasureDeviceController::Instance()->StartMeasure(device_guid, board_id, channel_id)) {
const QString error = QStringLiteral(u"启动板卡%1通道%2测量失败").arg(board_id).arg(channel_id);
errors.append(error);
}
QThread::msleep(100);
}
QByteArray replay_data;
QDataStream replay_data_stream(&replay_data, QIODevice::Append);
if (!errors.isEmpty()) {
replay_data_stream << QString("START") << false << errors.join("\n");
QMetaObject::invokeMethod(this, "OnReplayClient", Qt::QueuedConnection, Q_ARG(QByteArray, replay_data));
} else {
const QString& measure_data_gvf_filename = MeasureDeviceController::Instance()->GetMeasureGvfDataFilename();
QString replay_info;
bool ok = measure_data_gvf_filename.isEmpty();
if (!ok) {
replay_info = QStringLiteral(u"测量数据GVF文件未找到");
} else {
replay_info = measure_data_gvf_filename;
sync_gvf_data_task->SetGvfFilename(measure_data_gvf_filename);
sync_gvf_data_task->start();
}
QByteArray replay_data;
QDataStream replay_data_stream(&replay_data, QIODevice::Append);
replay_data_stream << QString("START") << ok << replay_info;
QMetaObject::invokeMethod(this, "OnReplayClient", Qt::QueuedConnection, Q_ARG(QByteArray, replay_data));
}
sync_gvf_data_task->SetGvfFilename("D:/Workspace/EnergySpectrumAnalyerProject/TestData/GVHD__2025_10_16_16_00_39_653.gvf");
sync_gvf_data_task->start();
}
void RequstDataProcesser::processStopMeasureCmd(const QString& device_guid)
{
MeasureDeviceController::Instance()->StopMeasure(device_guid);
emit stopSyncGvfFileDataTask();
QByteArray replay_data;
QDataStream replay_data_stream(&replay_data, QIODevice::Append);
replay_data_stream << QString("STOP") << true << QStringLiteral(u"停止测量完成");
QMetaObject::invokeMethod(this, "OnReplayClient", Qt::QueuedConnection, Q_ARG(QByteArray, replay_data));
}
void RequstDataProcesser::processSetDeviceMeasureConfigParamsCmd(const QString& device_guid, const QString& cmd_data)
{
QByteArray json_data = cmd_data.toUtf8();
QJsonDocument json_doc = QJsonDocument::fromJson(json_data);
if (json_doc.isNull()) {
return;
}
if (!json_doc.isObject()) {
return;
}
QVariantMap device_config_info = json_doc.object().toVariantMap();
if (!device_config_info.contains(QStringLiteral(u"ChannelConfig"))) {
return;
}
QVariantList channel_config_list = device_config_info[QStringLiteral(u"ChannelConfig")].toList();
if (channel_config_list.isEmpty()) {
return;
}
QStringList errors;
for (auto channel_config : channel_config_list) {
if (!channel_config.isValid())
continue;
QVariantMap channel_config_info = channel_config.toMap();
if (!channel_config_info.contains("BoardId") || !channel_config_info.contains("ChannelId"))
continue;
int board_id = channel_config_info["BoardId"].toInt();
int channel_id = channel_config_info["ChannelId"].toInt();
if (!MeasureDeviceController::Instance()->SetDeviceMeasureConfigParams(device_guid, board_id, channel_id, channel_config_info)) {
const QString error = QStringLiteral(u"设置板卡%1通道%2测量参数失败").arg(board_id).arg(channel_id);
errors.append(error);
}
QThread::msleep(100);
}
QByteArray replay_data;
QDataStream replay_data_stream(&replay_data, QIODevice::Append);
bool ok = !errors.isEmpty();
if (!ok) {
replay_data_stream << QString("SET") << ok << errors.join("\n");
} else {
replay_data_stream << QString("SET") << ok << QStringLiteral(u"设置测量参数完成");
}
QMetaObject::invokeMethod(this, "OnReplayClient", Qt::QueuedConnection, Q_ARG(QByteArray, replay_data));
}
void RequstDataProcesser::processClearDataCmd(const QString& device_guid)
{
MeasureDeviceController::Instance()->ClearData(device_guid);
QByteArray replay_data;
QDataStream replay_data_stream(&replay_data, QIODevice::Append);
replay_data_stream << QString("CLEAR") << true << QStringLiteral(u"清除数据完成");
QMetaObject::invokeMethod(this, "OnReplayClient", Qt::QueuedConnection, Q_ARG(QByteArray, replay_data));
}
void RequstDataProcesser::processGetMeasureDeviceListCmd()
{
QStringList device_list = MeasureDeviceController::Instance()->GetMeasureDeviceList();
bool ok = !device_list.isEmpty();
QByteArray replay_data;
QDataStream replay_data_stream(&replay_data, QIODevice::Append);
replay_data_stream << QString("DEVICE");
if (ok) {
replay_data_stream << ok << device_list.size();
foreach (const QString& device_id, device_list) {
replay_data_stream << device_id;
}
} else {
replay_data_stream << ok << QStringLiteral(u"测量设备未找到");
}
QMetaObject::invokeMethod(this, "OnReplayClient", Qt::QueuedConnection, Q_ARG(QByteArray, replay_data));
}

35
src/RequstDataProcesser.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef REQUSTDATAPROCESSER_H
#define REQUSTDATAPROCESSER_H
#include <QObject>
#include <QTcpSocket>
class SyncGvfFileDataTask;
class RequstDataProcesser : public QTcpSocket
{
Q_OBJECT
public:
explicit RequstDataProcesser(QObject *parent = nullptr);
virtual ~RequstDataProcesser();
void ProcessRequstData(const QByteArray& requst_data);
public slots:
void OnReplayClient(const QByteArray& replay_data);
signals:
void stopSyncGvfFileDataTask();
private:
void processStartMeasureCmd(const QString& device_guid, const QString& cmd_data);
void processStopMeasureCmd(const QString& device_guid);
void processSetDeviceMeasureConfigParamsCmd(const QString& device_guid, const QString& cmd_data);
void processClearDataCmd( const QString& device_guid);
void processGetMeasureDeviceListCmd();
private:
SyncGvfFileDataTask* sync_gvf_data_task;
};
#endif // REQUSTDATAPROCESSER_H

View File

@ -0,0 +1,89 @@
#include "SyncGvfFileDataTask.h"
#include "QsLogManage.h"
#include <QByteArray>
#include <QDataStream>
#include <QDateTime>
#include <QFileInfo>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
SyncGvfFileDataTask::SyncGvfFileDataTask(QObject *parent)
: QThread{parent}, _b_stop(true)
{
}
SyncGvfFileDataTask::~SyncGvfFileDataTask()
{
_b_stop = true;
if ( this->isRunning() )
this->wait(3000);
QLOG_DEBUG() << QStringLiteral(u"~SyncGvfFileDataTask()");
}
void SyncGvfFileDataTask::SetGvfFilename(const QString &gvf_filename)
{
_gvf_filename = gvf_filename;
}
void SyncGvfFileDataTask::run()
{
if (_gvf_filename.isEmpty()) {
QLOG_WARN() << QStringLiteral(u"没有GVF测量数据文件");
return;
}
QFileInfo gvf_file_info(_gvf_filename);
if (!gvf_file_info.exists()) {
QLOG_WARN() << QStringLiteral(u"GVF测量数据文件%1不存在").arg(_gvf_filename);
return;
}
const QString& connect_name = gvf_file_info.baseName();
if ( QSqlDatabase::contains(connect_name) ) {
QSqlDatabase::removeDatabase(connect_name);
}
QSqlDatabase gvf_db = QSqlDatabase::addDatabase("QSQLITE", connect_name);
gvf_db.setDatabaseName(_gvf_filename);
if (!gvf_db.open()) {
QLOG_WARN() << QStringLiteral(u"打开读取连接失败: %1").arg(gvf_db.lastError().text());
return;
}
quint64 current_process_data_id = 0;
_b_stop = false;
while (!_b_stop) {
QSqlQuery query(gvf_db);
query.exec("SELECT recordnum FROM lmstatisticinfov2");
if (query.last()) {
quint64 record_num = query.value("recordnum").toULongLong();
QLOG_DEBUG() << QStringLiteral(u"测量数据记录总数: %1").arg(record_num);
}
query.exec(QString("SELECT id, data FROM lmdatainfov2 WHERE id > %1").arg(current_process_data_id ));
int data_record_count = 0;
while (bool(!_b_stop) && query.next()) {
quint64 id = query.value("id").toULongLong();
const QByteArray& data = query.value("data").toByteArray();
if (id > current_process_data_id)
current_process_data_id = id;
++data_record_count;
QByteArray gvf_data;
QDataStream replay_data_stream(&gvf_data, QIODevice::Append);
replay_data_stream << QString("GVF") << true << data.size();
replay_data_stream.writeRawData(data.data(), data.size());
QLOG_DEBUG() << QStringLiteral(u"GVFDATA: %1").arg(QString::fromUtf8(data.toHex().toUpper()));
emit syncGvfData(gvf_data);
QThread::sleep(1);
}
query.clear();
query.finish();
}
gvf_db.close();
QSqlDatabase::removeDatabase(connect_name);
QLOG_DEBUG() << QStringLiteral(u"SyncGvfFileDataTask执行完成退出");
}
void SyncGvfFileDataTask::OnStop()
{
_b_stop = true;
QLOG_DEBUG() << QStringLiteral(u"停止SyncGvfFileDataTask");
}

28
src/SyncGvfFileDataTask.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef SYNCGVFFILEDATATASK_H
#define SYNCGVFFILEDATATASK_H
#include <QObject>
#include <QThread>
class SyncGvfFileDataTask : public QThread
{
Q_OBJECT
public:
explicit SyncGvfFileDataTask(QObject *parent = nullptr);
virtual ~SyncGvfFileDataTask();
void SetGvfFilename(const QString& gvf_filename);
void run() override;
public slots:
void OnStop();
signals:
void syncGvfData(const QByteArray& data);
private:
QString _gvf_filename;
bool _b_stop;
};
#endif // SYNCGVFFILEDATATASK_H

25
src/main.cpp Normal file
View File

@ -0,0 +1,25 @@
#include "MeasureDeviceController.h"
#include "MeasureServer.h"
#include "QsLogManage.h"
#include <QCoreApplication>
#include <QThread>
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
QsLogManage::createLogger();
MeasureServer measure_server;
if (!measure_server.Start()) {
QLOG_ERROR() << QStringLiteral(u"测量服务启动失败:") + measure_server.errorString();
} else {
MeasureDeviceController::Instance()->SetInitFinishedHandler(
[&](bool init_ok) {
if (!init_ok) {
QLOG_ERROR() << QStringLiteral(u"未找到测量设备,测量服务程序退出.");
// app.exit(EXIT_FAILURE);
}
});
MeasureDeviceController::Instance()->InitFindMeasureDevice();
}
return app.exec();
}

47
src/src.pro Normal file
View File

@ -0,0 +1,47 @@
TARGET = EnergySpectrumMeasureService
QT += core concurrent network sql
CONFIG += c++17 release
msvc {
QMAKE_CFLAGS += /utf-8
QMAKE_CXXFLAGS += /utf-8
}
include($${PWD}/../Common.pri)
include($${PROJECT_DIR}/3rdlib/QsLog/QsLog.pri)
include($${PROJECT_DIR}/3rdlib/csv/csv.pri)
include($${PROJECT_DIR}/3rdlib/DeviceManage/DeviceManage.pri)
DESTDIR = $${BUILD_BIN}
OBJECTS_DIR = $${BUILD_OBJ}/$${TARGET}/objs
MOC_DIR = $${BUILD_MOC}/$${TARGET}/moc
UI_DIR = $${BUILD_UI}/$${TARGET}/ui
SOURCES += \
$${PWD}/MeasureServer.cpp \
$${PWD}/main.cpp \
$${PWD}/MeasureDeviceController.cpp \
$${PWD}/RequstDataProcesser.cpp \
SyncGvfFileDataTask.cpp
HEADERS += \
$${PWD}/MeasureServer.h \
$${PWD}/MeasureDeviceController.h \
$${PWD}/MeasureServiceProtocol.h \
$${PWD}/RequstDataProcesser.h \
SyncGvfFileDataTask.h
DEFINES += ENABLE_DEBUG
contains(DEFINES, ENABLE_DEBUG) {
CONFIG += console
win32-msvc* {
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += /MD /Zi /O
QMAKE_LFLAGS_RELEASE += /DEBUG
}
}