/* Bruker.API.CommonFunctions.cpp Implementation for Bruker CommonFunctions used by Esprit- and M4-API Microsoft Visual Studio 2015 */ #include "stdafx.h" #include #include #include #include "Bruker.API.CommonFunctions.h" namespace BrukerDll { // type definitions for callback functions typedef int32_t (WINAPI *PSetLanguage)(char* Language); typedef int32_t (WINAPI *PQueryServers)(char* pServerList, int32_t BufSize); typedef int32_t (WINAPI *PQueryUser)(char* pServer, char* pClientBuf, int32_t BufSize); typedef int32_t (WINAPI *POpenClient)(char* pServer, char* pUser, char* pPassword, bool StartNew, bool GUI, uint32_t& CID); typedef int32_t (WINAPI *POpenClientEx)(char* pServer, char* pUser, char* pPassword, const TOpenClientOptions& Options, uint32_t& CID); typedef int32_t (WINAPI *POpenClientTCP)(char* pServer, char* pUser, char* pPassword, char* pHost, WORD Port, const TOpenClientOptions Options, uint32_t& CID); typedef int32_t (WINAPI *PQueryInfo)(uint32_t CID, char* pInfo, int32_t BufSize); typedef int32_t (WINAPI *PCloseConnection)(uint32_t CID); typedef int32_t (WINAPI *PCloseClient)(uint32_t CID); typedef int32_t (WINAPI *PGetDebugErrorString)(uint32_t CID, int32_t aError, char* pErrorStr, int32_t& BufSize); typedef int32_t (WINAPI *PWriteDebugErrorStringToLog)(uint32_t CID, int32_t aError); typedef int32_t (WINAPI *PCheckConnection)(uint32_t CID); typedef int32_t (WINAPI *PCombineSpectrometer)(uint32_t CID, int32_t Devices); typedef int32_t (WINAPI *PGetSpectrometerStatus)(uint32_t CID, int32_t SPU, TRTSpectrometerStatus& Status); typedef int32_t (WINAPI *PSetDetectorCoolingMode)(uint32_t CID, int32_t SPU, int32_t Det, int32_t aCoolingMode); typedef int32_t (WINAPI *PResetSpectrometerInterlock)(uint32_t CID, int32_t SPU); typedef int32_t (WINAPI *PStartSpectrumMeasurement)(uint32_t CID, int32_t Device, uint32_t RealTime); typedef int32_t (WINAPI *PStartSpectrumLifeTimeMeasurement)(uint32_t CID, int32_t Device, uint32_t LifeTime); typedef int32_t (WINAPI *PStartSpectrumCounterMeasurement)(uint32_t CID, int32_t SPU, double StartEnergy, double EndEnergy, uint32_t Counts); typedef int32_t (WINAPI *PStopSpectrumMeasurement)(uint32_t CID, int32_t Device); typedef int32_t (WINAPI *PGetSpectrumMeasureState)(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate); typedef int32_t (WINAPI *PGetSpectrumMeasureStateEx)(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate, int32_t& RealTime); typedef int32_t (WINAPI *PReadSpectrum)(uint32_t CID, int32_t Device); typedef int32_t (WINAPI *PGetSpectrometerConfiguration)(uint32_t CID, int32_t SPU, uint32_t& MaxEnergy, uint32_t& PulseThroughput); typedef int32_t (WINAPI *PGetSpectrometerConfigurationEx)(uint32_t CID, int32_t SPU, int32_t Det, uint32_t& MaxEnergyIndex, uint32_t& PulseThroughputIndex); typedef int32_t (WINAPI *PSetSpectrometerConfiguration)(uint32_t CID, int32_t SPU, int32_t Det, const uint32_t MaxEnergyIndex, const uint32_t PulseThroughputIndex); typedef int32_t (WINAPI *PSetActiveDetectors)(uint32_t CID, int32_t SPU, const uint32_t Detectors); typedef int32_t (WINAPI *PGetActiveDetectors)(uint32_t CID, int32_t SPU, uint32_t& Detectors); typedef int32_t (WINAPI *PGetAvailableDetectors)(uint32_t CID, int32_t SPU, uint32_t& Detectors); typedef int32_t (WINAPI *PGetAvailableWDSDetectors)(uint32_t CID, int32_t SPU, uint32_t& Detectors); typedef int32_t (WINAPI *PGetHardwareConfiguration)(uint32_t CID, TRTHardwareConfiguration& aHardwareConfiguration); typedef int32_t (WINAPI *PCalibrateSpectrometer)(uint32_t CID, int32_t Device, bool ShowProgress, PRTCalibSettings Settings, PRTCalibResults Results); typedef int32_t (WINAPI *PGetSpectrometerParam)(uint32_t CID, int32_t Device, char* ParamName, char* ParamType, void* Buffer, int32_t BufSize); typedef int32_t (WINAPI *PGetSpectrometerCount)(uint32_t CID, int32_t& Value); typedef int32_t (WINAPI *PGetSpectrometerRanges)(uint32_t CID, int32_t SPU, int32_t Det, TRTDetectorRanges& aDetectorSettings); typedef int32_t (WINAPI *PGetSpectrometerParams)(uint32_t CID, int32_t SPU, void* Buffer, int32_t& BufSize); typedef int32_t (WINAPI *PGetSpectrum)(uint32_t CID, int32_t Buffer, PRTSpectrumHeaderRec pSpectrumBuf, int32_t BufSize); typedef int32_t (WINAPI *PQuantifySpectrum)(uint32_t CID, int32_t Buffer, char* pMethodName, char* pParams, char* pResultBuf, int32_t ResultBufSize); typedef int32_t (WINAPI *PSendRCLCommand)(uint32_t CID, int32_t Device, char* pCommand, char* pAnswer, int32_t AnswerBufSize); typedef int32_t (WINAPI *PSendRCLCommandOnly)(uint32_t CID, int32_t Device, char* Command); typedef int32_t (WINAPI *PReceiveRCLAnswer)(uint32_t CID, int32_t Device, char* Answer, int32_t AnswerBufSize); typedef int32_t (WINAPI *PLockSpectrometer)(uint32_t CID, int32_t Device); typedef int32_t (WINAPI *PUnlockSpectrometer)(uint32_t CID, int32_t Device); typedef int32_t (WINAPI *PLoadSpectrum)(uint32_t CID, char* pFileName); typedef int32_t (WINAPI *PPutSpectrum)(uint32_t CID, void* Spectrum, int32_t BufSize); typedef int32_t (WINAPI *PSaveSpectrum)(uint32_t CID, int32_t Buffer, char* pFileName); typedef int32_t (WINAPI *PCreateSpectrum)(char* SpectrometerParams, PRTSpectrumHeaderRec SpectrumData, char* ResultData, int32_t& ResultSize); typedef int32_t (WINAPI *PGetCorrectedSpectrum)(char* SpectrometerParams, PRTSpectrumHeaderRec Spectrum, double* ResultData); typedef int32_t (WINAPI *PShowSpectrum)(uint32_t CID, int32_t Buffer, char* Name); typedef int32_t (WINAPI *PDeleteSpectrum)(uint32_t CID, char* aName); typedef int32_t (WINAPI *PGetSpectrumGraphic)(uint32_t CID, int32_t Buffer, int32_t Width, int32_t Height, char* Format, void* ResultBuf, uint32_t& ResultBufSize); typedef int32_t (WINAPI *PGetHardwareProfiles)(uint32_t CID, char* pProfiles, int32_t BufSize); typedef int32_t (WINAPI *PSetHardwareProfile)(uint32_t CID, char* pProfile); typedef int32_t (WINAPI *PGetQuantificationMethods)(uint32_t CID, bool AutomaticOnly, char* pMethods, int32_t BufSize); typedef int32_t (WINAPI *PGetQuantificationMethodElements)(uint32_t CID, char* MethodName, char* ElementBuffer, int32_t BufSize); typedef int32_t (WINAPI *PEditQuantificationMethod)(uint32_t CID, char* MethodName); typedef int32_t (WINAPI *PCopyQuantificationMethod)(uint32_t CID, char* MethodName, char* TargetName, bool ToProfile); typedef int32_t (WINAPI *PGetRegionForElement)(uint32_t CID, int32_t Buffer, char* Params, char* ResultBuf, int32_t ResultBufSize); typedef int32_t (WINAPI *PXRayTubeSetConfiguration)(uint32_t CID, int32_t Tube, uint32_t HighVoltage, uint32_t Current, uint32_t FilterIndex); typedef int32_t (WINAPI *PXRayTubeGetState)(uint32_t CID, int32_t Tube, uint32_t& HighVoltage, uint32_t& Current, uint32_t& FilterIndex, bool& ShutterOpen); typedef int32_t (WINAPI *PXRayTubeOpenShutter)(uint32_t CID, int32_t Tube); typedef int32_t (WINAPI *PXRayTubeCloseShutter)(uint32_t CID, int32_t Tube); typedef int32_t (WINAPI *PXRayTubeHVOn)(uint32_t CID, int32_t Tube, int32_t DestHV, int32_t DestCurrent, bool HVOn); typedef int32_t (WINAPI *PXRaySetActiveTube)(uint32_t CID, int32_t Tube); typedef int32_t (WINAPI *PXRayGetActiveTube)(uint32_t CID, int32_t& Tube); typedef int32_t (WINAPI *PSetImageExportParameter)(uint32_t CID, int32_t ExportImageWidth, bool ExportWithOverlay); typedef int32_t (WINAPI *PHyMapStop)(uint32_t CID, bool WaitForFrameEnd); typedef int32_t (WINAPI *PHyMapClearDatabase)(uint32_t CID); typedef int32_t (WINAPI *PHyMapGetState)(uint32_t CID, bool& Running, double& MeasureState); typedef int32_t (WINAPI *PHyMapGetStateEx)(uint32_t CID, bool& Running, double& MeasureState, int32_t& CurrentLine); typedef int32_t (WINAPI *PHyMapGetXYSpectrum)(uint32_t CID, int32_t X, int32_t Y, bool Corrected, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize); typedef int32_t (WINAPI *PHyMapGetLineSpectra)(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize); typedef int32_t (WINAPI *PHyMapGetCompressedLineSpectra)(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize); typedef int32_t (WINAPI *PHyMapQuantifySpectra)(uint32_t CID, PPointArray Points, int32_t PointCount, int32_t Binning, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize); typedef int32_t (WINAPI *PHyMapSaveToFile)(uint32_t CID, char* aFileName); typedef int32_t (WINAPI *PHyMapLoadFromFile)(unsigned _int32 CID, char* aFileName, int32_t& Width, int32_t& Height, int32_t& DetCount, int32_t& ImgCount); typedef int32_t (WINAPI *PHyMapGetMaxPixelSpectrum)(uint32_t CID, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize); typedef int32_t (WINAPI *PHyMapAutoIdent)(uint32_t CID, char* pMethodName, char* pElementBuffer, int32_t ElementBufSize); typedef int32_t (WINAPI *PHyMapGetImage)(uint32_t CID, char* Format, int32_t ImgChannel, void* Buffer, uint32_t& BufferSize); typedef int32_t (WINAPI *PHyMapGetElementData)(uint32_t CID, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize); typedef int32_t (WINAPI *PHyMapGetElementImage)(uint32_t CID, char* Format, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize); typedef int32_t (WINAPI *PHyMapGetMixedMapImage)(uint32_t CID, char* Format, void* Buffer, uint32_t& BufferSize); typedef int32_t (WINAPI *PHyMapSaveImage)(uint32_t CID, int32_t ImgChannel, char* aFileName); typedef int32_t (WINAPI *PHyMapSaveElementImage)(uint32_t CID, int32_t ElementIndex, char* aFileName); typedef int32_t (WINAPI *PHyMapSaveMixedMapImage)(uint32_t CID, char* aFileName); // DLL Handle HMODULE hDllBaseAddress; // global callback function pointers PSetLanguage pSetLanguage = NULL; PQueryServers pQueryServers = NULL; PQueryUser pQueryUser = NULL; POpenClient pOpenClient = NULL; POpenClientEx pOpenClientEx = NULL; POpenClientTCP pOpenClientTCP = NULL; PQueryInfo pQueryInfo = NULL; PCloseConnection pCloseConnection = NULL; PCloseClient pCloseClient = NULL; PGetDebugErrorString pGetDebugErrorString = NULL; PWriteDebugErrorStringToLog pWriteDebugErrorStringToLog = NULL; PCheckConnection pCheckConnection = NULL; PCombineSpectrometer pCombineSpectrometer = NULL; PGetSpectrometerStatus pGetSpectrometerStatus = NULL; PSetDetectorCoolingMode pSetDetectorCoolingMode = NULL; PResetSpectrometerInterlock pResetSpectrometerInterlock = NULL; PStartSpectrumMeasurement pStartSpectrumMeasurement = NULL; PStartSpectrumLifeTimeMeasurement pStartSpectrumLifeTimeMeasurement = NULL; PStartSpectrumCounterMeasurement pStartSpectrumCounterMeasurement = NULL; PStopSpectrumMeasurement pStopSpectrumMeasurement = NULL; PGetSpectrumMeasureState pGetSpectrumMeasureState = NULL; PGetSpectrumMeasureStateEx pGetSpectrumMeasureStateEx = NULL; PReadSpectrum pReadSpectrum = NULL; PGetSpectrometerConfiguration pGetSpectrometerConfiguration = NULL; PGetSpectrometerConfigurationEx pGetSpectrometerConfigurationEx = NULL; PSetSpectrometerConfiguration pSetSpectrometerConfiguration = NULL; PSetActiveDetectors pSetActiveDetectors = NULL; PGetActiveDetectors pGetActiveDetectors = NULL; PGetAvailableDetectors pGetAvailableDetectors = NULL; PGetAvailableWDSDetectors pGetAvailableWDSDetectors = NULL; PGetHardwareConfiguration pGetHardwareConfiguration = NULL; PCalibrateSpectrometer pCalibrateSpectrometer = NULL; PGetSpectrometerParam pGetSpectrometerParam = NULL; PGetSpectrometerCount pGetSpectrometerCount = NULL; PGetSpectrometerRanges pGetSpectrometerRanges = NULL; PGetSpectrometerParams pGetSpectrometerParams = NULL; PGetSpectrum pGetSpectrum = NULL; PQuantifySpectrum pQuantifySpectrum = NULL; PSendRCLCommand pSendRCLCommand = NULL; PSendRCLCommandOnly pSendRCLCommandOnly = NULL; PReceiveRCLAnswer pReceiveRCLAnswer = NULL; PLockSpectrometer pLockSpectrometer = NULL; PUnlockSpectrometer pUnlockSpectrometer = NULL; PLoadSpectrum pLoadSpectrum = NULL; PPutSpectrum pPutSpectrum = NULL; PSaveSpectrum pSaveSpectrum = NULL; PCreateSpectrum pCreateSpectrum = NULL; PGetCorrectedSpectrum pGetCorrectedSpectrum = NULL; PShowSpectrum pShowSpectrum = NULL; PDeleteSpectrum pDeleteSpectrum = NULL; PGetSpectrumGraphic pGetSpectrumGraphic = NULL; PGetHardwareProfiles pGetHardwareProfiles = NULL; PSetHardwareProfile pSetHardwareProfile = NULL; PGetQuantificationMethods pGetQuantificationMethods = NULL; PGetQuantificationMethodElements pGetQuantificationMethodElements = NULL; PEditQuantificationMethod pEditQuantificationMethod = NULL; PCopyQuantificationMethod pCopyQuantificationMethod = NULL; PGetRegionForElement pGetRegionForElement = NULL; PXRayTubeSetConfiguration pXRayTubeSetConfiguration = NULL; PXRayTubeGetState pXRayTubeGetState = NULL; PXRayTubeOpenShutter pXRayTubeOpenShutter = NULL; PXRayTubeCloseShutter pXRayTubeCloseShutter = NULL; PXRayTubeHVOn pXRayTubeHVOn = NULL; PXRaySetActiveTube pXRaySetActiveTube = NULL; PXRayGetActiveTube pXRayGetActiveTube = NULL; PSetImageExportParameter pSetImageExportParameter = NULL; PHyMapStop pHyMapStop = NULL; PHyMapClearDatabase pHyMapClearDatabase = NULL; PHyMapGetState pHyMapGetState = NULL; PHyMapGetStateEx pHyMapGetStateEx = NULL; PHyMapGetXYSpectrum pHyMapGetXYSpectrum = NULL; PHyMapGetLineSpectra pHyMapGetLineSpectra = NULL; PHyMapGetCompressedLineSpectra pHyMapGetCompressedLineSpectra = NULL; PHyMapQuantifySpectra pHyMapQuantifySpectra = NULL; PHyMapSaveToFile pHyMapSaveToFile = NULL; PHyMapLoadFromFile pHyMapLoadFromFile = NULL; PHyMapGetMaxPixelSpectrum pHyMapGetMaxPixelSpectrum = NULL; PHyMapAutoIdent pHyMapAutoIdent = NULL; PHyMapGetImage pHyMapGetImage = NULL; PHyMapGetElementData pHyMapGetElementData = NULL; PHyMapGetElementImage pHyMapGetElementImage = NULL; PHyMapGetMixedMapImage pHyMapGetMixedMapImage = NULL; PHyMapSaveImage pHyMapSaveImage = NULL; PHyMapSaveElementImage pHyMapSaveElementImage = NULL; PHyMapSaveMixedMapImage pHyMapSaveMixedMapImage = NULL; bool LoadCommonFunctions(LPCTSTR LibFile) { hDllBaseAddress = LoadLibrary(LibFile); if (!hDllBaseAddress) { DWORD lastError = GetLastError(); TCHAR buf[200]; int j = _stprintf_s(buf, 200, _T("CommonFunctions.cpp: Failed to load DLL %s \n"), LibFile); j += _stprintf_s(buf + j, 200 - j, _T("CommonFunctions.cpp: ErrorCode: %d \n"), lastError); OutputDebugString(buf); return false; } pSetLanguage = (PSetLanguage)GetProcAddress(hDllBaseAddress, "SetLanguage"); if (!pSetLanguage) OutputDebugString(_T("Failed to Load DLL function SetLanguage\n")); pQueryServers = (PQueryServers)GetProcAddress(hDllBaseAddress, "QueryServers"); if (!pQueryServers) OutputDebugString(_T("Failed to load DLL function QueryServers\n")); pQueryUser = (PQueryUser)GetProcAddress(hDllBaseAddress, "QueryUser"); if (!pQueryUser) OutputDebugString(_T("Failed to load DLL function QueryUser\n")); pOpenClient = (POpenClient)GetProcAddress(hDllBaseAddress, "OpenClient"); if (!pOpenClient) OutputDebugString(_T("Failed to load DLL function OpenClient\n")); pOpenClientEx = (POpenClientEx)GetProcAddress(hDllBaseAddress, "OpenClientEx"); if (!pOpenClientEx) OutputDebugString(_T("Failed to load DLL function OpenClientEx\n")); pOpenClientTCP = (POpenClientTCP)GetProcAddress(hDllBaseAddress, "OpenClientTCP"); if (!pOpenClientTCP) OutputDebugString(_T("Failed to load DLL function OpenClientTCP\n")); pQueryInfo = (PQueryInfo)GetProcAddress(hDllBaseAddress, "QueryInfo"); if (!pQueryInfo) OutputDebugString(_T("Failed to load DLL function QueryInfo\n")); pCloseConnection = (PCloseConnection)GetProcAddress(hDllBaseAddress, "CloseConnection"); if (!pCloseConnection) OutputDebugString(_T("Failed to load DLL function CloseConnection\n")); pCloseClient = (PCloseClient)GetProcAddress(hDllBaseAddress, "CloseClient"); if (!pCloseClient) OutputDebugString(_T("Failed to load DLL function CloseClient\n")); pGetDebugErrorString = (PGetDebugErrorString)GetProcAddress(hDllBaseAddress, "GetDebugErrorString"); if (!pGetDebugErrorString) OutputDebugString(_T("Failed to load DLL function GetDebugErrorString\n")); pWriteDebugErrorStringToLog = (PWriteDebugErrorStringToLog)GetProcAddress(hDllBaseAddress, "WriteDebugErrorStringToLog"); if (!pWriteDebugErrorStringToLog) OutputDebugString(_T("Failed to load DLL function WriteDebugErrorStringToLog\n")); pCheckConnection = (PCheckConnection)GetProcAddress(hDllBaseAddress, "CheckConnection"); if (!pCheckConnection) OutputDebugString(_T("Failed to load DLL function CheckConnection\n")); pCombineSpectrometer = (PCombineSpectrometer)GetProcAddress(hDllBaseAddress, "CombineSpectrometer"); if (!pCombineSpectrometer) OutputDebugString(_T("Failed to load DLL function CombineSpectrometer\n")); pGetSpectrometerStatus = (PGetSpectrometerStatus)GetProcAddress(hDllBaseAddress, "GetSpectrometerStatus"); if (!pGetSpectrometerStatus) OutputDebugString(_T("Failed to load DLL function GetSpectrometerStatus\n")); pSetDetectorCoolingMode = (PSetDetectorCoolingMode)GetProcAddress(hDllBaseAddress, "SetDetectorCoolingMode"); if (!pSetDetectorCoolingMode) OutputDebugString(_T("Failed to load DLL function SetDetectorCoolingMode\n")); pResetSpectrometerInterlock = (PResetSpectrometerInterlock)GetProcAddress(hDllBaseAddress, "ResetSpectrometerInterlock"); if (!pResetSpectrometerInterlock) OutputDebugString(_T("Failed to load DLL function ResetSpectrometerInterlock\n")); pStartSpectrumMeasurement = (PStartSpectrumMeasurement)GetProcAddress(hDllBaseAddress, "StartSpectrumMeasurement"); if (!pStartSpectrumMeasurement) OutputDebugString(_T("Failed to load DLL function StartSpectrumMeasurement\n")); pStartSpectrumLifeTimeMeasurement = (PStartSpectrumLifeTimeMeasurement)GetProcAddress(hDllBaseAddress, "StartSpectrumLifeTimeMeasurement"); if (!pStartSpectrumLifeTimeMeasurement) OutputDebugString(_T("Failed to load DLL function StartSpectrumLifeTimeMeasurement\n")); pStartSpectrumCounterMeasurement = (PStartSpectrumCounterMeasurement)GetProcAddress(hDllBaseAddress, "StartSpectrumCounterMeasurement"); if (!pStartSpectrumCounterMeasurement) OutputDebugString(_T("Failed to load DLL function StartSpectrumCounterMeasurement\n")); pStopSpectrumMeasurement = (PStopSpectrumMeasurement)GetProcAddress(hDllBaseAddress, "StopSpectrumMeasurement"); if (!pStopSpectrumMeasurement) OutputDebugString(_T("Failed to load DLL function StopSpectrumMeasurement\n")); pGetSpectrumMeasureState = (PGetSpectrumMeasureState)GetProcAddress(hDllBaseAddress, "GetSpectrumMeasureState"); if (!pGetSpectrumMeasureState) OutputDebugString(_T("Failed to load DLL function GetSpectrumMeasureState\n")); pGetSpectrumMeasureStateEx = (PGetSpectrumMeasureStateEx)GetProcAddress(hDllBaseAddress, "GetSpectrumMeasureStateEx"); if (!pGetSpectrumMeasureStateEx) OutputDebugString(_T("Failed to load DLL function GetSpectrumMeasureStateEx\n")); pReadSpectrum = (PReadSpectrum)GetProcAddress(hDllBaseAddress, "ReadSpectrum"); if (!pReadSpectrum) OutputDebugString(_T("Failed to load DLL function ReadSpectrum\n")); pGetSpectrometerConfiguration = (PGetSpectrometerConfiguration)GetProcAddress(hDllBaseAddress, "GetSpectrometerConfiguration"); if (!pGetSpectrometerConfiguration) OutputDebugString(_T("Failed to load DLL function GetSpectrometerConfiguration\n")); pGetSpectrometerConfigurationEx = (PGetSpectrometerConfigurationEx)GetProcAddress(hDllBaseAddress, "GetSpectrometerConfigurationEx"); if (!pGetSpectrometerConfigurationEx) OutputDebugString(_T("Failed to load DLL function GetSpectrometerConfigurationEx\n")); pSetSpectrometerConfiguration = (PSetSpectrometerConfiguration)GetProcAddress(hDllBaseAddress, "SetSpectrometerConfiguration"); if (!pSetSpectrometerConfiguration) OutputDebugString(_T("Failed to load DLL function SetSpectrometerConfiguration\n")); pSetActiveDetectors = (PSetActiveDetectors)GetProcAddress(hDllBaseAddress, "SetActiveDetectors"); if (!pSetActiveDetectors) OutputDebugString(_T("Failed to load DLL function SetActiveDetectors\n")); pGetActiveDetectors = (PGetActiveDetectors)GetProcAddress(hDllBaseAddress, "GetActiveDetectors"); if (!pGetActiveDetectors)OutputDebugString(_T("Failed to load DLL function GetActiveDetectors\n")); pGetAvailableDetectors = (PGetAvailableDetectors)GetProcAddress(hDllBaseAddress, "GetAvailableDetectors"); if (!pGetAvailableDetectors) OutputDebugString(_T("Failed to load DLL function GetAvailableDetectors\n")); pGetAvailableWDSDetectors = (PGetAvailableWDSDetectors)GetProcAddress(hDllBaseAddress, "GetAvailableWDSDetectors"); if (!pGetAvailableWDSDetectors) OutputDebugString(_T("Failed to load DLL function GetAvailableWDSDetectors\n")); pGetHardwareConfiguration = (PGetHardwareConfiguration)GetProcAddress(hDllBaseAddress, "GetHardwareConfiguration"); if (!pGetHardwareConfiguration) OutputDebugString(_T("Failed to load DLL function GetHardwareConfiguration\n")); pCalibrateSpectrometer = (PCalibrateSpectrometer)GetProcAddress(hDllBaseAddress, "CalibrateSpectrometer"); if (!pCalibrateSpectrometer) OutputDebugString(_T("Failed to load DLL function CalibrateSpectrometer\n")); pGetSpectrometerParam = (PGetSpectrometerParam)GetProcAddress(hDllBaseAddress, "GetSpectrometerParam"); if (!pGetSpectrometerParam) OutputDebugString(_T("Failed to load DLL function GetSpectrometerParam\n")); pGetSpectrometerCount = (PGetSpectrometerCount)GetProcAddress(hDllBaseAddress, "GetSpectrometerCount"); if (!pGetSpectrometerCount) OutputDebugString(_T("Failed to load DLL function GetSpectrometerCount\n")); pGetSpectrometerRanges = (PGetSpectrometerRanges)GetProcAddress(hDllBaseAddress, "GetSpectrometerRanges"); if (!pGetSpectrometerRanges) OutputDebugString(_T("Failed to load DLL function GetSpectrometerRanges\n")); pGetSpectrometerParams = (PGetSpectrometerParams)GetProcAddress(hDllBaseAddress, "GetSpectrometerParams"); if (!pGetSpectrometerParams) OutputDebugString(_T("Failed to load DLL function GetSpectrometerParams\n")); pGetSpectrum = (PGetSpectrum)GetProcAddress(hDllBaseAddress, "GetSpectrum"); if (!pGetSpectrum) OutputDebugString(_T("Failed to load DLL function GetSpectrum\n")); pQuantifySpectrum = (PQuantifySpectrum)GetProcAddress(hDllBaseAddress, "QuantifySpectrum"); if (!pQuantifySpectrum) OutputDebugString(_T("Failed to load DLL function QuantifySpectrum\n")); pSendRCLCommand = (PSendRCLCommand)GetProcAddress(hDllBaseAddress, "SendRCLCommand"); if (!pSendRCLCommand) OutputDebugString(_T("Failed to load DLL funtion SendRCLCommand\n")); pSendRCLCommandOnly = (PSendRCLCommandOnly)GetProcAddress(hDllBaseAddress, "SendRCLCommandOnly"); if (!pSendRCLCommandOnly) OutputDebugString(_T("Failed to load DLL function SendRCLCommandOnly\n")); pReceiveRCLAnswer = (PReceiveRCLAnswer)GetProcAddress(hDllBaseAddress, "ReceiveRCLAnswer"); if (!pReceiveRCLAnswer) OutputDebugString(_T("Failed to load DLL function ReceiveRCLAnswer\n")); pLockSpectrometer = (PLockSpectrometer)GetProcAddress(hDllBaseAddress, "LockSpectrometer"); if (!pLockSpectrometer) OutputDebugString(_T("Failed to load DLL function LockSpectrometer\n")); pUnlockSpectrometer = (PUnlockSpectrometer)GetProcAddress(hDllBaseAddress, "UnlockSpectrometer"); if (!pUnlockSpectrometer) OutputDebugString(_T("Failed to load DLL function UnlockSpectrometer\n")); pLoadSpectrum = (PLoadSpectrum)GetProcAddress(hDllBaseAddress, "LoadSpectrum"); if (!pLoadSpectrum) OutputDebugString(_T("Failed to load DLL function LoadSpectrum\n")); pPutSpectrum = (PPutSpectrum)GetProcAddress(hDllBaseAddress, "PutSpectrum"); if (!pPutSpectrum) OutputDebugString(_T("Failed to load DLL function PutSpectrum\n")); pSaveSpectrum = (PSaveSpectrum)GetProcAddress(hDllBaseAddress, "SaveSpectrum"); if (!pSaveSpectrum) OutputDebugString(_T("Failed to load DLL function SaveSpectrum\n")); pCreateSpectrum = (PCreateSpectrum)GetProcAddress(hDllBaseAddress, "CreateSpectrum"); if (!pCreateSpectrum) OutputDebugString(_T("Failed to load DLL function CreateSpectrum\n")); pGetCorrectedSpectrum = (PGetCorrectedSpectrum)GetProcAddress(hDllBaseAddress, "GetCorrectedSpectrum"); if (!pGetCorrectedSpectrum) OutputDebugString(_T("Failed to load DLL function GetCorrectedSpectrum\n")); pShowSpectrum = (PShowSpectrum)GetProcAddress(hDllBaseAddress, "ShowSpectrum"); if (!pShowSpectrum) OutputDebugString(_T("Failed to load DLL function ShowSpectrum\n")); pDeleteSpectrum = (PDeleteSpectrum)GetProcAddress(hDllBaseAddress, "DeleteSpectrum"); if (!pDeleteSpectrum) OutputDebugString(_T("Failed to load DLL function DeleteSpectrum\n")); pGetSpectrumGraphic = (PGetSpectrumGraphic)GetProcAddress(hDllBaseAddress, "GetSpectrumGraphic"); if (!pGetSpectrumGraphic) OutputDebugString(_T("Failed to load DLL function GetSpectrumGraphic\n")); pGetHardwareProfiles = (PGetHardwareProfiles)GetProcAddress(hDllBaseAddress, "GetHardwareProfiles"); if (!pGetHardwareProfiles) OutputDebugString(_T("Failed to load DLL function GetHardwareProfiles\n")); pSetHardwareProfile = (PSetHardwareProfile)GetProcAddress(hDllBaseAddress, "SetHardwareProfile"); if (!pSetHardwareProfile) OutputDebugString(_T("Failed to load DLL function SetHardwareProfile\n")); pGetQuantificationMethods = (PGetQuantificationMethods)GetProcAddress(hDllBaseAddress, "GetQuantificationMethods"); if (!pGetQuantificationMethods) OutputDebugString(_T("Failed to load DLL function GetQuantificationMethods\n")); pGetQuantificationMethodElements = (PGetQuantificationMethodElements)GetProcAddress(hDllBaseAddress, "GetQuantificationMethodElements"); if (!pGetQuantificationMethodElements) OutputDebugString(_T("Failed to load DLL function GetQuantificationMethodElements\n")); pEditQuantificationMethod = (PEditQuantificationMethod)GetProcAddress(hDllBaseAddress, "EditQuantificationMethod"); if (!pEditQuantificationMethod) OutputDebugString(_T("Failed to load DLL function EditQuantificationMethod\n")); pCopyQuantificationMethod = (PCopyQuantificationMethod)GetProcAddress(hDllBaseAddress, "CopyQuantificationMethod"); if (!pCopyQuantificationMethod) OutputDebugString(_T("Failed to load DLL function CopyQuantificationMethod\n")); pGetRegionForElement = (PGetRegionForElement)GetProcAddress(hDllBaseAddress, "GetRegionForElement"); if (!pGetRegionForElement) OutputDebugString(_T("Failed to load DLL function GetRegionForElement\n")); pXRayTubeSetConfiguration = (PXRayTubeSetConfiguration)GetProcAddress(hDllBaseAddress, "XRayTubeSetConfiguration"); if (!pXRayTubeSetConfiguration) OutputDebugString(_T("Failed to load DLL function XRayTubeSetConfiguration\n")); pXRayTubeGetState = (PXRayTubeGetState)GetProcAddress(hDllBaseAddress, "XRayTubeGetState"); if (!pXRayTubeGetState) OutputDebugString(_T("Failed to load DLL function XRayTubeGetState\n")); pXRayTubeOpenShutter = (PXRayTubeOpenShutter)GetProcAddress(hDllBaseAddress, "XRayTubeOpenShutter"); if (!pXRayTubeOpenShutter) OutputDebugString(_T("Failed to load DLL function XRayTubeOpenShutter\n")); pXRayTubeCloseShutter = (PXRayTubeCloseShutter)GetProcAddress(hDllBaseAddress, "XRayTubeCloseShutter"); if (!pXRayTubeCloseShutter) OutputDebugString(_T("Failed to load DLL function XRayTubeCloseShutter\n")); pXRayTubeHVOn = (PXRayTubeHVOn)GetProcAddress(hDllBaseAddress, "XRayTubeHVOn"); if (!pXRayTubeHVOn) OutputDebugString(_T("Failed to load DLL function XRayTubeHVOn\n")); pXRaySetActiveTube = (PXRaySetActiveTube)GetProcAddress(hDllBaseAddress, "XRaySetActiveTube"); if (!pXRaySetActiveTube) OutputDebugString(_T("Failed to load DLL function XRaySetActiveTube\n")); pXRayGetActiveTube = (PXRayGetActiveTube)GetProcAddress(hDllBaseAddress, "XRayGetActiveTube"); if (!pXRayGetActiveTube) OutputDebugString(_T("Failed to load DLL function XRayGetActiveTube\n")); pSetImageExportParameter = (PSetImageExportParameter)GetProcAddress(hDllBaseAddress, "SetImageExportParameter"); if (!pSetImageExportParameter) OutputDebugString(_T("Failed to load DLL function SetImageExportParameter\n")); pHyMapStop = (PHyMapStop)GetProcAddress(hDllBaseAddress, "HyMapStop"); if (!pHyMapStop) OutputDebugString(_T("Failed to load DLL function HyMapStop\n")); pHyMapClearDatabase = (PHyMapClearDatabase)GetProcAddress(hDllBaseAddress, "HyMapClearDatabase"); if (!pHyMapClearDatabase) OutputDebugString(_T("Failed to load DLL function HyMapClearDatabase\n")); pHyMapGetState = (PHyMapGetState)GetProcAddress(hDllBaseAddress, "HyMapGetState"); if (!pHyMapGetState) OutputDebugString(_T("Failed to load DLL function HyMapGetState\n")); pHyMapGetStateEx = (PHyMapGetStateEx)GetProcAddress(hDllBaseAddress, "HyMapGetStateEx"); if (!pHyMapGetStateEx) OutputDebugString(_T("Failed to load DLL function HyMapGetStateEx\n")); pHyMapGetXYSpectrum = (PHyMapGetXYSpectrum)GetProcAddress(hDllBaseAddress, "HyMapGetXYSpectrum"); if (!pHyMapGetXYSpectrum) OutputDebugString(_T("Failed to load DLL function HyMapGetXYSpectrum\n")); pHyMapGetLineSpectra = (PHyMapGetLineSpectra)GetProcAddress(hDllBaseAddress, "HyMapGetLineSpectra"); if (!pHyMapGetLineSpectra) OutputDebugString(_T("Failed to load DLL function HyMapGetLineSpectra\n")); pHyMapGetCompressedLineSpectra = (PHyMapGetCompressedLineSpectra)GetProcAddress(hDllBaseAddress, "HyMapGetCompressedLineSpectra"); if (!pHyMapGetCompressedLineSpectra) OutputDebugString(_T("Failed to load DLL function HyMapGetCompressedLineSpectra\n")); pHyMapQuantifySpectra = (PHyMapQuantifySpectra)GetProcAddress(hDllBaseAddress, "HyMapQuantifySpectra"); if (!pHyMapQuantifySpectra) OutputDebugString(_T("Failed to load DLL function HyMapQuantifySpectra\n")); pHyMapSaveToFile = (PHyMapSaveToFile)GetProcAddress(hDllBaseAddress, "HyMapSaveToFile"); if (!pHyMapSaveToFile) OutputDebugString(_T("Failed to load DLL function HyMapSaveToFile\n")); pHyMapLoadFromFile = (PHyMapLoadFromFile)GetProcAddress(hDllBaseAddress, "HyMapLoadFromFile"); if (!pHyMapLoadFromFile) OutputDebugString(_T("Failed to load DLL function HyMapLoadFromFile\n")); pHyMapGetMaxPixelSpectrum = (PHyMapGetMaxPixelSpectrum)GetProcAddress(hDllBaseAddress, "HyMapGetMaxPixelSpectrum"); if (!pHyMapGetMaxPixelSpectrum) OutputDebugString(_T("Failed to load DLL function HyMapGetMaxPixelSpectrum\n")); pHyMapAutoIdent = (PHyMapAutoIdent)GetProcAddress(hDllBaseAddress, "HyMapAutoIdent"); if (!pHyMapAutoIdent) OutputDebugString(_T("Failed to load DLL function HyMapAutoIdent\n")); pHyMapGetImage = (PHyMapGetImage)GetProcAddress(hDllBaseAddress, "HyMapGetImage"); if (!pHyMapGetImage) OutputDebugString(_T("Failed to load DLL function HyMapGetImage\n")); pHyMapGetElementData = (PHyMapGetElementData)GetProcAddress(hDllBaseAddress, "HyMapGetElementData"); if (!pHyMapGetElementData) OutputDebugString(_T("Failed to load DLL function HyMapGetElementData\n")); pHyMapGetElementImage = (PHyMapGetElementImage)GetProcAddress(hDllBaseAddress, "HyMapGetElementImage"); if (!pHyMapGetElementImage) OutputDebugString(_T("Failed to load DLL function HyMapGetElementImage\n")); pHyMapGetMixedMapImage = (PHyMapGetMixedMapImage)GetProcAddress(hDllBaseAddress, "HyMapGetMixedMapImage"); if (!pHyMapGetMixedMapImage) OutputDebugString(_T("Failed to load DLL function HyMapGetMixedMapImage\n")); pHyMapSaveImage = (PHyMapSaveImage)GetProcAddress(hDllBaseAddress, "HyMapSaveImage"); if (!pHyMapSaveImage) OutputDebugString(_T("Failed to load DLL function HyMapSaveImage\n")); pHyMapSaveElementImage = (PHyMapSaveElementImage)GetProcAddress(hDllBaseAddress, "HyMapSaveElementImage"); if (!pHyMapSaveElementImage) OutputDebugString(_T("Failed to load DLL function HyMapSaveElementImage\n")); pHyMapSaveMixedMapImage = (PHyMapSaveMixedMapImage)GetProcAddress(hDllBaseAddress, "HyMapSaveMixedMapImage"); if (!pHyMapSaveMixedMapImage) OutputDebugString(_T("Failed to load DLL function HyMapSaveMixedMapImage\n")); return true; } // Converts Int-Value to String-Value std::string IntToString(int number) { std::ostringstream oss; oss << number; return oss.str(); } // Converts Double-Value to String-Value std::string DoubleToString(double number) { std::ostringstream oss; oss.precision(4); oss << number; return oss.str(); } int32_t SetLanguage(char* Language) { if (pSetLanguage) return pSetLanguage(Language); else return -1; } // Query all known servers for which can be used by client program int32_t QueryServers(char* pServerList, int32_t BufSize) { if (pQueryServers) return pQueryServers(pServerList, BufSize); else return -1; } // Query all running client programs for connected servers int32_t QueryUser(char* pServer, char* pClientBuf, int32_t BufSize) { if (pQueryUser) return pQueryUser(pServer, pClientBuf, BufSize); else return -1; } // Start Quantax program and login automatically // Password : Password of user with UserName // GUI : Whether to start the user interface or not // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t OpenClient(char* pServer, char* pUser, char* pPassword, bool StartNew, bool GUI, uint32_t& CID) { if (pOpenClient) return pOpenClient(pServer, pUser, pPassword, StartNew, GUI, CID); else return -1; } int32_t OpenClientEx(char* pServer, char* pUser, char* pPassword, const TOpenClientOptions& Options, uint32_t& CID) { if (pOpenClientEx) return pOpenClientEx(pServer, pUser, pPassword, Options, CID); else return -1; } int32_t OpenClientTCP(char* pServer, char* pUser, char* pPassword, char* pHost, uint16_t Port, const TOpenClientOptions Options, uint32_t& CID) { if (pOpenClientTCP) return pOpenClientTCP(pServer, pUser, pPassword, pHost, Port, Options, CID); else return -1; } // query some information about a specific connection int32_t QueryInfo(uint32_t CID, char* pInfo, int32_t BufSize) { if (pQueryInfo) return pQueryInfo(CID, pInfo, BufSize); else return -1; } // Close current connection // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t CloseConnection(uint32_t CID) { if (pCloseConnection) return pCloseConnection(CID); else return -1; } // Stop Quantax // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t CloseClient(uint32_t CID) { if (pCloseClient) return pCloseClient(CID); else return -1; } // returns description string for error values int32_t GetDebugErrorString(uint32_t CID, int32_t aError, char* pErrorStr, int32_t& BufSize) { if (pGetDebugErrorString) return pGetDebugErrorString(CID, aError, pErrorStr, BufSize); else return -1; } // writes description string for error values to log int32_t WriteDebugErrorStringToLog(uint32_t CID, int32_t aError) { if (pWriteDebugErrorStringToLog) return pWriteDebugErrorStringToLog(CID, aError); else return -1; } // Is a specific client connection ok? int32_t CheckConnection(uint32_t CID) { if (pCheckConnection) return pCheckConnection(CID); else return -1; } // Devices : bit combination of spectrometers to combine // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t CombineSpectrometer(uint32_t CID, int32_t Devices) { if (pCombineSpectrometer) return pCombineSpectrometer(CID, Devices); else return -1; } int32_t GetSpectrometerStatus(uint32_t CID, int32_t SPU, TRTSpectrometerStatus& Status) { if (pGetSpectrometerStatus) return pGetSpectrometerStatus(CID, SPU, Status); else return -1; } int32_t SetDetectorCoolingMode(uint32_t CID, int32_t SPU, int32_t Det, int32_t aCoolingMode) { if (pSetDetectorCoolingMode) return pSetDetectorCoolingMode(CID, SPU, Det, aCoolingMode); else return -1; } int32_t ResetSpectrometerInterlock(uint32_t CID, int32_t SPU) { if (pResetSpectrometerInterlock) return pResetSpectrometerInterlock(CID, SPU); else return -1; } // Device : Number of spectrometer ( 1 in most cases ) // RealTime : Measure time in ms ( 0 means endless measurement ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t StartSpectrumMeasurement(uint32_t CID, int32_t Device, uint32_t RealTime) { if (pStartSpectrumMeasurement) return pStartSpectrumMeasurement(CID, Device, RealTime); else return -1; } // Device : Number of spectrometer ( 1 in most cases ) // LifeTime : Life time in ms ( > 0 ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t StartSpectrumLifeTimeMeasurement(uint32_t CID, int32_t Device, uint32_t LifeTime) { if (pStartSpectrumLifeTimeMeasurement) return pStartSpectrumLifeTimeMeasurement(CID, Device, LifeTime); else return -1; } // Device : Number of spectrometer ( 1 in most cases ) // StartEnergy, // EndEnergy : Spectrum region borders for counter measurement (in keV) // Counts : Counter value for automatic measurement stop // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t StartSpectrumCounterMeasurement(uint32_t CID, int32_t SPU, double StartEnergy, double EndEnergy, uint32_t Counts) { if (pStartSpectrumCounterMeasurement) return pStartSpectrumCounterMeasurement(CID, SPU, StartEnergy, EndEnergy, Counts); else return -1; } // Device : Number of spectrometer ( 1 in most cases ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t StopSpectrumMeasurement(uint32_t CID, int32_t Device) { if (pStopSpectrumMeasurement) return pStopSpectrumMeasurement(CID, Device); else return -1; } // Read some values about current aquisition // Device : Number of spectrometer ( 1 in most cases ) // Running : Aquisition active or not // State : State of aquisition in % ( 100 % means ready ) // PulseRate // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t GetSpectrumMeasureState(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate) { if (pGetSpectrumMeasureState) return pGetSpectrumMeasureState(CID, Device, Running, State, PulseRate); else return -1; } // Device : Number of spectrometer ( 1 in most cases ) // Running : Aquisition active or not // State : State of aquisition in % ( 100 % means ready ) // PulseRate : current input pulse rate in cps // RealTime : current measure time in ms // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t GetSpectrumMeasureStateEx(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate, int32_t& RealTime) { if (pGetSpectrumMeasureStateEx) return pGetSpectrumMeasureStateEx(CID, Device, Running, State, PulseRate, RealTime); else return -1; } // Read current spectrum from spectrometer to buffer // Device : Number of spectrometer ( 1 in most cases ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t ReadSpectrum(uint32_t CID, int32_t Device) { if (pReadSpectrum) return pReadSpectrum(CID, Device); else return -1; } int32_t GetSpectrometerConfiguration(uint32_t CID, int32_t SPU, uint32_t& MaxEnergy, uint32_t& PulseThroughput) { if (pGetSpectrometerConfiguration) return pGetSpectrometerConfiguration(CID, SPU, MaxEnergy, PulseThroughput); else return -1; } // Read current spectrometer configuration for a given detector int32_t GetSpectrometerConfigurationEx(uint32_t CID, int32_t SPU, int32_t Det, uint32_t& MaxEnergyIndex, uint32_t& PulseThroughputIndex) { if (pGetSpectrometerConfigurationEx) return pGetSpectrometerConfigurationEx(CID, SPU, Det, MaxEnergyIndex, PulseThroughputIndex); else return -1; } int32_t SetSpectrometerConfiguration(uint32_t CID, int32_t SPU, int32_t Det, const uint32_t MaxEnergyIndex, const uint32_t PulseThroughputIndex) { if (pSetSpectrometerConfiguration) return pSetSpectrometerConfiguration(CID, SPU, Det, MaxEnergyIndex, PulseThroughputIndex); else return -1; } // Detectors : Active Detectors as bitmask (1 shl 0, etc.) int32_t SetActiveDetectors(uint32_t CID, int32_t SPU, const uint32_t Detectors) { if (pSetActiveDetectors) return pSetActiveDetectors(CID, SPU, Detectors); else return -1; } // Detectors : Active Detectors as bitmask (1 shl 0, etc.) int32_t GetActiveDetectors(uint32_t CID, int32_t SPU, uint32_t& Detectors) { if (pGetActiveDetectors) return GetActiveDetectors(CID, SPU, Detectors); else return -1; } // Detectors : Available Detectors as bitmask (1 shl 0, etc.) int32_t GetAvailableDetectors(uint32_t CID, int32_t SPU, uint32_t& Detectors) { if (pGetAvailableDetectors) return pGetAvailableDetectors(CID, SPU, Detectors); else return -1; } // Detectors : Available WDSDetectors as bitmask (1 shl 0, etc.) int32_t GetAvailableWDSDetectors(uint32_t CID, int32_t SPU, uint32_t& Detectors) { if (pGetAvailableWDSDetectors) return pGetAvailableWDSDetectors(CID, SPU, Detectors); else return -1; } int32_t GetHardwareConfiguration(uint32_t CID, TRTHardwareConfiguration& aHardwareConfiguration) { if (pGetHardwareConfiguration) return pGetHardwareConfiguration(CID, aHardwareConfiguration); else return -1; } // Device : Number of spectrometer ( 1 in most cases ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t CalibrateSpectrometer(uint32_t CID, int32_t Device, bool ShowProgress, PRTCalibSettings Settings, PRTCalibResults Results) { if (pCalibrateSpectrometer) return pCalibrateSpectrometer(CID, Device, ShowProgress, Settings, Results); else return -1; } // Device : Number of spectrometer ( 1 in most cases ) // ParamName : Name of the parameter to read // Current implemented names: 'MaxEnergy', 'PulseThroughput', 'DetectorTemperature' as 'Integer' or 'Double' // ParamType : Type of the parameter to read (Byte,Boolean,Word,Integer,Double,Memory) // Buffer : Pointer to variable of that type // BufSize : if ParamType is Memory than BufSize if size of the memory block described by 'Buffer' // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t GetSpectrometerParam(uint32_t CID, int32_t Device, char* ParamName, char* ParamType, void* Buffer, int32_t BufSize) { if (pGetSpectrometerParam) return pGetSpectrometerParam(CID, Device, ParamName, ParamType, Buffer, BufSize); else return -1; } // Reads the amount of available spectrometers int32_t GetSpectrometerCount(uint32_t CID, int32_t& Value) { if (pGetSpectrometerCount) return pGetSpectrometerCount(CID, Value); else return -1; } // Gets SpectrometerRanges (Pulserate and EnergyRange) // MaxEnergy // PulseThroughPut // EnergyIndexCount // PulseIndexCount int32_t GetSpectrometerRanges(uint32_t CID, int32_t SPU, int32_t Det, TRTDetectorRanges& aDetectorSettings) { if (pGetSpectrometerRanges) return pGetSpectrometerRanges(CID, SPU, Det, aDetectorSettings); else return -1; } // Read full parameter block of current spectrometer params (needed to create full Bruker spectrum) int32_t GetSpectrometerParams(uint32_t CID, int32_t SPU, void* Buffer, int32_t& BufSize) { if (pGetSpectrometerParams) return pGetSpectrometerParams(CID, SPU, Buffer, BufSize); else return -1; } // Buffer : Buffer index ( 0 for loaded spectrum buffer, > 0 for spectrometer buffers ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t GetSpectrum(uint32_t CID, int32_t Buffer, PRTSpectrumHeaderRec pSpectrumBuf, int32_t BufSize) { if (pGetSpectrum) return pGetSpectrum(CID, Buffer, pSpectrumBuf, BufSize); else return -1; } // Device : Number of spectrometer ( 1 in most cases ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t QuantifySpectrum(uint32_t CID, int32_t Buffer, char* pMethodName, char* pParams, char* pResultBuf, int32_t ResultBufSize) { if (pQuantifySpectrum) return pQuantifySpectrum(CID, Buffer, pMethodName, pParams, pResultBuf, ResultBufSize); else return -1; } // Sends a RCL 2.2 command to spectrometer and returns the answer( see RCL 2.2 description of commands ) // Device : Number of spectrometer ( 1 in most cases ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t SendRCLCommand(uint32_t CID, int32_t Device, char* pCommand, char* pAnswer, int32_t AnswerBufSize) { if (pSendRCLCommand) return pSendRCLCommand(CID, Device, pCommand, pAnswer, AnswerBufSize); else return -1; } // Sends a RCL 2.2 command to spectrometer, does not wait for answer ( see RCL 2.2 description of commands ) int32_t SendRCLCommandOnly(uint32_t CID, int32_t Device, char* Command) { if (pSendRCLCommandOnly) return pSendRCLCommandOnly(CID, Device, Command); else return -1; } // Receives the answer of the above function int32_t ReceiveRCLAnswer(uint32_t CID, int32_t Device, char* Answer, int32_t AnswerBufSize) { if (pReceiveRCLAnswer) return pReceiveRCLAnswer(CID, Device, Answer, AnswerBufSize); else return -1; } // Interupts QM100's communication to specified device until 'UnlockSpectrometer' is called int32_t LockSpectrometer(uint32_t CID, int32_t Device) { if (pLockSpectrometer) return pLockSpectrometer(CID, Device); else return -1; } int32_t UnlockSpectrometer(uint32_t CID, int32_t Device) { if (pUnlockSpectrometer) return pUnlockSpectrometer(CID, Device); else return -1; } // Load spectrum from file to buffer // pFilename : Complete filename for spectrum ( normally with *.spx extension ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t LoadSpectrum(uint32_t CID, char* pFileName) { if (pLoadSpectrum) return pLoadSpectrum(CID, pFileName); else return -1; } // Send spectrum back to 'loaded' buffer // Spectrum : Bruker spectrum buffer // BufferSize : size of spectrum buffer // Result : Function call sucessful or not ( 0 = success, otherwise error ) // Remarks : if one wants to use that function one has to build a complete Bruker spectrum with // functions 'GetSpectrum', 'GetSpectrometerParams' and 'CreateSpectrum' int32_t PutSpectrum(uint32_t CID, void* Spectrum, int32_t BufSize) { if (pPutSpectrum) return pPutSpectrum(CID, Spectrum, BufSize); else return -1; } // Save spectrum buffer to file // pFilename : Complete filename for spectrum ( normally with *.spx extension ) // Result : Function call sucessful or not ( 0 = success, otherwise error ) int32_t SaveSpectrum(uint32_t CID, int32_t Buffer, char* pFileName) { if (pSaveSpectrum) return pSaveSpectrum(CID, Buffer, pFileName); else return -1; } // Create a complete Bruker spectrum from int32_t CreateSpectrum(char* SpectrometerParams, PRTSpectrumHeaderRec SpectrumData, char* ResultData, int32_t& ResultSize) { if (pCreateSpectrum) return pCreateSpectrum(SpectrometerParams, SpectrumData, ResultData, ResultSize); else return -1; } int32_t GetCorrectedSpectrum(char* SpectrometerParams, PRTSpectrumHeaderRec Spectrum, double* ResultData) { if (pGetCorrectedSpectrum) return pGetCorrectedSpectrum(SpectrometerParams, Spectrum, ResultData); else return -1; } int32_t ShowSpectrum(uint32_t CID, int32_t Buffer, char* Name) { if (pShowSpectrum) return pShowSpectrum(CID, Buffer, Name); else return -1; } int32_t DeleteSpectrum(uint32_t CID, char* aName) { if (pDeleteSpectrum) return pDeleteSpectrum(CID, aName); else return -1; } // Buffer : Buffer index ( 0 for loaded spectrum buffer, > 0 for spectrometer buffers ) // Width, // Height : Graphic dimension // Format : bmp, png, jpeg, tif // ResultBuf : should be able to save the whole image // ResultBufSize : input is maximum, output is really used int32_t GetSpectrumGraphic(uint32_t CID, int32_t Buffer, int32_t Width, int32_t Height, char* Format, void* ResultBuf, uint32_t& ResultBufSize) { if (pGetSpectrumGraphic) return pGetSpectrumGraphic(CID, Buffer, Width, Height, Format, ResultBuf, ResultBufSize); else return -1; } // Get a list of avaliable hardware profiles from client int32_t GetHardwareProfiles(uint32_t CID, char* pProfiles, int32_t BufSize) { if (pGetHardwareProfiles) return pGetHardwareProfiles(CID, pProfiles, BufSize); else return -1; } // Set a specific hardware profile int32_t SetHardwareProfile(uint32_t CID, char* pProfile) { if (pSetHardwareProfile) return pSetHardwareProfile(CID, pProfile); else return -1; } // Get a list of avaliable quantification methods int32_t GetQuantificationMethods(uint32_t CID, bool AutomaticOnly, char* pMethods, int32_t BufSize) { if (pGetQuantificationMethods) return pGetQuantificationMethods(CID, AutomaticOnly, pMethods, BufSize); else return -1; } // Get a list of predefined elements from a given quant method int32_t GetQuantificationMethodElements(uint32_t CID, char* MethodName, char* ElementBuffer, int32_t BufSize) { if (pGetQuantificationMethodElements) return pGetQuantificationMethodElements(CID, MethodName, ElementBuffer, BufSize); else return -1; } // Call method editor for a given quant method int32_t EditQuantificationMethod(uint32_t CID, char* MethodName) { if (pEditQuantificationMethod) return pEditQuantificationMethod(CID, MethodName); else return -1; } // Loads a method and saves it again. purpose: rename, conversion from mtd into mtdx int32_t CopyQuantificationMethod(uint32_t CID, char* MethodName, char* TargetName, bool ToProfile) { if (pCopyQuantificationMethod) return pCopyQuantificationMethod(CID, MethodName, TargetName, ToProfile); else return -1; } // Get a channel region for desired element and X ray line int32_t GetRegionForElement(uint32_t CID, int32_t Buffer, char* Params, char* ResultBuf, int32_t ResultBufSize) { if (pGetRegionForElement) return pGetRegionForElement(CID, Buffer, Params, ResultBuf, ResultBufSize); else return -1; } // HighVoltage : tube voltate [Volt] // Current : tube current [ľA] // FilterIndex : index of selected filter int32_t XRayTubeSetConfiguration(uint32_t CID, int32_t Tube, uint32_t HighVoltage, uint32_t Current, uint32_t FilterIndex) { if (pXRayTubeSetConfiguration) return pXRayTubeSetConfiguration(CID, Tube, HighVoltage, Current, FilterIndex); else return -1; } // HighVoltage : tube voltate [Volt] // Current : tube current [ľA] // FilterIndex : index of selected filter int32_t XRayTubeGetState(uint32_t CID, int32_t Tube, uint32_t& HighVoltage, uint32_t& Current, uint32_t& FilterIndex, bool& ShutterOpen) { if (pXRayTubeGetState) return pXRayTubeGetState(CID, Tube, HighVoltage, Current, FilterIndex, ShutterOpen); else return -1; } int32_t XRayTubeOpenShutter(uint32_t CID, int32_t Tube) { if (pXRayTubeOpenShutter) return pXRayTubeOpenShutter(CID, Tube); else return -1; } int32_t XRayTubeCloseShutter(uint32_t CID, int32_t Tube) { if (pXRayTubeCloseShutter) return pXRayTubeCloseShutter(CID, Tube); else return -1; } int32_t XRaySetActiveTube(uint32_t CID, int32_t Tube) { if (pXRaySetActiveTube) return pXRaySetActiveTube(CID, Tube); else return -1; } int32_t XRayGetActiveTube(uint32_t CID, int32_t& Tube) { if (pXRayGetActiveTube) return pXRayGetActiveTube(CID, Tube); else return -1; } int32_t XRayTubeHVOn(uint32_t CID, int32_t Tube, int32_t DestHV, int32_t DestCurrent, bool HVOn) { if (pXRayTubeHVOn) return pXRayTubeHVOn(CID, Tube, DestHV, DestCurrent, HVOn); else return -1; } int32_t SetImageExportParameter(uint32_t CID, int32_t ExportImageWidth, bool ExportWithOverlay) { if (pSetImageExportParameter) return pSetImageExportParameter(CID, ExportImageWidth, ExportWithOverlay); else return -1; } int32_t HyMapStop(uint32_t CID, bool WaitForFrameEnd) { if (pHyMapStop) return pHyMapStop(CID, WaitForFrameEnd); else return -1; } int32_t HyMapClearDatabase(uint32_t CID) { if (pHyMapClearDatabase) return pHyMapClearDatabase(CID); else return -1; } int32_t HyMapGetState(uint32_t CID, bool& Running, double& MeasureState) { if (pHyMapGetState) return pHyMapGetState(CID, Running, MeasureState); else return -1; } int32_t HyMapGetStateEx(uint32_t CID, bool& Running, double& MeasureState, int32_t& CurrentLine) { if (pHyMapGetStateEx) return pHyMapGetStateEx(CID, Running, MeasureState, CurrentLine); else return -1; } int32_t HyMapGetXYSpectrum(uint32_t CID, int32_t X, int32_t Y, bool Corrected, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize) { if (pHyMapGetXYSpectrum) return pHyMapGetXYSpectrum(CID, X, Y, Corrected, SpectrumBuffer, BufferSize); else return -1; } // SpectrumBuffer : pointer to array of pointers for spectra, must have space for 'Count' pointers, each with allocated space for a full spectrum int32_t HyMapGetLineSpectra(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize) { if (pHyMapGetLineSpectra) return pHyMapGetLineSpectra(CID, X, Y, Count, Corrected, SpectrumBuffer, BufferSize); else return -1; } // SpectrumBuffer : pointer to array of pointers for spectra, must have space for 'Count' pointers, each with allocated space for a full spectrum int32_t HyMapGetCompressedLineSpectra(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize) { if (pHyMapGetCompressedLineSpectra) return pHyMapGetCompressedLineSpectra(CID, X, Y, Count, Corrected, SpectrumBuffer, BufferSize); else return -1; } int32_t HyMapQuantifySpectra(uint32_t CID, PPointArray Points, int32_t PointCount, int32_t Binning, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize) { if (pHyMapQuantifySpectra) return pHyMapQuantifySpectra(CID, Points, PointCount, Binning, MethodName, Params, ResultBuf, ResultBufSize); else return -1; } // aFileName : file name int32_t HyMapSaveToFile(uint32_t CID, char* aFileName) { if (pHyMapSaveToFile) return pHyMapSaveToFile(CID, aFileName); else return -1; } // aFileName : file name int32_t HyMapLoadFromFile(unsigned _int32 CID, char* aFileName, int32_t& Width, int32_t& Height, int32_t& DetCount, int32_t& ImgCount) { if (pHyMapLoadFromFile) return pHyMapLoadFromFile(CID, aFileName, Width, Height, DetCount, ImgCount); else return -1; } // SpectrumBuffer : pointer to memory, must have space for one full spectrum // BufferSize : size of the above buffer int32_t HyMapGetMaxPixelSpectrum(uint32_t CID, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize) { if (pHyMapGetMaxPixelSpectrum) return pHyMapGetMaxPixelSpectrum(CID, SpectrumBuffer, BufferSize); else return -1; } // pMethodName : name of method to be used // pElementBuffer : buffer to get a list of atomic numbers as result of element identification // ElementBufSize : size of element buffer int32_t HyMapAutoIdent(uint32_t CID, char* pMethodName, char* pElementBuffer, int32_t ElementBufSize) { if (pHyMapAutoIdent) return pHyMapAutoIdent(CID, pMethodName, pElementBuffer, ElementBufSize); else return -1; } // Format : bmp, png, jpeg, tif // ImgChannel : the plane to be shown // Buffer : should be able to save the whole image // Buffersize : input is maximum, output is really used int32_t HyMapGetImage(uint32_t CID, char* Format, int32_t ImgChannel, void* Buffer, uint32_t& BufferSize) { if (pHyMapGetImage) return pHyMapGetImage(CID, Format, ImgChannel, Buffer, BufferSize); else return -1; } // ElementIndex : the plane to be shown // Buffer : should be able to save the whole image // Buffersize : input is maximum, output is really used int32_t HyMapGetElementData(uint32_t CID, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize) { if (pHyMapGetElementData) return pHyMapGetElementData(CID, ElementIndex, Buffer, BufferSize); else return -1; } // Format : bmp, png, jpeg, tif // ElementIndex : the plane to be shown // Buffer : should be able to save the whole image // Buffersize : input is maximum, output is really used int32_t HyMapGetElementImage(uint32_t CID, char* Format, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize) { if (pHyMapGetElementImage) return pHyMapGetElementImage(CID, Format, ElementIndex, Buffer, BufferSize); else return -1; } // Format : bmp, png, jpeg, tif // Buffer : should be able to save the whole image // Buffersize : input is maximum, output is really used int32_t HyMapGetMixedMapImage(uint32_t CID, char* Format, void* Buffer, uint32_t& BufferSize) { if (pHyMapGetMixedMapImage) return pHyMapGetMixedMapImage(CID, Format, Buffer, BufferSize); else return -1; } // ImgChannel : the plane to be shown // aFileName : file name int32_t HyMapSaveImage(uint32_t CID, int32_t ImgChannel, char* aFileName) { if (pHyMapSaveImage) return pHyMapSaveImage(CID, ImgChannel, aFileName); else return -1; } // ElementIndex : the plane to be shown // aFileName : file name int32_t HyMapSaveElementImage(uint32_t CID, int32_t ElementIndex, char* aFileName) { if (pHyMapSaveElementImage) return pHyMapSaveElementImage(CID, ElementIndex, aFileName); else return -1; } // aFileName : file name int32_t HyMapSaveMixedMapImage(uint32_t CID, char* aFileName) { if (pHyMapSaveMixedMapImage) return pHyMapSaveMixedMapImage(CID, aFileName); else return -1; } }