初步完成测量服务
This commit is contained in:
parent
5773b78c75
commit
a78c30fdee
6
3rdlib/DeviceManage/DeviceManage.pri
Normal file
6
3rdlib/DeviceManage/DeviceManage.pri
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
INCLUDEPATH += \
|
||||
$${PWD}/include
|
||||
|
||||
win32 {
|
||||
LIBS += -L$${PWD}/lib -lDeviceManage
|
||||
}
|
||||
BIN
3rdlib/DeviceManage/bin/x64/DeviceManage.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x64/DeviceManage.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x64/FTD3XX.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x64/FTD3XX.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x64/ScriptProcess.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x64/ScriptProcess.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x64/UAVTransport.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x64/UAVTransport.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x64/ftd2xx64.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x64/ftd2xx64.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x64/libgsl-dll.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x64/libgsl-dll.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x86/DeviceManage.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x86/DeviceManage.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x86/FTD3XX.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x86/FTD3XX.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x86/ScriptProcess.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x86/ScriptProcess.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x86/UAVTransport.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x86/UAVTransport.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x86/ftd2xx.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x86/ftd2xx.dll
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/bin/x86/libgsl-dll.dll
Normal file
BIN
3rdlib/DeviceManage/bin/x86/libgsl-dll.dll
Normal file
Binary file not shown.
582
3rdlib/DeviceManage/include/AnalyzeSpecturmExport.h
Normal file
582
3rdlib/DeviceManage/include/AnalyzeSpecturmExport.h
Normal 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_
|
||||
371
3rdlib/DeviceManage/include/DeviceManage.h
Normal file
371
3rdlib/DeviceManage/include/DeviceManage.h
Normal 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
|
||||
|
||||
|
||||
34
3rdlib/DeviceManage/include/DeviceManageDefine.h
Normal file
34
3rdlib/DeviceManage/include/DeviceManageDefine.h
Normal 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
|
||||
116
3rdlib/DeviceManage/include/NuclideLibraryDefine.h
Normal file
116
3rdlib/DeviceManage/include/NuclideLibraryDefine.h
Normal 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
|
||||
69
3rdlib/DeviceManage/include/OneChannelDataDefine.h
Normal file
69
3rdlib/DeviceManage/include/OneChannelDataDefine.h
Normal 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)
|
||||
72
3rdlib/DeviceManage/include/OneChannelDataExport.h
Normal file
72
3rdlib/DeviceManage/include/OneChannelDataExport.h
Normal 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
|
||||
85
3rdlib/DeviceManage/include/OneChannelRoiConfigDefine.h
Normal file
85
3rdlib/DeviceManage/include/OneChannelRoiConfigDefine.h
Normal 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
|
||||
145
3rdlib/DeviceManage/include/OneComptonResultDataExport.h
Normal file
145
3rdlib/DeviceManage/include/OneComptonResultDataExport.h
Normal 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
|
||||
92
3rdlib/DeviceManage/include/OneEfficientCalibarationDefine.h
Normal file
92
3rdlib/DeviceManage/include/OneEfficientCalibarationDefine.h
Normal 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
|
||||
66
3rdlib/DeviceManage/include/OneEnergyCalibarationDefine.h
Normal file
66
3rdlib/DeviceManage/include/OneEnergyCalibarationDefine.h
Normal 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
|
||||
70
3rdlib/DeviceManage/include/PeakInfoDefine.h
Normal file
70
3rdlib/DeviceManage/include/PeakInfoDefine.h
Normal 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)
|
||||
448
3rdlib/DeviceManage/include/UAVrtp.h
Normal file
448
3rdlib/DeviceManage/include/UAVrtp.h
Normal 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
|
||||
BIN
3rdlib/DeviceManage/lib/DeviceManage.lib
Normal file
BIN
3rdlib/DeviceManage/lib/DeviceManage.lib
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/lib/x64/DeviceManage.lib
Normal file
BIN
3rdlib/DeviceManage/lib/x64/DeviceManage.lib
Normal file
Binary file not shown.
BIN
3rdlib/DeviceManage/lib/x86/DeviceManage.lib
Normal file
BIN
3rdlib/DeviceManage/lib/x86/DeviceManage.lib
Normal file
Binary file not shown.
14
3rdlib/QsLog/QsLog.pri
Normal file
14
3rdlib/QsLog/QsLog.pri
Normal 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
BIN
3rdlib/QsLog/bin/QsLog2.dll
Normal file
Binary file not shown.
BIN
3rdlib/QsLog/bin/QsLogd2.dll
Normal file
BIN
3rdlib/QsLog/bin/QsLogd2.dll
Normal file
Binary file not shown.
146
3rdlib/QsLog/include/QsLog.h
Normal file
146
3rdlib/QsLog/include/QsLog.h
Normal 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
|
||||
99
3rdlib/QsLog/include/QsLogDest.h
Normal file
99
3rdlib/QsLog/include/QsLogDest.h
Normal 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
|
||||
52
3rdlib/QsLog/include/QsLogDestConsole.h
Normal file
52
3rdlib/QsLog/include/QsLogDestConsole.h
Normal 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
|
||||
101
3rdlib/QsLog/include/QsLogDestFile.h
Normal file
101
3rdlib/QsLog/include/QsLogDestFile.h
Normal 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
|
||||
59
3rdlib/QsLog/include/QsLogDestFunctor.h
Normal file
59
3rdlib/QsLog/include/QsLogDestFunctor.h
Normal 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
|
||||
22
3rdlib/QsLog/include/QsLogDisableForThisFile.h
Normal file
22
3rdlib/QsLog/include/QsLogDisableForThisFile.h
Normal 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
|
||||
45
3rdlib/QsLog/include/QsLogLevel.h
Normal file
45
3rdlib/QsLog/include/QsLogLevel.h
Normal 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
|
||||
40
3rdlib/QsLog/include/QsLogManage.h
Normal file
40
3rdlib/QsLog/include/QsLogManage.h
Normal 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
BIN
3rdlib/QsLog/lib/QsLog2.lib
Normal file
Binary file not shown.
BIN
3rdlib/QsLog/lib/QsLogd2.lib
Normal file
BIN
3rdlib/QsLog/lib/QsLogd2.lib
Normal file
Binary file not shown.
1199
3rdlib/csv/csv.h
Normal file
1199
3rdlib/csv/csv.h
Normal file
File diff suppressed because it is too large
Load Diff
8486
3rdlib/csv/csv.hpp
Normal file
8486
3rdlib/csv/csv.hpp
Normal file
File diff suppressed because it is too large
Load Diff
2
3rdlib/csv/csv.pri
Normal file
2
3rdlib/csv/csv.pri
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
INCLUDEPATH += $${PWD}
|
||||
DEPENDPATH += $${PWD}
|
||||
18
Common.pri
Normal file
18
Common.pri
Normal 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}
|
||||
8
EnergySpectrumMeasureService.pro
Normal file
8
EnergySpectrumMeasureService.pro
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS += \
|
||||
src
|
||||
|
||||
OTHER_FILES += \
|
||||
$${PWD}/Common.pri
|
||||
256
src/MeasureDeviceController.cpp
Normal file
256
src/MeasureDeviceController.cpp
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
#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 = 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.GUID) == 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::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 {
|
||||
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,-1,-1);
|
||||
if (ret == 0) {
|
||||
device_guid_list.append(QString(di.GUID));
|
||||
} 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_iDeviceGain = cfg_params.value("DeviceGain", 1).toInt();
|
||||
config.m_iDeviceGainSelectIndex = cfg_params.value("DeviceGainSelectIndex", 1).toInt();
|
||||
config.m_iSoftGain = cfg_params.value("SoftGain", 3000).toInt();
|
||||
config.m_iChannelNum = cfg_params.value("AddrCount", 256).toInt();
|
||||
config.m_dConstTime = cfg_params.value("TimeConst", 45).toInt();
|
||||
config.m_iCurrentOffset = cfg_params.value("DcOffset", 0).toInt();
|
||||
config.m_iRiseTime = cfg_params.value("RiseTime", 2).toInt();
|
||||
config.m_iTopTime = cfg_params.value("FlatTime", 2).toInt();
|
||||
config.m_iMaxEnergy = cfg_params.value("MaxEnergy", 1).toInt();
|
||||
config.m_iTotalMeasureTime = cfg_params.value("TotalMeasureTime", 10).toInt();
|
||||
|
||||
config.m_eTransferModel = eSpecturmMode;
|
||||
config.m_iFormTime = 3;
|
||||
config.m_iFastChannelTrigerValue = 10;
|
||||
config.m_iHighVoltage = 0;
|
||||
config.m_iInputVoltageDesc = 0;
|
||||
config.m_iCRDivMode = 0;
|
||||
config.m_iInputSignalPostive = 0;
|
||||
config.m_iAMPeakDiv = 0;
|
||||
config.m_iHVDelt = 0;
|
||||
config.m_iHVCtrl = 0;
|
||||
config.m_iGetSpecturmPeirod = 1;
|
||||
config.m_iTotalMeasureCount = 0;
|
||||
config.m_iTrapeTopShitBit = 0;
|
||||
config.m_bICRCorrect = 0;
|
||||
config.m_iCRZAValue = 0;
|
||||
config.m_iZAEnable = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
for (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_data_file_base_name = measure_gvf_data_file_info.baseName();
|
||||
QDateTime data_time = QDateTime::fromString(measure_gvf_data_file_base_name, "GVHD__YYYY_MM_dd_hh_mm_ss_zzz");
|
||||
if ( qAbs(_measure_start_time.toMSecsSinceEpoch() - data_time.toMSecsSinceEpoch()) < 1000 ) {
|
||||
measure_gvf_data_filename = measure_gvf_data_file_info.absoluteFilePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
return measure_gvf_data_filename;
|
||||
}
|
||||
|
||||
44
src/MeasureDeviceController.h
Normal file
44
src/MeasureDeviceController.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#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();
|
||||
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);
|
||||
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
|
||||
25
src/MeasureServer.cpp
Normal file
25
src/MeasureServer.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "MeasureServer.h"
|
||||
#include "MeasureTask.h"
|
||||
|
||||
MeasureServer::MeasureServer(QObject *parent)
|
||||
: QTcpServer(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool MeasureServer::Start(quint16 port)
|
||||
{
|
||||
return this->listen(QHostAddress::Any, port);
|
||||
}
|
||||
|
||||
void MeasureServer::Stop()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
void MeasureServer::incomingConnection(qintptr socketDescriptor)
|
||||
{
|
||||
MeasureTask * measure_thread = new MeasureTask(socketDescriptor);
|
||||
connect(measure_thread, &MeasureTask::finished, measure_thread, &MeasureTask::deleteLater);
|
||||
_measure_thread->start();
|
||||
}
|
||||
|
||||
26
src/MeasureServer.h
Normal file
26
src/MeasureServer.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef MEASURESERVER_H
|
||||
#define MEASURESERVER_H
|
||||
|
||||
#include <QStringList>
|
||||
#include <QTcpServer>
|
||||
|
||||
class MeasureTask;
|
||||
|
||||
class MeasureServer : public QTcpServer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MeasureServer(QObject *parent = nullptr);
|
||||
bool Start(quint16 port = 96966);
|
||||
void Stop();
|
||||
|
||||
protected:
|
||||
void incomingConnection(qintptr socketDescriptor) override;
|
||||
|
||||
private:
|
||||
MeasureTask* _measure_thread = nullptr;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
198
src/MeasureTask.cpp
Normal file
198
src/MeasureTask.cpp
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
#include "MeasureTask.h"
|
||||
#include <QDataStream>
|
||||
#include "MeasureDeviceController.h"
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QSqlDatabase>
|
||||
#include <QFileInfo>
|
||||
|
||||
|
||||
MeasureTask::MeasureTask(int socketDescriptor, QObject *parent)
|
||||
: QThread(parent), socketDescriptor(socketDescriptor)
|
||||
{
|
||||
}
|
||||
|
||||
void MeasureTask::run()
|
||||
{
|
||||
QTcpSocket tcpSocket;
|
||||
if (!tcpSocket.setSocketDescriptor(socketDescriptor)) {
|
||||
return;
|
||||
}
|
||||
QByteArray buffer;
|
||||
while (tcpSocket.waitForReadyRead(500)) {
|
||||
buffer.append(tcpSocket.readAll());
|
||||
}
|
||||
if ( buffer.size() ) {
|
||||
QDataStream requst_data_stream(buffer);
|
||||
QString cmd_type, device_guid, cmd_data;
|
||||
requst_data_stream >> cmd_type >> device_guid;
|
||||
if ( cmd_type == "START" ) {
|
||||
requst_data_stream >> cmd_data;
|
||||
processStartMeasureCmd(&tcpSocket, device_guid, cmd_data);
|
||||
} else if (cmd_type == "STOP") {
|
||||
processStopMeasureCmd(&tcpSocket, device_guid);
|
||||
} else if (cmd_type == "SET") {
|
||||
requst_data_stream >> cmd_data;
|
||||
processSetDeviceMeasureConfigParamsCmd(&tcpSocket, device_guid, cmd_data);
|
||||
} else if (cmd_type == "CLEAR") {
|
||||
processClearDataCmd(&tcpSocket, device_guid);
|
||||
} else if (cmd_type == "DEVICE") {
|
||||
processGetMeasureDeviceListCmd(&tcpSocket);
|
||||
} else {
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
replay_data_stream << QString("UNKNOW") << false << QStringLiteral(u"未知请求");
|
||||
tcpSocket.write(replay_data);
|
||||
tcpSocket.flush();
|
||||
}
|
||||
} else {
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
replay_data_stream << QString("UNKNOW") << false << QStringLiteral(u"未知请求");
|
||||
tcpSocket.write(replay_data);
|
||||
tcpSocket.flush();
|
||||
}
|
||||
tcpSocket.disconnectFromHost();
|
||||
tcpSocket.waitForDisconnected(1000);
|
||||
}
|
||||
|
||||
void MeasureTask::processStartMeasureCmd(QTcpSocket* socket, 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;
|
||||
}
|
||||
bool ok = true;
|
||||
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();
|
||||
ok &= MeasureDeviceController::Instance()->SetDeviceMeasureConfigParams(device_guid, board_id, channel_id, channel_config_info);
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
if (!ok) {
|
||||
replay_data_stream << QString("START") << ok << QStringLiteral(u"启动设置板卡%1通道%2测量参数失败").arg(board_id).arg(channel_id);
|
||||
} else {
|
||||
replay_data_stream << QString("START") << ok << QStringLiteral(u"启动设置板卡%1通道%2测量参数完成").arg(board_id).arg(channel_id);
|
||||
}
|
||||
socket->write(replay_data);
|
||||
socket->flush();
|
||||
ok &= MeasureDeviceController::Instance()->StartMeasure(device_guid, board_id, channel_id);
|
||||
if (!ok) {
|
||||
replay_data_stream << QString("START") << ok << QStringLiteral(u"启动板卡%1通道%2测量失败");
|
||||
} else {
|
||||
replay_data_stream << QString("START") << ok << QStringLiteral(u"启动板卡%1通道%2测量完成");
|
||||
}
|
||||
socket->write(replay_data);
|
||||
socket->flush();
|
||||
}
|
||||
if (!ok) {
|
||||
// MeasureDeviceController::Instance()->StopMeasure(device_guid);
|
||||
return;
|
||||
}
|
||||
const QString& measure_data_gvf_filename = MeasureDeviceController::Instance()->GetMeasureGvfDataFilename();
|
||||
if (measure_data_gvf_filename.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
replay_data_stream << QString("DATA") << true << measure_data_gvf_filename;
|
||||
socket->write(replay_data);
|
||||
socket->flush();
|
||||
}
|
||||
|
||||
void MeasureTask::processStopMeasureCmd(QTcpSocket* socket, const QString &device_guid)
|
||||
{
|
||||
MeasureDeviceController::Instance()->StopMeasure(device_guid);
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
replay_data_stream << QString("STOP") << true << QStringLiteral(u"停止测量完成");
|
||||
socket->write(replay_data);
|
||||
socket->flush();
|
||||
}
|
||||
|
||||
void MeasureTask::processSetDeviceMeasureConfigParamsCmd(QTcpSocket* socket, const QString &device_guid, const QString &cmd_data)
|
||||
{
|
||||
bool ok = true;
|
||||
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;
|
||||
}
|
||||
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();
|
||||
ok &= MeasureDeviceController::Instance()->SetDeviceMeasureConfigParams(device_guid, board_id, channel_id, channel_config_info);
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
if (!ok) {
|
||||
replay_data_stream << QString("SET") << ok << QStringLiteral(u"设置板卡%1通道%2测量参数失败").arg(board_id).arg(channel_id);
|
||||
} else {
|
||||
replay_data_stream << QString("SET") << ok << QStringLiteral(u"设置板卡%1通道%2测量参数完成").arg(board_id).arg(channel_id);
|
||||
}
|
||||
socket->write(replay_data);
|
||||
socket->flush();
|
||||
}
|
||||
}
|
||||
|
||||
void MeasureTask::processClearDataCmd(QTcpSocket* socket, const QString &device_guid)
|
||||
{
|
||||
MeasureDeviceController::Instance()->ClearData(device_guid);
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
replay_data_stream << QString("CLEAR") << true << QStringLiteral(u"清除数据完成");
|
||||
socket->write(replay_data);
|
||||
socket->flush();
|
||||
}
|
||||
|
||||
void MeasureTask::processGetMeasureDeviceListCmd(QTcpSocket* socket)
|
||||
{
|
||||
QStringList device_list = MeasureDeviceController::Instance()->GetMeasureDeviceList();
|
||||
bool ok = !device_list.isEmpty();
|
||||
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
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;
|
||||
}
|
||||
socket->write(replay_data);
|
||||
socket->flush();
|
||||
}
|
||||
30
src/MeasureTask.h
Normal file
30
src/MeasureTask.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef MEASURETASK_H
|
||||
#define MEASURETASK_H
|
||||
|
||||
#include <QThread>
|
||||
#include <QTcpSocket>
|
||||
|
||||
class MeasureTask : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MeasureTask(int socketDescriptor, QObject *parent = nullptr);
|
||||
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
void processStartMeasureCmd(QTcpSocket* socket, const QString& device_guid, const QString& cmd_data);
|
||||
void processStopMeasureCmd(QTcpSocket* socket, const QString& device_guid);
|
||||
void processSetDeviceMeasureConfigParamsCmd(QTcpSocket* socket, const QString& device_guid, const QString& cmd_data);
|
||||
void processClearDataCmd(QTcpSocket* socket, const QString& device_guid);
|
||||
void processGetMeasureDeviceListCmd(QTcpSocket* socket);
|
||||
|
||||
signals:
|
||||
void error(QTcpSocket::SocketError socketError);
|
||||
|
||||
private:
|
||||
int socketDescriptor;
|
||||
};
|
||||
|
||||
#endif
|
||||
24
src/main.cpp
Normal file
24
src/main.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include "MeasureDeviceController.h"
|
||||
#include "MeasureServer.h"
|
||||
#include "QsLogManage.h"
|
||||
#include <QCoreApplication>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
// 创建日志记录器
|
||||
QsLogManage::createLogger();
|
||||
MeasureDeviceController::Instance()->SetInitFinishedHandler(
|
||||
[&](bool init_ok) {
|
||||
if (init_ok) {
|
||||
MeasureServer measure_server;
|
||||
if (!measure_server.Start()) {
|
||||
QLOG_ERROR() << measure_server.errorString();
|
||||
}
|
||||
} else {
|
||||
app.exit(EXIT_FAILURE);
|
||||
}
|
||||
});
|
||||
MeasureDeviceController::Instance()->InitFindMeasureDevice();
|
||||
return app.exec();
|
||||
}
|
||||
45
src/src.pro
Normal file
45
src/src.pro
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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}/MeasureTask.cpp \
|
||||
$${PWD}/main.cpp \
|
||||
MeasureDeviceController.cpp
|
||||
|
||||
HEADERS += \
|
||||
$${PWD}/MeasureServer.h \
|
||||
$${PWD}/MeasureTask.h \
|
||||
MeasureDeviceController.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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user