Bruker.API.CommonFunctions.cpp 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205
  1. /*
  2. Bruker.API.CommonFunctions.cpp
  3. Implementation for Bruker CommonFunctions used by Esprit- and M4-API
  4. Microsoft Visual Studio 2015
  5. */
  6. #include "stdafx.h"
  7. #include <windows.h>
  8. #include <stdio.h>
  9. #include <stdint.h>
  10. #include "Bruker.API.CommonFunctions.h"
  11. namespace BrukerDll
  12. {
  13. // type definitions for callback functions
  14. typedef int32_t (WINAPI *PSetLanguage)(char* Language);
  15. typedef int32_t (WINAPI *PQueryServers)(char* pServerList, int32_t BufSize);
  16. typedef int32_t (WINAPI *PQueryUser)(char* pServer, char* pClientBuf, int32_t BufSize);
  17. typedef int32_t (WINAPI *POpenClient)(char* pServer, char* pUser, char* pPassword, bool StartNew, bool GUI, uint32_t& CID);
  18. typedef int32_t (WINAPI *POpenClientEx)(char* pServer, char* pUser, char* pPassword, const TOpenClientOptions& Options, uint32_t& CID);
  19. typedef int32_t (WINAPI *POpenClientTCP)(char* pServer, char* pUser, char* pPassword, char* pHost, WORD Port, const TOpenClientOptions Options, uint32_t& CID);
  20. typedef int32_t (WINAPI *PQueryInfo)(uint32_t CID, char* pInfo, int32_t BufSize);
  21. typedef int32_t (WINAPI *PCloseConnection)(uint32_t CID);
  22. typedef int32_t (WINAPI *PCloseClient)(uint32_t CID);
  23. typedef int32_t (WINAPI *PGetDebugErrorString)(uint32_t CID, int32_t aError, char* pErrorStr, int32_t& BufSize);
  24. typedef int32_t (WINAPI *PWriteDebugErrorStringToLog)(uint32_t CID, int32_t aError);
  25. typedef int32_t (WINAPI *PCheckConnection)(uint32_t CID);
  26. typedef int32_t (WINAPI *PCombineSpectrometer)(uint32_t CID, int32_t Devices);
  27. typedef int32_t (WINAPI *PGetSpectrometerStatus)(uint32_t CID, int32_t SPU, TRTSpectrometerStatus& Status);
  28. typedef int32_t (WINAPI *PSetDetectorCoolingMode)(uint32_t CID, int32_t SPU, int32_t Det, int32_t aCoolingMode);
  29. typedef int32_t (WINAPI *PResetSpectrometerInterlock)(uint32_t CID, int32_t SPU);
  30. typedef int32_t (WINAPI *PStartSpectrumMeasurement)(uint32_t CID, int32_t Device, uint32_t RealTime);
  31. typedef int32_t (WINAPI *PStartSpectrumLifeTimeMeasurement)(uint32_t CID, int32_t Device, uint32_t LifeTime);
  32. typedef int32_t (WINAPI *PStartSpectrumCounterMeasurement)(uint32_t CID, int32_t SPU, double StartEnergy, double EndEnergy, uint32_t Counts);
  33. typedef int32_t (WINAPI *PStopSpectrumMeasurement)(uint32_t CID, int32_t Device);
  34. typedef int32_t (WINAPI *PGetSpectrumMeasureState)(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate);
  35. typedef int32_t (WINAPI *PGetSpectrumMeasureStateEx)(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate, int32_t& RealTime);
  36. typedef int32_t (WINAPI *PReadSpectrum)(uint32_t CID, int32_t Device);
  37. typedef int32_t (WINAPI *PGetSpectrometerConfiguration)(uint32_t CID, int32_t SPU, uint32_t& MaxEnergy, uint32_t& PulseThroughput);
  38. typedef int32_t (WINAPI *PGetSpectrometerConfigurationEx)(uint32_t CID, int32_t SPU, int32_t Det, uint32_t& MaxEnergyIndex, uint32_t& PulseThroughputIndex);
  39. typedef int32_t (WINAPI *PSetSpectrometerConfiguration)(uint32_t CID, int32_t SPU, int32_t Det, const uint32_t MaxEnergyIndex, const uint32_t PulseThroughputIndex);
  40. typedef int32_t (WINAPI *PSetActiveDetectors)(uint32_t CID, int32_t SPU, const uint32_t Detectors);
  41. typedef int32_t (WINAPI *PGetActiveDetectors)(uint32_t CID, int32_t SPU, uint32_t& Detectors);
  42. typedef int32_t (WINAPI *PGetAvailableDetectors)(uint32_t CID, int32_t SPU, uint32_t& Detectors);
  43. typedef int32_t (WINAPI *PGetAvailableWDSDetectors)(uint32_t CID, int32_t SPU, uint32_t& Detectors);
  44. typedef int32_t (WINAPI *PGetHardwareConfiguration)(uint32_t CID, TRTHardwareConfiguration& aHardwareConfiguration);
  45. typedef int32_t (WINAPI *PCalibrateSpectrometer)(uint32_t CID, int32_t Device, bool ShowProgress, PRTCalibSettings Settings, PRTCalibResults Results);
  46. typedef int32_t (WINAPI *PGetSpectrometerParam)(uint32_t CID, int32_t Device, char* ParamName, char* ParamType, void* Buffer, int32_t BufSize);
  47. typedef int32_t (WINAPI *PGetSpectrometerCount)(uint32_t CID, int32_t& Value);
  48. typedef int32_t (WINAPI *PGetSpectrometerRanges)(uint32_t CID, int32_t SPU, int32_t Det, TRTDetectorRanges& aDetectorSettings);
  49. typedef int32_t (WINAPI *PGetSpectrometerParams)(uint32_t CID, int32_t SPU, void* Buffer, int32_t& BufSize);
  50. typedef int32_t (WINAPI *PGetSpectrum)(uint32_t CID, int32_t Buffer, PRTSpectrumHeaderRec pSpectrumBuf, int32_t BufSize);
  51. typedef int32_t (WINAPI *PQuantifySpectrum)(uint32_t CID, int32_t Buffer, char* pMethodName, char* pParams, char* pResultBuf, int32_t ResultBufSize);
  52. typedef int32_t (WINAPI *PSendRCLCommand)(uint32_t CID, int32_t Device, char* pCommand, char* pAnswer, int32_t AnswerBufSize);
  53. typedef int32_t (WINAPI *PSendRCLCommandOnly)(uint32_t CID, int32_t Device, char* Command);
  54. typedef int32_t (WINAPI *PReceiveRCLAnswer)(uint32_t CID, int32_t Device, char* Answer, int32_t AnswerBufSize);
  55. typedef int32_t (WINAPI *PLockSpectrometer)(uint32_t CID, int32_t Device);
  56. typedef int32_t (WINAPI *PUnlockSpectrometer)(uint32_t CID, int32_t Device);
  57. typedef int32_t (WINAPI *PLoadSpectrum)(uint32_t CID, char* pFileName);
  58. typedef int32_t (WINAPI *PPutSpectrum)(uint32_t CID, void* Spectrum, int32_t BufSize);
  59. typedef int32_t (WINAPI *PSaveSpectrum)(uint32_t CID, int32_t Buffer, char* pFileName);
  60. typedef int32_t (WINAPI *PCreateSpectrum)(char* SpectrometerParams, PRTSpectrumHeaderRec SpectrumData, char* ResultData, int32_t& ResultSize);
  61. typedef int32_t (WINAPI *PGetCorrectedSpectrum)(char* SpectrometerParams, PRTSpectrumHeaderRec Spectrum, double* ResultData);
  62. typedef int32_t (WINAPI *PShowSpectrum)(uint32_t CID, int32_t Buffer, char* Name);
  63. typedef int32_t (WINAPI *PDeleteSpectrum)(uint32_t CID, char* aName);
  64. typedef int32_t (WINAPI *PGetSpectrumGraphic)(uint32_t CID, int32_t Buffer, int32_t Width, int32_t Height, char* Format, void* ResultBuf, uint32_t& ResultBufSize);
  65. typedef int32_t (WINAPI *PGetHardwareProfiles)(uint32_t CID, char* pProfiles, int32_t BufSize);
  66. typedef int32_t (WINAPI *PSetHardwareProfile)(uint32_t CID, char* pProfile);
  67. typedef int32_t (WINAPI *PGetQuantificationMethods)(uint32_t CID, bool AutomaticOnly, char* pMethods, int32_t BufSize);
  68. typedef int32_t (WINAPI *PGetQuantificationMethodElements)(uint32_t CID, char* MethodName, char* ElementBuffer, int32_t BufSize);
  69. typedef int32_t (WINAPI *PEditQuantificationMethod)(uint32_t CID, char* MethodName);
  70. typedef int32_t (WINAPI *PCopyQuantificationMethod)(uint32_t CID, char* MethodName, char* TargetName, bool ToProfile);
  71. typedef int32_t (WINAPI *PGetRegionForElement)(uint32_t CID, int32_t Buffer, char* Params, char* ResultBuf, int32_t ResultBufSize);
  72. typedef int32_t (WINAPI *PXRayTubeSetConfiguration)(uint32_t CID, int32_t Tube, uint32_t HighVoltage, uint32_t Current, uint32_t FilterIndex);
  73. typedef int32_t (WINAPI *PXRayTubeGetState)(uint32_t CID, int32_t Tube, uint32_t& HighVoltage, uint32_t& Current, uint32_t& FilterIndex, bool& ShutterOpen);
  74. typedef int32_t (WINAPI *PXRayTubeOpenShutter)(uint32_t CID, int32_t Tube);
  75. typedef int32_t (WINAPI *PXRayTubeCloseShutter)(uint32_t CID, int32_t Tube);
  76. typedef int32_t (WINAPI *PXRayTubeHVOn)(uint32_t CID, int32_t Tube, int32_t DestHV, int32_t DestCurrent, bool HVOn);
  77. typedef int32_t (WINAPI *PXRaySetActiveTube)(uint32_t CID, int32_t Tube);
  78. typedef int32_t (WINAPI *PXRayGetActiveTube)(uint32_t CID, int32_t& Tube);
  79. typedef int32_t (WINAPI *PSetImageExportParameter)(uint32_t CID, int32_t ExportImageWidth, bool ExportWithOverlay);
  80. typedef int32_t (WINAPI *PHyMapStop)(uint32_t CID, bool WaitForFrameEnd);
  81. typedef int32_t (WINAPI *PHyMapClearDatabase)(uint32_t CID);
  82. typedef int32_t (WINAPI *PHyMapGetState)(uint32_t CID, bool& Running, double& MeasureState);
  83. typedef int32_t (WINAPI *PHyMapGetStateEx)(uint32_t CID, bool& Running, double& MeasureState, int32_t& CurrentLine);
  84. typedef int32_t (WINAPI *PHyMapGetXYSpectrum)(uint32_t CID, int32_t X, int32_t Y, bool Corrected, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize);
  85. typedef int32_t (WINAPI *PHyMapGetLineSpectra)(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize);
  86. typedef int32_t (WINAPI *PHyMapGetCompressedLineSpectra)(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize);
  87. 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);
  88. typedef int32_t (WINAPI *PHyMapSaveToFile)(uint32_t CID, char* aFileName);
  89. typedef int32_t (WINAPI *PHyMapLoadFromFile)(unsigned _int32 CID, char* aFileName, int32_t& Width, int32_t& Height, int32_t& DetCount, int32_t& ImgCount);
  90. typedef int32_t (WINAPI *PHyMapGetMaxPixelSpectrum)(uint32_t CID, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize);
  91. typedef int32_t (WINAPI *PHyMapAutoIdent)(uint32_t CID, char* pMethodName, char* pElementBuffer, int32_t ElementBufSize);
  92. typedef int32_t (WINAPI *PHyMapGetImage)(uint32_t CID, char* Format, int32_t ImgChannel, void* Buffer, uint32_t& BufferSize);
  93. typedef int32_t (WINAPI *PHyMapGetElementData)(uint32_t CID, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize);
  94. typedef int32_t (WINAPI *PHyMapGetElementImage)(uint32_t CID, char* Format, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize);
  95. typedef int32_t (WINAPI *PHyMapGetMixedMapImage)(uint32_t CID, char* Format, void* Buffer, uint32_t& BufferSize);
  96. typedef int32_t (WINAPI *PHyMapSaveImage)(uint32_t CID, int32_t ImgChannel, char* aFileName);
  97. typedef int32_t (WINAPI *PHyMapSaveElementImage)(uint32_t CID, int32_t ElementIndex, char* aFileName);
  98. typedef int32_t (WINAPI *PHyMapSaveMixedMapImage)(uint32_t CID, char* aFileName);
  99. // DLL Handle
  100. HMODULE hDllBaseAddress;
  101. // global callback function pointers
  102. PSetLanguage pSetLanguage = NULL;
  103. PQueryServers pQueryServers = NULL;
  104. PQueryUser pQueryUser = NULL;
  105. POpenClient pOpenClient = NULL;
  106. POpenClientEx pOpenClientEx = NULL;
  107. POpenClientTCP pOpenClientTCP = NULL;
  108. PQueryInfo pQueryInfo = NULL;
  109. PCloseConnection pCloseConnection = NULL;
  110. PCloseClient pCloseClient = NULL;
  111. PGetDebugErrorString pGetDebugErrorString = NULL;
  112. PWriteDebugErrorStringToLog pWriteDebugErrorStringToLog = NULL;
  113. PCheckConnection pCheckConnection = NULL;
  114. PCombineSpectrometer pCombineSpectrometer = NULL;
  115. PGetSpectrometerStatus pGetSpectrometerStatus = NULL;
  116. PSetDetectorCoolingMode pSetDetectorCoolingMode = NULL;
  117. PResetSpectrometerInterlock pResetSpectrometerInterlock = NULL;
  118. PStartSpectrumMeasurement pStartSpectrumMeasurement = NULL;
  119. PStartSpectrumLifeTimeMeasurement pStartSpectrumLifeTimeMeasurement = NULL;
  120. PStartSpectrumCounterMeasurement pStartSpectrumCounterMeasurement = NULL;
  121. PStopSpectrumMeasurement pStopSpectrumMeasurement = NULL;
  122. PGetSpectrumMeasureState pGetSpectrumMeasureState = NULL;
  123. PGetSpectrumMeasureStateEx pGetSpectrumMeasureStateEx = NULL;
  124. PReadSpectrum pReadSpectrum = NULL;
  125. PGetSpectrometerConfiguration pGetSpectrometerConfiguration = NULL;
  126. PGetSpectrometerConfigurationEx pGetSpectrometerConfigurationEx = NULL;
  127. PSetSpectrometerConfiguration pSetSpectrometerConfiguration = NULL;
  128. PSetActiveDetectors pSetActiveDetectors = NULL;
  129. PGetActiveDetectors pGetActiveDetectors = NULL;
  130. PGetAvailableDetectors pGetAvailableDetectors = NULL;
  131. PGetAvailableWDSDetectors pGetAvailableWDSDetectors = NULL;
  132. PGetHardwareConfiguration pGetHardwareConfiguration = NULL;
  133. PCalibrateSpectrometer pCalibrateSpectrometer = NULL;
  134. PGetSpectrometerParam pGetSpectrometerParam = NULL;
  135. PGetSpectrometerCount pGetSpectrometerCount = NULL;
  136. PGetSpectrometerRanges pGetSpectrometerRanges = NULL;
  137. PGetSpectrometerParams pGetSpectrometerParams = NULL;
  138. PGetSpectrum pGetSpectrum = NULL;
  139. PQuantifySpectrum pQuantifySpectrum = NULL;
  140. PSendRCLCommand pSendRCLCommand = NULL;
  141. PSendRCLCommandOnly pSendRCLCommandOnly = NULL;
  142. PReceiveRCLAnswer pReceiveRCLAnswer = NULL;
  143. PLockSpectrometer pLockSpectrometer = NULL;
  144. PUnlockSpectrometer pUnlockSpectrometer = NULL;
  145. PLoadSpectrum pLoadSpectrum = NULL;
  146. PPutSpectrum pPutSpectrum = NULL;
  147. PSaveSpectrum pSaveSpectrum = NULL;
  148. PCreateSpectrum pCreateSpectrum = NULL;
  149. PGetCorrectedSpectrum pGetCorrectedSpectrum = NULL;
  150. PShowSpectrum pShowSpectrum = NULL;
  151. PDeleteSpectrum pDeleteSpectrum = NULL;
  152. PGetSpectrumGraphic pGetSpectrumGraphic = NULL;
  153. PGetHardwareProfiles pGetHardwareProfiles = NULL;
  154. PSetHardwareProfile pSetHardwareProfile = NULL;
  155. PGetQuantificationMethods pGetQuantificationMethods = NULL;
  156. PGetQuantificationMethodElements pGetQuantificationMethodElements = NULL;
  157. PEditQuantificationMethod pEditQuantificationMethod = NULL;
  158. PCopyQuantificationMethod pCopyQuantificationMethod = NULL;
  159. PGetRegionForElement pGetRegionForElement = NULL;
  160. PXRayTubeSetConfiguration pXRayTubeSetConfiguration = NULL;
  161. PXRayTubeGetState pXRayTubeGetState = NULL;
  162. PXRayTubeOpenShutter pXRayTubeOpenShutter = NULL;
  163. PXRayTubeCloseShutter pXRayTubeCloseShutter = NULL;
  164. PXRayTubeHVOn pXRayTubeHVOn = NULL;
  165. PXRaySetActiveTube pXRaySetActiveTube = NULL;
  166. PXRayGetActiveTube pXRayGetActiveTube = NULL;
  167. PSetImageExportParameter pSetImageExportParameter = NULL;
  168. PHyMapStop pHyMapStop = NULL;
  169. PHyMapClearDatabase pHyMapClearDatabase = NULL;
  170. PHyMapGetState pHyMapGetState = NULL;
  171. PHyMapGetStateEx pHyMapGetStateEx = NULL;
  172. PHyMapGetXYSpectrum pHyMapGetXYSpectrum = NULL;
  173. PHyMapGetLineSpectra pHyMapGetLineSpectra = NULL;
  174. PHyMapGetCompressedLineSpectra pHyMapGetCompressedLineSpectra = NULL;
  175. PHyMapQuantifySpectra pHyMapQuantifySpectra = NULL;
  176. PHyMapSaveToFile pHyMapSaveToFile = NULL;
  177. PHyMapLoadFromFile pHyMapLoadFromFile = NULL;
  178. PHyMapGetMaxPixelSpectrum pHyMapGetMaxPixelSpectrum = NULL;
  179. PHyMapAutoIdent pHyMapAutoIdent = NULL;
  180. PHyMapGetImage pHyMapGetImage = NULL;
  181. PHyMapGetElementData pHyMapGetElementData = NULL;
  182. PHyMapGetElementImage pHyMapGetElementImage = NULL;
  183. PHyMapGetMixedMapImage pHyMapGetMixedMapImage = NULL;
  184. PHyMapSaveImage pHyMapSaveImage = NULL;
  185. PHyMapSaveElementImage pHyMapSaveElementImage = NULL;
  186. PHyMapSaveMixedMapImage pHyMapSaveMixedMapImage = NULL;
  187. bool LoadCommonFunctions(LPCTSTR LibFile)
  188. {
  189. hDllBaseAddress = LoadLibrary(LibFile);
  190. if (!hDllBaseAddress)
  191. {
  192. DWORD lastError = GetLastError();
  193. TCHAR buf[200];
  194. int j = _stprintf_s(buf, 200, _T("CommonFunctions.cpp: Failed to load DLL %s \n"), LibFile);
  195. j += _stprintf_s(buf + j, 200 - j, _T("CommonFunctions.cpp: ErrorCode: %d \n"), lastError);
  196. OutputDebugString(buf);
  197. return false;
  198. }
  199. pSetLanguage = (PSetLanguage)GetProcAddress(hDllBaseAddress, "SetLanguage");
  200. if (!pSetLanguage) OutputDebugString(_T("Failed to Load DLL function SetLanguage\n"));
  201. pQueryServers = (PQueryServers)GetProcAddress(hDllBaseAddress, "QueryServers");
  202. if (!pQueryServers) OutputDebugString(_T("Failed to load DLL function QueryServers\n"));
  203. pQueryUser = (PQueryUser)GetProcAddress(hDllBaseAddress, "QueryUser");
  204. if (!pQueryUser) OutputDebugString(_T("Failed to load DLL function QueryUser\n"));
  205. pOpenClient = (POpenClient)GetProcAddress(hDllBaseAddress, "OpenClient");
  206. if (!pOpenClient) OutputDebugString(_T("Failed to load DLL function OpenClient\n"));
  207. pOpenClientEx = (POpenClientEx)GetProcAddress(hDllBaseAddress, "OpenClientEx");
  208. if (!pOpenClientEx) OutputDebugString(_T("Failed to load DLL function OpenClientEx\n"));
  209. pOpenClientTCP = (POpenClientTCP)GetProcAddress(hDllBaseAddress, "OpenClientTCP");
  210. if (!pOpenClientTCP) OutputDebugString(_T("Failed to load DLL function OpenClientTCP\n"));
  211. pQueryInfo = (PQueryInfo)GetProcAddress(hDllBaseAddress, "QueryInfo");
  212. if (!pQueryInfo) OutputDebugString(_T("Failed to load DLL function QueryInfo\n"));
  213. pCloseConnection = (PCloseConnection)GetProcAddress(hDllBaseAddress, "CloseConnection");
  214. if (!pCloseConnection) OutputDebugString(_T("Failed to load DLL function CloseConnection\n"));
  215. pCloseClient = (PCloseClient)GetProcAddress(hDllBaseAddress, "CloseClient");
  216. if (!pCloseClient) OutputDebugString(_T("Failed to load DLL function CloseClient\n"));
  217. pGetDebugErrorString = (PGetDebugErrorString)GetProcAddress(hDllBaseAddress, "GetDebugErrorString");
  218. if (!pGetDebugErrorString) OutputDebugString(_T("Failed to load DLL function GetDebugErrorString\n"));
  219. pWriteDebugErrorStringToLog = (PWriteDebugErrorStringToLog)GetProcAddress(hDllBaseAddress, "WriteDebugErrorStringToLog");
  220. if (!pWriteDebugErrorStringToLog) OutputDebugString(_T("Failed to load DLL function WriteDebugErrorStringToLog\n"));
  221. pCheckConnection = (PCheckConnection)GetProcAddress(hDllBaseAddress, "CheckConnection");
  222. if (!pCheckConnection) OutputDebugString(_T("Failed to load DLL function CheckConnection\n"));
  223. pCombineSpectrometer = (PCombineSpectrometer)GetProcAddress(hDllBaseAddress, "CombineSpectrometer");
  224. if (!pCombineSpectrometer) OutputDebugString(_T("Failed to load DLL function CombineSpectrometer\n"));
  225. pGetSpectrometerStatus = (PGetSpectrometerStatus)GetProcAddress(hDllBaseAddress, "GetSpectrometerStatus");
  226. if (!pGetSpectrometerStatus) OutputDebugString(_T("Failed to load DLL function GetSpectrometerStatus\n"));
  227. pSetDetectorCoolingMode = (PSetDetectorCoolingMode)GetProcAddress(hDllBaseAddress, "SetDetectorCoolingMode");
  228. if (!pSetDetectorCoolingMode) OutputDebugString(_T("Failed to load DLL function SetDetectorCoolingMode\n"));
  229. pResetSpectrometerInterlock = (PResetSpectrometerInterlock)GetProcAddress(hDllBaseAddress, "ResetSpectrometerInterlock");
  230. if (!pResetSpectrometerInterlock) OutputDebugString(_T("Failed to load DLL function ResetSpectrometerInterlock\n"));
  231. pStartSpectrumMeasurement = (PStartSpectrumMeasurement)GetProcAddress(hDllBaseAddress, "StartSpectrumMeasurement");
  232. if (!pStartSpectrumMeasurement) OutputDebugString(_T("Failed to load DLL function StartSpectrumMeasurement\n"));
  233. pStartSpectrumLifeTimeMeasurement = (PStartSpectrumLifeTimeMeasurement)GetProcAddress(hDllBaseAddress, "StartSpectrumLifeTimeMeasurement");
  234. if (!pStartSpectrumLifeTimeMeasurement) OutputDebugString(_T("Failed to load DLL function StartSpectrumLifeTimeMeasurement\n"));
  235. pStartSpectrumCounterMeasurement = (PStartSpectrumCounterMeasurement)GetProcAddress(hDllBaseAddress, "StartSpectrumCounterMeasurement");
  236. if (!pStartSpectrumCounterMeasurement) OutputDebugString(_T("Failed to load DLL function StartSpectrumCounterMeasurement\n"));
  237. pStopSpectrumMeasurement = (PStopSpectrumMeasurement)GetProcAddress(hDllBaseAddress, "StopSpectrumMeasurement");
  238. if (!pStopSpectrumMeasurement) OutputDebugString(_T("Failed to load DLL function StopSpectrumMeasurement\n"));
  239. pGetSpectrumMeasureState = (PGetSpectrumMeasureState)GetProcAddress(hDllBaseAddress, "GetSpectrumMeasureState");
  240. if (!pGetSpectrumMeasureState) OutputDebugString(_T("Failed to load DLL function GetSpectrumMeasureState\n"));
  241. pGetSpectrumMeasureStateEx = (PGetSpectrumMeasureStateEx)GetProcAddress(hDllBaseAddress, "GetSpectrumMeasureStateEx");
  242. if (!pGetSpectrumMeasureStateEx) OutputDebugString(_T("Failed to load DLL function GetSpectrumMeasureStateEx\n"));
  243. pReadSpectrum = (PReadSpectrum)GetProcAddress(hDllBaseAddress, "ReadSpectrum");
  244. if (!pReadSpectrum) OutputDebugString(_T("Failed to load DLL function ReadSpectrum\n"));
  245. pGetSpectrometerConfiguration = (PGetSpectrometerConfiguration)GetProcAddress(hDllBaseAddress, "GetSpectrometerConfiguration");
  246. if (!pGetSpectrometerConfiguration) OutputDebugString(_T("Failed to load DLL function GetSpectrometerConfiguration\n"));
  247. pGetSpectrometerConfigurationEx = (PGetSpectrometerConfigurationEx)GetProcAddress(hDllBaseAddress, "GetSpectrometerConfigurationEx");
  248. if (!pGetSpectrometerConfigurationEx) OutputDebugString(_T("Failed to load DLL function GetSpectrometerConfigurationEx\n"));
  249. pSetSpectrometerConfiguration = (PSetSpectrometerConfiguration)GetProcAddress(hDllBaseAddress, "SetSpectrometerConfiguration");
  250. if (!pSetSpectrometerConfiguration) OutputDebugString(_T("Failed to load DLL function SetSpectrometerConfiguration\n"));
  251. pSetActiveDetectors = (PSetActiveDetectors)GetProcAddress(hDllBaseAddress, "SetActiveDetectors");
  252. if (!pSetActiveDetectors) OutputDebugString(_T("Failed to load DLL function SetActiveDetectors\n"));
  253. pGetActiveDetectors = (PGetActiveDetectors)GetProcAddress(hDllBaseAddress, "GetActiveDetectors");
  254. if (!pGetActiveDetectors)OutputDebugString(_T("Failed to load DLL function GetActiveDetectors\n"));
  255. pGetAvailableDetectors = (PGetAvailableDetectors)GetProcAddress(hDllBaseAddress, "GetAvailableDetectors");
  256. if (!pGetAvailableDetectors) OutputDebugString(_T("Failed to load DLL function GetAvailableDetectors\n"));
  257. pGetAvailableWDSDetectors = (PGetAvailableWDSDetectors)GetProcAddress(hDllBaseAddress, "GetAvailableWDSDetectors");
  258. if (!pGetAvailableWDSDetectors) OutputDebugString(_T("Failed to load DLL function GetAvailableWDSDetectors\n"));
  259. pGetHardwareConfiguration = (PGetHardwareConfiguration)GetProcAddress(hDllBaseAddress, "GetHardwareConfiguration");
  260. if (!pGetHardwareConfiguration) OutputDebugString(_T("Failed to load DLL function GetHardwareConfiguration\n"));
  261. pCalibrateSpectrometer = (PCalibrateSpectrometer)GetProcAddress(hDllBaseAddress, "CalibrateSpectrometer");
  262. if (!pCalibrateSpectrometer) OutputDebugString(_T("Failed to load DLL function CalibrateSpectrometer\n"));
  263. pGetSpectrometerParam = (PGetSpectrometerParam)GetProcAddress(hDllBaseAddress, "GetSpectrometerParam");
  264. if (!pGetSpectrometerParam) OutputDebugString(_T("Failed to load DLL function GetSpectrometerParam\n"));
  265. pGetSpectrometerCount = (PGetSpectrometerCount)GetProcAddress(hDllBaseAddress, "GetSpectrometerCount");
  266. if (!pGetSpectrometerCount) OutputDebugString(_T("Failed to load DLL function GetSpectrometerCount\n"));
  267. pGetSpectrometerRanges = (PGetSpectrometerRanges)GetProcAddress(hDllBaseAddress, "GetSpectrometerRanges");
  268. if (!pGetSpectrometerRanges) OutputDebugString(_T("Failed to load DLL function GetSpectrometerRanges\n"));
  269. pGetSpectrometerParams = (PGetSpectrometerParams)GetProcAddress(hDllBaseAddress, "GetSpectrometerParams");
  270. if (!pGetSpectrometerParams) OutputDebugString(_T("Failed to load DLL function GetSpectrometerParams\n"));
  271. pGetSpectrum = (PGetSpectrum)GetProcAddress(hDllBaseAddress, "GetSpectrum");
  272. if (!pGetSpectrum) OutputDebugString(_T("Failed to load DLL function GetSpectrum\n"));
  273. pQuantifySpectrum = (PQuantifySpectrum)GetProcAddress(hDllBaseAddress, "QuantifySpectrum");
  274. if (!pQuantifySpectrum) OutputDebugString(_T("Failed to load DLL function QuantifySpectrum\n"));
  275. pSendRCLCommand = (PSendRCLCommand)GetProcAddress(hDllBaseAddress, "SendRCLCommand");
  276. if (!pSendRCLCommand) OutputDebugString(_T("Failed to load DLL funtion SendRCLCommand\n"));
  277. pSendRCLCommandOnly = (PSendRCLCommandOnly)GetProcAddress(hDllBaseAddress, "SendRCLCommandOnly");
  278. if (!pSendRCLCommandOnly) OutputDebugString(_T("Failed to load DLL function SendRCLCommandOnly\n"));
  279. pReceiveRCLAnswer = (PReceiveRCLAnswer)GetProcAddress(hDllBaseAddress, "ReceiveRCLAnswer");
  280. if (!pReceiveRCLAnswer) OutputDebugString(_T("Failed to load DLL function ReceiveRCLAnswer\n"));
  281. pLockSpectrometer = (PLockSpectrometer)GetProcAddress(hDllBaseAddress, "LockSpectrometer");
  282. if (!pLockSpectrometer) OutputDebugString(_T("Failed to load DLL function LockSpectrometer\n"));
  283. pUnlockSpectrometer = (PUnlockSpectrometer)GetProcAddress(hDllBaseAddress, "UnlockSpectrometer");
  284. if (!pUnlockSpectrometer) OutputDebugString(_T("Failed to load DLL function UnlockSpectrometer\n"));
  285. pLoadSpectrum = (PLoadSpectrum)GetProcAddress(hDllBaseAddress, "LoadSpectrum");
  286. if (!pLoadSpectrum) OutputDebugString(_T("Failed to load DLL function LoadSpectrum\n"));
  287. pPutSpectrum = (PPutSpectrum)GetProcAddress(hDllBaseAddress, "PutSpectrum");
  288. if (!pPutSpectrum) OutputDebugString(_T("Failed to load DLL function PutSpectrum\n"));
  289. pSaveSpectrum = (PSaveSpectrum)GetProcAddress(hDllBaseAddress, "SaveSpectrum");
  290. if (!pSaveSpectrum) OutputDebugString(_T("Failed to load DLL function SaveSpectrum\n"));
  291. pCreateSpectrum = (PCreateSpectrum)GetProcAddress(hDllBaseAddress, "CreateSpectrum");
  292. if (!pCreateSpectrum) OutputDebugString(_T("Failed to load DLL function CreateSpectrum\n"));
  293. pGetCorrectedSpectrum = (PGetCorrectedSpectrum)GetProcAddress(hDllBaseAddress, "GetCorrectedSpectrum");
  294. if (!pGetCorrectedSpectrum) OutputDebugString(_T("Failed to load DLL function GetCorrectedSpectrum\n"));
  295. pShowSpectrum = (PShowSpectrum)GetProcAddress(hDllBaseAddress, "ShowSpectrum");
  296. if (!pShowSpectrum) OutputDebugString(_T("Failed to load DLL function ShowSpectrum\n"));
  297. pDeleteSpectrum = (PDeleteSpectrum)GetProcAddress(hDllBaseAddress, "DeleteSpectrum");
  298. if (!pDeleteSpectrum) OutputDebugString(_T("Failed to load DLL function DeleteSpectrum\n"));
  299. pGetSpectrumGraphic = (PGetSpectrumGraphic)GetProcAddress(hDllBaseAddress, "GetSpectrumGraphic");
  300. if (!pGetSpectrumGraphic) OutputDebugString(_T("Failed to load DLL function GetSpectrumGraphic\n"));
  301. pGetHardwareProfiles = (PGetHardwareProfiles)GetProcAddress(hDllBaseAddress, "GetHardwareProfiles");
  302. if (!pGetHardwareProfiles) OutputDebugString(_T("Failed to load DLL function GetHardwareProfiles\n"));
  303. pSetHardwareProfile = (PSetHardwareProfile)GetProcAddress(hDllBaseAddress, "SetHardwareProfile");
  304. if (!pSetHardwareProfile) OutputDebugString(_T("Failed to load DLL function SetHardwareProfile\n"));
  305. pGetQuantificationMethods = (PGetQuantificationMethods)GetProcAddress(hDllBaseAddress, "GetQuantificationMethods");
  306. if (!pGetQuantificationMethods) OutputDebugString(_T("Failed to load DLL function GetQuantificationMethods\n"));
  307. pGetQuantificationMethodElements = (PGetQuantificationMethodElements)GetProcAddress(hDllBaseAddress, "GetQuantificationMethodElements");
  308. if (!pGetQuantificationMethodElements) OutputDebugString(_T("Failed to load DLL function GetQuantificationMethodElements\n"));
  309. pEditQuantificationMethod = (PEditQuantificationMethod)GetProcAddress(hDllBaseAddress, "EditQuantificationMethod");
  310. if (!pEditQuantificationMethod) OutputDebugString(_T("Failed to load DLL function EditQuantificationMethod\n"));
  311. pCopyQuantificationMethod = (PCopyQuantificationMethod)GetProcAddress(hDllBaseAddress, "CopyQuantificationMethod");
  312. if (!pCopyQuantificationMethod) OutputDebugString(_T("Failed to load DLL function CopyQuantificationMethod\n"));
  313. pGetRegionForElement = (PGetRegionForElement)GetProcAddress(hDllBaseAddress, "GetRegionForElement");
  314. if (!pGetRegionForElement) OutputDebugString(_T("Failed to load DLL function GetRegionForElement\n"));
  315. pXRayTubeSetConfiguration = (PXRayTubeSetConfiguration)GetProcAddress(hDllBaseAddress, "XRayTubeSetConfiguration");
  316. if (!pXRayTubeSetConfiguration) OutputDebugString(_T("Failed to load DLL function XRayTubeSetConfiguration\n"));
  317. pXRayTubeGetState = (PXRayTubeGetState)GetProcAddress(hDllBaseAddress, "XRayTubeGetState");
  318. if (!pXRayTubeGetState) OutputDebugString(_T("Failed to load DLL function XRayTubeGetState\n"));
  319. pXRayTubeOpenShutter = (PXRayTubeOpenShutter)GetProcAddress(hDllBaseAddress, "XRayTubeOpenShutter");
  320. if (!pXRayTubeOpenShutter) OutputDebugString(_T("Failed to load DLL function XRayTubeOpenShutter\n"));
  321. pXRayTubeCloseShutter = (PXRayTubeCloseShutter)GetProcAddress(hDllBaseAddress, "XRayTubeCloseShutter");
  322. if (!pXRayTubeCloseShutter) OutputDebugString(_T("Failed to load DLL function XRayTubeCloseShutter\n"));
  323. pXRayTubeHVOn = (PXRayTubeHVOn)GetProcAddress(hDllBaseAddress, "XRayTubeHVOn");
  324. if (!pXRayTubeHVOn) OutputDebugString(_T("Failed to load DLL function XRayTubeHVOn\n"));
  325. pXRaySetActiveTube = (PXRaySetActiveTube)GetProcAddress(hDllBaseAddress, "XRaySetActiveTube");
  326. if (!pXRaySetActiveTube) OutputDebugString(_T("Failed to load DLL function XRaySetActiveTube\n"));
  327. pXRayGetActiveTube = (PXRayGetActiveTube)GetProcAddress(hDllBaseAddress, "XRayGetActiveTube");
  328. if (!pXRayGetActiveTube) OutputDebugString(_T("Failed to load DLL function XRayGetActiveTube\n"));
  329. pSetImageExportParameter = (PSetImageExportParameter)GetProcAddress(hDllBaseAddress, "SetImageExportParameter");
  330. if (!pSetImageExportParameter) OutputDebugString(_T("Failed to load DLL function SetImageExportParameter\n"));
  331. pHyMapStop = (PHyMapStop)GetProcAddress(hDllBaseAddress, "HyMapStop");
  332. if (!pHyMapStop) OutputDebugString(_T("Failed to load DLL function HyMapStop\n"));
  333. pHyMapClearDatabase = (PHyMapClearDatabase)GetProcAddress(hDllBaseAddress, "HyMapClearDatabase");
  334. if (!pHyMapClearDatabase) OutputDebugString(_T("Failed to load DLL function HyMapClearDatabase\n"));
  335. pHyMapGetState = (PHyMapGetState)GetProcAddress(hDllBaseAddress, "HyMapGetState");
  336. if (!pHyMapGetState) OutputDebugString(_T("Failed to load DLL function HyMapGetState\n"));
  337. pHyMapGetStateEx = (PHyMapGetStateEx)GetProcAddress(hDllBaseAddress, "HyMapGetStateEx");
  338. if (!pHyMapGetStateEx) OutputDebugString(_T("Failed to load DLL function HyMapGetStateEx\n"));
  339. pHyMapGetXYSpectrum = (PHyMapGetXYSpectrum)GetProcAddress(hDllBaseAddress, "HyMapGetXYSpectrum");
  340. if (!pHyMapGetXYSpectrum) OutputDebugString(_T("Failed to load DLL function HyMapGetXYSpectrum\n"));
  341. pHyMapGetLineSpectra = (PHyMapGetLineSpectra)GetProcAddress(hDllBaseAddress, "HyMapGetLineSpectra");
  342. if (!pHyMapGetLineSpectra) OutputDebugString(_T("Failed to load DLL function HyMapGetLineSpectra\n"));
  343. pHyMapGetCompressedLineSpectra = (PHyMapGetCompressedLineSpectra)GetProcAddress(hDllBaseAddress, "HyMapGetCompressedLineSpectra");
  344. if (!pHyMapGetCompressedLineSpectra) OutputDebugString(_T("Failed to load DLL function HyMapGetCompressedLineSpectra\n"));
  345. pHyMapQuantifySpectra = (PHyMapQuantifySpectra)GetProcAddress(hDllBaseAddress, "HyMapQuantifySpectra");
  346. if (!pHyMapQuantifySpectra) OutputDebugString(_T("Failed to load DLL function HyMapQuantifySpectra\n"));
  347. pHyMapSaveToFile = (PHyMapSaveToFile)GetProcAddress(hDllBaseAddress, "HyMapSaveToFile");
  348. if (!pHyMapSaveToFile) OutputDebugString(_T("Failed to load DLL function HyMapSaveToFile\n"));
  349. pHyMapLoadFromFile = (PHyMapLoadFromFile)GetProcAddress(hDllBaseAddress, "HyMapLoadFromFile");
  350. if (!pHyMapLoadFromFile) OutputDebugString(_T("Failed to load DLL function HyMapLoadFromFile\n"));
  351. pHyMapGetMaxPixelSpectrum = (PHyMapGetMaxPixelSpectrum)GetProcAddress(hDllBaseAddress, "HyMapGetMaxPixelSpectrum");
  352. if (!pHyMapGetMaxPixelSpectrum) OutputDebugString(_T("Failed to load DLL function HyMapGetMaxPixelSpectrum\n"));
  353. pHyMapAutoIdent = (PHyMapAutoIdent)GetProcAddress(hDllBaseAddress, "HyMapAutoIdent");
  354. if (!pHyMapAutoIdent) OutputDebugString(_T("Failed to load DLL function HyMapAutoIdent\n"));
  355. pHyMapGetImage = (PHyMapGetImage)GetProcAddress(hDllBaseAddress, "HyMapGetImage");
  356. if (!pHyMapGetImage) OutputDebugString(_T("Failed to load DLL function HyMapGetImage\n"));
  357. pHyMapGetElementData = (PHyMapGetElementData)GetProcAddress(hDllBaseAddress, "HyMapGetElementData");
  358. if (!pHyMapGetElementData) OutputDebugString(_T("Failed to load DLL function HyMapGetElementData\n"));
  359. pHyMapGetElementImage = (PHyMapGetElementImage)GetProcAddress(hDllBaseAddress, "HyMapGetElementImage");
  360. if (!pHyMapGetElementImage) OutputDebugString(_T("Failed to load DLL function HyMapGetElementImage\n"));
  361. pHyMapGetMixedMapImage = (PHyMapGetMixedMapImage)GetProcAddress(hDllBaseAddress, "HyMapGetMixedMapImage");
  362. if (!pHyMapGetMixedMapImage) OutputDebugString(_T("Failed to load DLL function HyMapGetMixedMapImage\n"));
  363. pHyMapSaveImage = (PHyMapSaveImage)GetProcAddress(hDllBaseAddress, "HyMapSaveImage");
  364. if (!pHyMapSaveImage) OutputDebugString(_T("Failed to load DLL function HyMapSaveImage\n"));
  365. pHyMapSaveElementImage = (PHyMapSaveElementImage)GetProcAddress(hDllBaseAddress, "HyMapSaveElementImage");
  366. if (!pHyMapSaveElementImage) OutputDebugString(_T("Failed to load DLL function HyMapSaveElementImage\n"));
  367. pHyMapSaveMixedMapImage = (PHyMapSaveMixedMapImage)GetProcAddress(hDllBaseAddress, "HyMapSaveMixedMapImage");
  368. if (!pHyMapSaveMixedMapImage) OutputDebugString(_T("Failed to load DLL function HyMapSaveMixedMapImage\n"));
  369. return true;
  370. }
  371. // Converts Int-Value to String-Value
  372. std::string IntToString(int number)
  373. {
  374. std::ostringstream oss;
  375. oss << number;
  376. return oss.str();
  377. }
  378. // Converts Double-Value to String-Value
  379. std::string DoubleToString(double number)
  380. {
  381. std::ostringstream oss;
  382. oss.precision(4);
  383. oss << number;
  384. return oss.str();
  385. }
  386. int32_t SetLanguage(char* Language)
  387. {
  388. if (pSetLanguage)
  389. return pSetLanguage(Language);
  390. else return -1;
  391. }
  392. // Query all known servers for which can be used by client program
  393. int32_t QueryServers(char* pServerList, int32_t BufSize)
  394. {
  395. if (pQueryServers)
  396. return pQueryServers(pServerList, BufSize);
  397. else return -1;
  398. }
  399. // Query all running client programs for connected servers
  400. int32_t QueryUser(char* pServer, char* pClientBuf, int32_t BufSize)
  401. {
  402. if (pQueryUser)
  403. return pQueryUser(pServer, pClientBuf, BufSize);
  404. else return -1;
  405. }
  406. // Start Quantax program and login automatically
  407. // Password : Password of user with UserName
  408. // GUI : Whether to start the user interface or not
  409. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  410. int32_t OpenClient(char* pServer, char* pUser, char* pPassword, bool StartNew, bool GUI, uint32_t& CID)
  411. {
  412. if (pOpenClient)
  413. return pOpenClient(pServer, pUser, pPassword, StartNew, GUI, CID);
  414. else return -1;
  415. }
  416. int32_t OpenClientEx(char* pServer, char* pUser, char* pPassword, const TOpenClientOptions& Options, uint32_t& CID)
  417. {
  418. if (pOpenClientEx)
  419. return pOpenClientEx(pServer, pUser, pPassword, Options, CID);
  420. else return -1;
  421. }
  422. int32_t OpenClientTCP(char* pServer, char* pUser, char* pPassword, char* pHost, uint16_t Port, const TOpenClientOptions Options, uint32_t& CID)
  423. {
  424. if (pOpenClientTCP)
  425. return pOpenClientTCP(pServer, pUser, pPassword, pHost, Port, Options, CID);
  426. else return -1;
  427. }
  428. // query some information about a specific connection
  429. int32_t QueryInfo(uint32_t CID, char* pInfo, int32_t BufSize)
  430. {
  431. if (pQueryInfo)
  432. return pQueryInfo(CID, pInfo, BufSize);
  433. else return -1;
  434. }
  435. // Close current connection
  436. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  437. int32_t CloseConnection(uint32_t CID)
  438. {
  439. if (pCloseConnection)
  440. return pCloseConnection(CID);
  441. else return -1;
  442. }
  443. // Stop Quantax
  444. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  445. int32_t CloseClient(uint32_t CID)
  446. {
  447. if (pCloseClient)
  448. return pCloseClient(CID);
  449. else return -1;
  450. }
  451. // returns description string for error values
  452. int32_t GetDebugErrorString(uint32_t CID, int32_t aError, char* pErrorStr, int32_t& BufSize)
  453. {
  454. if (pGetDebugErrorString)
  455. return pGetDebugErrorString(CID, aError, pErrorStr, BufSize);
  456. else return -1;
  457. }
  458. // writes description string for error values to log
  459. int32_t WriteDebugErrorStringToLog(uint32_t CID, int32_t aError)
  460. {
  461. if (pWriteDebugErrorStringToLog)
  462. return pWriteDebugErrorStringToLog(CID, aError);
  463. else return -1;
  464. }
  465. // Is a specific client connection ok?
  466. int32_t CheckConnection(uint32_t CID)
  467. {
  468. if (pCheckConnection)
  469. return pCheckConnection(CID);
  470. else return -1;
  471. }
  472. // Devices : bit combination of spectrometers to combine
  473. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  474. int32_t CombineSpectrometer(uint32_t CID, int32_t Devices)
  475. {
  476. if (pCombineSpectrometer)
  477. return pCombineSpectrometer(CID, Devices);
  478. else return -1;
  479. }
  480. int32_t GetSpectrometerStatus(uint32_t CID, int32_t SPU, TRTSpectrometerStatus& Status)
  481. {
  482. if (pGetSpectrometerStatus)
  483. return pGetSpectrometerStatus(CID, SPU, Status);
  484. else return -1;
  485. }
  486. int32_t SetDetectorCoolingMode(uint32_t CID, int32_t SPU, int32_t Det, int32_t aCoolingMode)
  487. {
  488. if (pSetDetectorCoolingMode)
  489. return pSetDetectorCoolingMode(CID, SPU, Det, aCoolingMode);
  490. else return -1;
  491. }
  492. int32_t ResetSpectrometerInterlock(uint32_t CID, int32_t SPU)
  493. {
  494. if (pResetSpectrometerInterlock)
  495. return pResetSpectrometerInterlock(CID, SPU);
  496. else return -1;
  497. }
  498. // Device : Number of spectrometer ( 1 in most cases )
  499. // RealTime : Measure time in ms ( 0 means endless measurement )
  500. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  501. int32_t StartSpectrumMeasurement(uint32_t CID, int32_t Device, uint32_t RealTime)
  502. {
  503. if (pStartSpectrumMeasurement)
  504. return pStartSpectrumMeasurement(CID, Device, RealTime);
  505. else return -1;
  506. }
  507. // Device : Number of spectrometer ( 1 in most cases )
  508. // LifeTime : Life time in ms ( > 0 )
  509. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  510. int32_t StartSpectrumLifeTimeMeasurement(uint32_t CID, int32_t Device, uint32_t LifeTime)
  511. {
  512. if (pStartSpectrumLifeTimeMeasurement)
  513. return pStartSpectrumLifeTimeMeasurement(CID, Device, LifeTime);
  514. else return -1;
  515. }
  516. // Device : Number of spectrometer ( 1 in most cases )
  517. // StartEnergy,
  518. // EndEnergy : Spectrum region borders for counter measurement (in keV)
  519. // Counts : Counter value for automatic measurement stop
  520. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  521. int32_t StartSpectrumCounterMeasurement(uint32_t CID, int32_t SPU, double StartEnergy, double EndEnergy, uint32_t Counts)
  522. {
  523. if (pStartSpectrumCounterMeasurement)
  524. return pStartSpectrumCounterMeasurement(CID, SPU, StartEnergy, EndEnergy, Counts);
  525. else return -1;
  526. }
  527. // Device : Number of spectrometer ( 1 in most cases )
  528. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  529. int32_t StopSpectrumMeasurement(uint32_t CID, int32_t Device)
  530. {
  531. if (pStopSpectrumMeasurement)
  532. return pStopSpectrumMeasurement(CID, Device);
  533. else return -1;
  534. }
  535. // Read some values about current aquisition
  536. // Device : Number of spectrometer ( 1 in most cases )
  537. // Running : Aquisition active or not
  538. // State : State of aquisition in % ( 100 % means ready )
  539. // PulseRate
  540. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  541. int32_t GetSpectrumMeasureState(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate)
  542. {
  543. if (pGetSpectrumMeasureState)
  544. return pGetSpectrumMeasureState(CID, Device, Running, State, PulseRate);
  545. else return -1;
  546. }
  547. // Device : Number of spectrometer ( 1 in most cases )
  548. // Running : Aquisition active or not
  549. // State : State of aquisition in % ( 100 % means ready )
  550. // PulseRate : current input pulse rate in cps
  551. // RealTime : current measure time in ms
  552. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  553. int32_t GetSpectrumMeasureStateEx(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate, int32_t& RealTime)
  554. {
  555. if (pGetSpectrumMeasureStateEx)
  556. return pGetSpectrumMeasureStateEx(CID, Device, Running, State, PulseRate, RealTime);
  557. else return -1;
  558. }
  559. // Read current spectrum from spectrometer to buffer
  560. // Device : Number of spectrometer ( 1 in most cases )
  561. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  562. int32_t ReadSpectrum(uint32_t CID, int32_t Device)
  563. {
  564. if (pReadSpectrum)
  565. return pReadSpectrum(CID, Device);
  566. else return -1;
  567. }
  568. int32_t GetSpectrometerConfiguration(uint32_t CID, int32_t SPU, uint32_t& MaxEnergy, uint32_t& PulseThroughput)
  569. {
  570. if (pGetSpectrometerConfiguration)
  571. return pGetSpectrometerConfiguration(CID, SPU, MaxEnergy, PulseThroughput);
  572. else return -1;
  573. }
  574. // Read current spectrometer configuration for a given detector
  575. int32_t GetSpectrometerConfigurationEx(uint32_t CID, int32_t SPU, int32_t Det, uint32_t& MaxEnergyIndex, uint32_t& PulseThroughputIndex)
  576. {
  577. if (pGetSpectrometerConfigurationEx)
  578. return pGetSpectrometerConfigurationEx(CID, SPU, Det, MaxEnergyIndex, PulseThroughputIndex);
  579. else return -1;
  580. }
  581. int32_t SetSpectrometerConfiguration(uint32_t CID, int32_t SPU, int32_t Det, const uint32_t MaxEnergyIndex, const uint32_t PulseThroughputIndex)
  582. {
  583. if (pSetSpectrometerConfiguration)
  584. return pSetSpectrometerConfiguration(CID, SPU, Det, MaxEnergyIndex, PulseThroughputIndex);
  585. else return -1;
  586. }
  587. // Detectors : Active Detectors as bitmask (1 shl 0, etc.)
  588. int32_t SetActiveDetectors(uint32_t CID, int32_t SPU, const uint32_t Detectors)
  589. {
  590. if (pSetActiveDetectors)
  591. return pSetActiveDetectors(CID, SPU, Detectors);
  592. else return -1;
  593. }
  594. // Detectors : Active Detectors as bitmask (1 shl 0, etc.)
  595. int32_t GetActiveDetectors(uint32_t CID, int32_t SPU, uint32_t& Detectors)
  596. {
  597. if (pGetActiveDetectors)
  598. return GetActiveDetectors(CID, SPU, Detectors);
  599. else return -1;
  600. }
  601. // Detectors : Available Detectors as bitmask (1 shl 0, etc.)
  602. int32_t GetAvailableDetectors(uint32_t CID, int32_t SPU, uint32_t& Detectors)
  603. {
  604. if (pGetAvailableDetectors)
  605. return pGetAvailableDetectors(CID, SPU, Detectors);
  606. else return -1;
  607. }
  608. // Detectors : Available WDSDetectors as bitmask (1 shl 0, etc.)
  609. int32_t GetAvailableWDSDetectors(uint32_t CID, int32_t SPU, uint32_t& Detectors)
  610. {
  611. if (pGetAvailableWDSDetectors)
  612. return pGetAvailableWDSDetectors(CID, SPU, Detectors);
  613. else return -1;
  614. }
  615. int32_t GetHardwareConfiguration(uint32_t CID, TRTHardwareConfiguration& aHardwareConfiguration)
  616. {
  617. if (pGetHardwareConfiguration)
  618. return pGetHardwareConfiguration(CID, aHardwareConfiguration);
  619. else return -1;
  620. }
  621. // Device : Number of spectrometer ( 1 in most cases )
  622. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  623. int32_t CalibrateSpectrometer(uint32_t CID, int32_t Device, bool ShowProgress, PRTCalibSettings Settings, PRTCalibResults Results)
  624. {
  625. if (pCalibrateSpectrometer)
  626. return pCalibrateSpectrometer(CID, Device, ShowProgress, Settings, Results);
  627. else return -1;
  628. }
  629. // Device : Number of spectrometer ( 1 in most cases )
  630. // ParamName : Name of the parameter to read
  631. // Current implemented names: 'MaxEnergy', 'PulseThroughput', 'DetectorTemperature' as 'Integer' or 'Double'
  632. // ParamType : Type of the parameter to read (Byte,Boolean,Word,Integer,Double,Memory)
  633. // Buffer : Pointer to variable of that type
  634. // BufSize : if ParamType is Memory than BufSize if size of the memory block described by 'Buffer'
  635. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  636. int32_t GetSpectrometerParam(uint32_t CID, int32_t Device, char* ParamName, char* ParamType, void* Buffer, int32_t BufSize)
  637. {
  638. if (pGetSpectrometerParam)
  639. return pGetSpectrometerParam(CID, Device, ParamName, ParamType, Buffer, BufSize);
  640. else return -1;
  641. }
  642. // Reads the amount of available spectrometers
  643. int32_t GetSpectrometerCount(uint32_t CID, int32_t& Value)
  644. {
  645. if (pGetSpectrometerCount)
  646. return pGetSpectrometerCount(CID, Value);
  647. else return -1;
  648. }
  649. // Gets SpectrometerRanges (Pulserate and EnergyRange)
  650. // MaxEnergy
  651. // PulseThroughPut
  652. // EnergyIndexCount
  653. // PulseIndexCount
  654. int32_t GetSpectrometerRanges(uint32_t CID, int32_t SPU, int32_t Det, TRTDetectorRanges& aDetectorSettings)
  655. {
  656. if (pGetSpectrometerRanges)
  657. return pGetSpectrometerRanges(CID, SPU, Det, aDetectorSettings);
  658. else return -1;
  659. }
  660. // Read full parameter block of current spectrometer params (needed to create full Bruker spectrum)
  661. int32_t GetSpectrometerParams(uint32_t CID, int32_t SPU, void* Buffer, int32_t& BufSize)
  662. {
  663. if (pGetSpectrometerParams)
  664. return pGetSpectrometerParams(CID, SPU, Buffer, BufSize);
  665. else return -1;
  666. }
  667. // Buffer : Buffer index ( 0 for loaded spectrum buffer, > 0 for spectrometer buffers )
  668. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  669. int32_t GetSpectrum(uint32_t CID, int32_t Buffer, PRTSpectrumHeaderRec pSpectrumBuf, int32_t BufSize)
  670. {
  671. if (pGetSpectrum)
  672. return pGetSpectrum(CID, Buffer, pSpectrumBuf, BufSize);
  673. else return -1;
  674. }
  675. // Device : Number of spectrometer ( 1 in most cases )
  676. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  677. int32_t QuantifySpectrum(uint32_t CID, int32_t Buffer, char* pMethodName, char* pParams, char* pResultBuf, int32_t ResultBufSize)
  678. {
  679. if (pQuantifySpectrum)
  680. return pQuantifySpectrum(CID, Buffer, pMethodName, pParams, pResultBuf, ResultBufSize);
  681. else return -1;
  682. }
  683. // Sends a RCL 2.2 command to spectrometer and returns the answer( see RCL 2.2 description of commands )
  684. // Device : Number of spectrometer ( 1 in most cases )
  685. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  686. int32_t SendRCLCommand(uint32_t CID, int32_t Device, char* pCommand, char* pAnswer, int32_t AnswerBufSize)
  687. {
  688. if (pSendRCLCommand)
  689. return pSendRCLCommand(CID, Device, pCommand, pAnswer, AnswerBufSize);
  690. else return -1;
  691. }
  692. // Sends a RCL 2.2 command to spectrometer, does not wait for answer ( see RCL 2.2 description of commands )
  693. int32_t SendRCLCommandOnly(uint32_t CID, int32_t Device, char* Command)
  694. {
  695. if (pSendRCLCommandOnly)
  696. return pSendRCLCommandOnly(CID, Device, Command);
  697. else return -1;
  698. }
  699. // Receives the answer of the above function
  700. int32_t ReceiveRCLAnswer(uint32_t CID, int32_t Device, char* Answer, int32_t AnswerBufSize)
  701. {
  702. if (pReceiveRCLAnswer)
  703. return pReceiveRCLAnswer(CID, Device, Answer, AnswerBufSize);
  704. else return -1;
  705. }
  706. // Interupts QM100's communication to specified device until 'UnlockSpectrometer' is called
  707. int32_t LockSpectrometer(uint32_t CID, int32_t Device)
  708. {
  709. if (pLockSpectrometer)
  710. return pLockSpectrometer(CID, Device);
  711. else return -1;
  712. }
  713. int32_t UnlockSpectrometer(uint32_t CID, int32_t Device)
  714. {
  715. if (pUnlockSpectrometer)
  716. return pUnlockSpectrometer(CID, Device);
  717. else return -1;
  718. }
  719. // Load spectrum from file to buffer
  720. // pFilename : Complete filename for spectrum ( normally with *.spx extension )
  721. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  722. int32_t LoadSpectrum(uint32_t CID, char* pFileName)
  723. {
  724. if (pLoadSpectrum)
  725. return pLoadSpectrum(CID, pFileName);
  726. else return -1;
  727. }
  728. // Send spectrum back to 'loaded' buffer
  729. // Spectrum : Bruker spectrum buffer
  730. // BufferSize : size of spectrum buffer
  731. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  732. // Remarks : if one wants to use that function one has to build a complete Bruker spectrum with
  733. // functions 'GetSpectrum', 'GetSpectrometerParams' and 'CreateSpectrum'
  734. int32_t PutSpectrum(uint32_t CID, void* Spectrum, int32_t BufSize)
  735. {
  736. if (pPutSpectrum)
  737. return pPutSpectrum(CID, Spectrum, BufSize);
  738. else return -1;
  739. }
  740. // Save spectrum buffer to file
  741. // pFilename : Complete filename for spectrum ( normally with *.spx extension )
  742. // Result : Function call sucessful or not ( 0 = success, otherwise error )
  743. int32_t SaveSpectrum(uint32_t CID, int32_t Buffer, char* pFileName)
  744. {
  745. if (pSaveSpectrum)
  746. return pSaveSpectrum(CID, Buffer, pFileName);
  747. else return -1;
  748. }
  749. // Create a complete Bruker spectrum from
  750. int32_t CreateSpectrum(char* SpectrometerParams, PRTSpectrumHeaderRec SpectrumData, char* ResultData, int32_t& ResultSize)
  751. {
  752. if (pCreateSpectrum)
  753. return pCreateSpectrum(SpectrometerParams, SpectrumData, ResultData, ResultSize);
  754. else return -1;
  755. }
  756. int32_t GetCorrectedSpectrum(char* SpectrometerParams, PRTSpectrumHeaderRec Spectrum, double* ResultData)
  757. {
  758. if (pGetCorrectedSpectrum)
  759. return pGetCorrectedSpectrum(SpectrometerParams, Spectrum, ResultData);
  760. else return -1;
  761. }
  762. int32_t ShowSpectrum(uint32_t CID, int32_t Buffer, char* Name)
  763. {
  764. if (pShowSpectrum)
  765. return pShowSpectrum(CID, Buffer, Name);
  766. else return -1;
  767. }
  768. int32_t DeleteSpectrum(uint32_t CID, char* aName)
  769. {
  770. if (pDeleteSpectrum)
  771. return pDeleteSpectrum(CID, aName);
  772. else return -1;
  773. }
  774. // Buffer : Buffer index ( 0 for loaded spectrum buffer, > 0 for spectrometer buffers )
  775. // Width,
  776. // Height : Graphic dimension
  777. // Format : bmp, png, jpeg, tif
  778. // ResultBuf : should be able to save the whole image
  779. // ResultBufSize : input is maximum, output is really used
  780. int32_t GetSpectrumGraphic(uint32_t CID, int32_t Buffer, int32_t Width, int32_t Height, char* Format, void* ResultBuf, uint32_t& ResultBufSize)
  781. {
  782. if (pGetSpectrumGraphic)
  783. return pGetSpectrumGraphic(CID, Buffer, Width, Height, Format, ResultBuf, ResultBufSize);
  784. else return -1;
  785. }
  786. // Get a list of avaliable hardware profiles from client
  787. int32_t GetHardwareProfiles(uint32_t CID, char* pProfiles, int32_t BufSize)
  788. {
  789. if (pGetHardwareProfiles)
  790. return pGetHardwareProfiles(CID, pProfiles, BufSize);
  791. else return -1;
  792. }
  793. // Set a specific hardware profile
  794. int32_t SetHardwareProfile(uint32_t CID, char* pProfile)
  795. {
  796. if (pSetHardwareProfile)
  797. return pSetHardwareProfile(CID, pProfile);
  798. else return -1;
  799. }
  800. // Get a list of avaliable quantification methods
  801. int32_t GetQuantificationMethods(uint32_t CID, bool AutomaticOnly, char* pMethods, int32_t BufSize)
  802. {
  803. if (pGetQuantificationMethods)
  804. return pGetQuantificationMethods(CID, AutomaticOnly, pMethods, BufSize);
  805. else return -1;
  806. }
  807. // Get a list of predefined elements from a given quant method
  808. int32_t GetQuantificationMethodElements(uint32_t CID, char* MethodName, char* ElementBuffer, int32_t BufSize)
  809. {
  810. if (pGetQuantificationMethodElements)
  811. return pGetQuantificationMethodElements(CID, MethodName, ElementBuffer, BufSize);
  812. else return -1;
  813. }
  814. // Call method editor for a given quant method
  815. int32_t EditQuantificationMethod(uint32_t CID, char* MethodName)
  816. {
  817. if (pEditQuantificationMethod)
  818. return pEditQuantificationMethod(CID, MethodName);
  819. else return -1;
  820. }
  821. // Loads a method and saves it again. purpose: rename, conversion from mtd into mtdx
  822. int32_t CopyQuantificationMethod(uint32_t CID, char* MethodName, char* TargetName, bool ToProfile)
  823. {
  824. if (pCopyQuantificationMethod)
  825. return pCopyQuantificationMethod(CID, MethodName, TargetName, ToProfile);
  826. else return -1;
  827. }
  828. // Get a channel region for desired element and X ray line
  829. int32_t GetRegionForElement(uint32_t CID, int32_t Buffer, char* Params, char* ResultBuf, int32_t ResultBufSize)
  830. {
  831. if (pGetRegionForElement)
  832. return pGetRegionForElement(CID, Buffer, Params, ResultBuf, ResultBufSize);
  833. else return -1;
  834. }
  835. // HighVoltage : tube voltate [Volt]
  836. // Current : tube current [µA]
  837. // FilterIndex : index of selected filter
  838. int32_t XRayTubeSetConfiguration(uint32_t CID, int32_t Tube, uint32_t HighVoltage, uint32_t Current, uint32_t FilterIndex)
  839. {
  840. if (pXRayTubeSetConfiguration)
  841. return pXRayTubeSetConfiguration(CID, Tube, HighVoltage, Current, FilterIndex);
  842. else return -1;
  843. }
  844. // HighVoltage : tube voltate [Volt]
  845. // Current : tube current [µA]
  846. // FilterIndex : index of selected filter
  847. int32_t XRayTubeGetState(uint32_t CID, int32_t Tube, uint32_t& HighVoltage, uint32_t& Current, uint32_t& FilterIndex, bool& ShutterOpen)
  848. {
  849. if (pXRayTubeGetState)
  850. return pXRayTubeGetState(CID, Tube, HighVoltage, Current, FilterIndex, ShutterOpen);
  851. else return -1;
  852. }
  853. int32_t XRayTubeOpenShutter(uint32_t CID, int32_t Tube)
  854. {
  855. if (pXRayTubeOpenShutter)
  856. return pXRayTubeOpenShutter(CID, Tube);
  857. else return -1;
  858. }
  859. int32_t XRayTubeCloseShutter(uint32_t CID, int32_t Tube)
  860. {
  861. if (pXRayTubeCloseShutter)
  862. return pXRayTubeCloseShutter(CID, Tube);
  863. else return -1;
  864. }
  865. int32_t XRaySetActiveTube(uint32_t CID, int32_t Tube)
  866. {
  867. if (pXRaySetActiveTube)
  868. return pXRaySetActiveTube(CID, Tube);
  869. else return -1;
  870. }
  871. int32_t XRayGetActiveTube(uint32_t CID, int32_t& Tube)
  872. {
  873. if (pXRayGetActiveTube)
  874. return pXRayGetActiveTube(CID, Tube);
  875. else return -1;
  876. }
  877. int32_t XRayTubeHVOn(uint32_t CID, int32_t Tube, int32_t DestHV, int32_t DestCurrent, bool HVOn)
  878. {
  879. if (pXRayTubeHVOn)
  880. return pXRayTubeHVOn(CID, Tube, DestHV, DestCurrent, HVOn);
  881. else return -1;
  882. }
  883. int32_t SetImageExportParameter(uint32_t CID, int32_t ExportImageWidth, bool ExportWithOverlay)
  884. {
  885. if (pSetImageExportParameter)
  886. return pSetImageExportParameter(CID, ExportImageWidth, ExportWithOverlay);
  887. else return -1;
  888. }
  889. int32_t HyMapStop(uint32_t CID, bool WaitForFrameEnd)
  890. {
  891. if (pHyMapStop)
  892. return pHyMapStop(CID, WaitForFrameEnd);
  893. else return -1;
  894. }
  895. int32_t HyMapClearDatabase(uint32_t CID)
  896. {
  897. if (pHyMapClearDatabase)
  898. return pHyMapClearDatabase(CID);
  899. else return -1;
  900. }
  901. int32_t HyMapGetState(uint32_t CID, bool& Running, double& MeasureState)
  902. {
  903. if (pHyMapGetState)
  904. return pHyMapGetState(CID, Running, MeasureState);
  905. else return -1;
  906. }
  907. int32_t HyMapGetStateEx(uint32_t CID, bool& Running, double& MeasureState, int32_t& CurrentLine)
  908. {
  909. if (pHyMapGetStateEx)
  910. return pHyMapGetStateEx(CID, Running, MeasureState, CurrentLine);
  911. else return -1;
  912. }
  913. int32_t HyMapGetXYSpectrum(uint32_t CID, int32_t X, int32_t Y, bool Corrected, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize)
  914. {
  915. if (pHyMapGetXYSpectrum)
  916. return pHyMapGetXYSpectrum(CID, X, Y, Corrected, SpectrumBuffer, BufferSize);
  917. else return -1;
  918. }
  919. // SpectrumBuffer : pointer to array of pointers for spectra, must have space for 'Count' pointers, each with allocated space for a full spectrum
  920. int32_t HyMapGetLineSpectra(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize)
  921. {
  922. if (pHyMapGetLineSpectra)
  923. return pHyMapGetLineSpectra(CID, X, Y, Count, Corrected, SpectrumBuffer, BufferSize);
  924. else return -1;
  925. }
  926. // SpectrumBuffer : pointer to array of pointers for spectra, must have space for 'Count' pointers, each with allocated space for a full spectrum
  927. int32_t HyMapGetCompressedLineSpectra(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize)
  928. {
  929. if (pHyMapGetCompressedLineSpectra)
  930. return pHyMapGetCompressedLineSpectra(CID, X, Y, Count, Corrected, SpectrumBuffer, BufferSize);
  931. else return -1;
  932. }
  933. int32_t HyMapQuantifySpectra(uint32_t CID, PPointArray Points, int32_t PointCount, int32_t Binning, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize)
  934. {
  935. if (pHyMapQuantifySpectra)
  936. return pHyMapQuantifySpectra(CID, Points, PointCount, Binning, MethodName, Params, ResultBuf, ResultBufSize);
  937. else return -1;
  938. }
  939. // aFileName : file name
  940. int32_t HyMapSaveToFile(uint32_t CID, char* aFileName)
  941. {
  942. if (pHyMapSaveToFile)
  943. return pHyMapSaveToFile(CID, aFileName);
  944. else return -1;
  945. }
  946. // aFileName : file name
  947. int32_t HyMapLoadFromFile(unsigned _int32 CID, char* aFileName, int32_t& Width, int32_t& Height, int32_t& DetCount, int32_t& ImgCount)
  948. {
  949. if (pHyMapLoadFromFile)
  950. return pHyMapLoadFromFile(CID, aFileName, Width, Height, DetCount, ImgCount);
  951. else return -1;
  952. }
  953. // SpectrumBuffer : pointer to memory, must have space for one full spectrum
  954. // BufferSize : size of the above buffer
  955. int32_t HyMapGetMaxPixelSpectrum(uint32_t CID, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize)
  956. {
  957. if (pHyMapGetMaxPixelSpectrum)
  958. return pHyMapGetMaxPixelSpectrum(CID, SpectrumBuffer, BufferSize);
  959. else return -1;
  960. }
  961. // pMethodName : name of method to be used
  962. // pElementBuffer : buffer to get a list of atomic numbers as result of element identification
  963. // ElementBufSize : size of element buffer
  964. int32_t HyMapAutoIdent(uint32_t CID, char* pMethodName, char* pElementBuffer, int32_t ElementBufSize)
  965. {
  966. if (pHyMapAutoIdent)
  967. return pHyMapAutoIdent(CID, pMethodName, pElementBuffer, ElementBufSize);
  968. else return -1;
  969. }
  970. // Format : bmp, png, jpeg, tif
  971. // ImgChannel : the plane to be shown
  972. // Buffer : should be able to save the whole image
  973. // Buffersize : input is maximum, output is really used
  974. int32_t HyMapGetImage(uint32_t CID, char* Format, int32_t ImgChannel, void* Buffer, uint32_t& BufferSize)
  975. {
  976. if (pHyMapGetImage)
  977. return pHyMapGetImage(CID, Format, ImgChannel, Buffer, BufferSize);
  978. else return -1;
  979. }
  980. // ElementIndex : the plane to be shown
  981. // Buffer : should be able to save the whole image
  982. // Buffersize : input is maximum, output is really used
  983. int32_t HyMapGetElementData(uint32_t CID, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize)
  984. {
  985. if (pHyMapGetElementData)
  986. return pHyMapGetElementData(CID, ElementIndex, Buffer, BufferSize);
  987. else return -1;
  988. }
  989. // Format : bmp, png, jpeg, tif
  990. // ElementIndex : the plane to be shown
  991. // Buffer : should be able to save the whole image
  992. // Buffersize : input is maximum, output is really used
  993. int32_t HyMapGetElementImage(uint32_t CID, char* Format, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize)
  994. {
  995. if (pHyMapGetElementImage)
  996. return pHyMapGetElementImage(CID, Format, ElementIndex, Buffer, BufferSize);
  997. else return -1;
  998. }
  999. // Format : bmp, png, jpeg, tif
  1000. // Buffer : should be able to save the whole image
  1001. // Buffersize : input is maximum, output is really used
  1002. int32_t HyMapGetMixedMapImage(uint32_t CID, char* Format, void* Buffer, uint32_t& BufferSize)
  1003. {
  1004. if (pHyMapGetMixedMapImage)
  1005. return pHyMapGetMixedMapImage(CID, Format, Buffer, BufferSize);
  1006. else return -1;
  1007. }
  1008. // ImgChannel : the plane to be shown
  1009. // aFileName : file name
  1010. int32_t HyMapSaveImage(uint32_t CID, int32_t ImgChannel, char* aFileName)
  1011. {
  1012. if (pHyMapSaveImage)
  1013. return pHyMapSaveImage(CID, ImgChannel, aFileName);
  1014. else return -1;
  1015. }
  1016. // ElementIndex : the plane to be shown
  1017. // aFileName : file name
  1018. int32_t HyMapSaveElementImage(uint32_t CID, int32_t ElementIndex, char* aFileName)
  1019. {
  1020. if (pHyMapSaveElementImage)
  1021. return pHyMapSaveElementImage(CID, ElementIndex, aFileName);
  1022. else return -1;
  1023. }
  1024. // aFileName : file name
  1025. int32_t HyMapSaveMixedMapImage(uint32_t CID, char* aFileName)
  1026. {
  1027. if (pHyMapSaveMixedMapImage)
  1028. return pHyMapSaveMixedMapImage(CID, aFileName);
  1029. else return -1;
  1030. }
  1031. }