123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720 |
- /*
- Bruker.API.CommonTypes.h
- Header File for Bruker Common-Interface
- Microsoft Visual Studio 2015
- */
- #pragma once
- #ifndef BrukerAPICommonFunctionsH
- #define BrukerAPICommonFunctionsH
- #include <stddef.h>
- #include <stdint.h>
- #include <tchar.h>
- #include <iostream>
- #include <sstream>
- #include <string>
- namespace BrukerDll
- {
- struct TOpenClientOptions;
- struct TRTAPISpectrumHeaderRec;
- struct TRTCalibResults;
- struct TRTCalibSettings;
- struct TRTDetectorRanges;
- struct TRTDetectorStatus;
- struct TRTHardwareConfiguration;
- struct TRTSpectrometerStatus;
- #pragma pack(push, 1) // structure to describe a point, should be compatible to Windows.Point
- struct TPoint {
- int32_t X;
- int32_t Y;
- };
- #pragma pack(pop)
- #pragma pack(push, 1)
- struct TRTSpectrumHeaderRec {
- uint8_t IdentifierLength;
- char Identifier[25]; // 'Rontec XRay spectrum'
- int32_t Version; // Version information
- int32_t Size; // Size in byte
- double DateTime; // Delphi 5.0 version of date and time
- int32_t ChannelCount; //
- int32_t ChannelOffset; // First channel index
- double CalibrationAbs; // Energy of first channel
- double CalibrationLin; // keV per channel
- double SigmaAbs; // Sigma^2 energy calibration
- double SigmaLin;
- // additional data compared to normal Roentec header
- int32_t RealTime; // real measure time in ms
- int32_t LifeTime; // life time in ms
- };
- #pragma pack(pop)
- typedef TRTSpectrumHeaderRec* PRTSpectrumHeaderRec;
- #pragma pack(push, 1)
- struct TRTCalibSettings {
- int32_t Version; // Version of record structure, should be '1' at the moment
- int32_t Element1;
- char* Line1;
- double Energy1;
- int32_t Element2;
- char* Line2;
- double Energy2;
- int32_t MaxTime; // Maximum time to calibrate in ms, '0' indicates to use a internal statistics to decide to stop
- #ifdef BRUKERAPIESPRITH
- bool ShowProgress; // Show progress information
- #endif
- };
- #pragma pack(pop)
- typedef TRTCalibSettings* PRTCalibSettings;
- #pragma pack(push, 1)
- struct TRTCalibResults {
- int32_t Version;
- double CalibLin, CalibAbs, FWHM, Fano;
- };
- #pragma pack(pop)
- typedef TRTCalibResults* PRTCalibResults;
- #pragma pack(push, 1)
- struct TRTDetectorStatus {
- int32_t Version; // Version of structure, useful for later extensions
- int32_t Status; // -1=not present, 0=present but inactive, 1=active
- uint32_t CountRate; // Current input count rate in cps
- int32_t Temperature; // Current temperature in °C
- uint32_t CoolingMode; // Cooling mode (0=off, 1=on, 2=max. 3=heating, 4=unknown)
- };
- #pragma pack(pop)
- #pragma pack(push, 1)
- struct TRTSpectrometerStatus {
- int32_t Version; // Version of structure, useful for later extensions
- TRTDetectorStatus DetectorStatus[4/*# range 0..3*/];// Detector information
- uint32_t Status; // 0=not detected, 1=standby, 2=interlock, 3=stopped, 4=running
- bool Ready;
- };
- #pragma pack(pop)
- #pragma pack(push, 1)
- struct TRTDetectorRanges {
- int32_t MaxEnergy[8/*# range 0..7*/];
- int32_t PulseThroughPut[8/*# range 0..7*/];
- int32_t EnergyIndexCount;
- int32_t PulseIndexCount;
- };
- #pragma pack(pop)
- typedef TRTDetectorRanges* PRTDetectorRanges;
- #pragma pack(push, 1)
- struct TRTHardwareConfiguration {
- int32_t Detector[4]; // [0..3] is SPU
- bool EBSD;
- bool Raster;
- int32_t XrayTube;
- };
- #pragma pack(pop)
- typedef TRTHardwareConfiguration* PRTHardwareConfiguration;
- #pragma pack(push, 1)
- struct TOpenClientOptions {
- int32_t Version;
- int32_t GUIMode;
- bool StartNew;
- uint8_t IdentifierLength;
- char TCPHost[64]; // from version 2
- uint16_t TCPPort; // from version 2
- };
- #pragma pack(pop)
- typedef TOpenClientOptions* POpenClientOptions;
- enum TAPILogType {
- allError,
- allWarning,
- allInfo
- };
- // noch zu klären
- // TAPILogTypes = set of TAPILogType;
- typedef TPoint TPointArray[];
- typedef TPointArray* PPointArray;
- typedef void* TPointerArray[];
- typedef void** PPointerArray;
- // Error constants generated from client program
- const int32_t IFC_ERROR_IN_EXECUTION = -1;
- const int32_t IFC_ERROR_WRONG_PARAMETER = -2;
- const int32_t IFC_ERROR_SPECTRUM_BUFFER_EMPTY = -3;
- const int32_t IFC_ERROR_PARAMETER_MISSED = -4;
- const int32_t IFC_ERROR_TOO_MANY_PARAMETERS = -5;
- const int32_t IFC_ERROR_USER_TERMINATED = -6;
- const int32_t IFC_ERROR_TIMEOUT = -7;
- const int32_t IFC_ERROR_UNKNOWN_VALUE_NAME = -8;
- const int32_t IFC_ERROR_WRONG_VALUE_TYPE = -9;
- const int32_t IFC_ERROR_WRONG_LICENCE = -10;
- const int32_t IFC_ERROR_RESULT_BUFFER_INSUFFICIENT = -11;
- const int32_t IFC_ERROR_HARDWARE_LOCKED = -12;
- const int32_t IFC_ERROR_SEQUENCE = -13;
- const int32_t IFC_WARNING_WRONG_ELEMENT = 1;
- const int32_t IFS_ERROR_PARAMETER_MISSED = -51; // returned by RTIFCServer.dll 24.2.2011 '11' -> '51'
- const int32_t IFS_ERROR_FUNCTION_NOT_IMPLEMENTED = -52; // returned by RTIFCServer.dll 24.2.2011 '11' -> '52'
- const int32_t IFS_ERROR_FUNTION_EXCEPTED = -53;
- // Errors coming from OpenClient()
- const int32_t CONN_ERROR_UNKNOWN = -21;
- const int32_t CONN_ERROR_INTERFACE_NOT_CONNECTED = -22;
- const int32_t CONN_ERROR_PARAMETER_MISSED = -23;
- const int32_t CONN_ERROR_ANSWER_TIMEOUT = -24;
- const int32_t CONN_ERROR_SERVER_NOT_RESPONDING = -25;
- const int32_t CONN_ERROR_RESULT_MISSED = -26;
- const int32_t CONN_ERROR_NO_INTERFACE = -27;
- const int32_t CONN_ERROR_INVALID_LOGIN = -28;
- const int32_t CONN_ERROR_NO_CONNECTION_TO_SERVER = -29;
- const int32_t CONN_ERROR_SERVER = -30;
- const int32_t CONN_ERROR_ACTION_ABORTED = -31;
- // Error constants generated from Bruker.API.*.dll
- const int32_t ERROR_WRONG_PARAMETER = -101;
- const int32_t ERROR_FILE_NOT_EXIST = -102;
- const int32_t ERROR_NO_CONNECTION = -103;
- const int32_t ERROR_NO_ANSWER = -104;
- const int32_t ERROR_CAN_NOT_START_PROCESS = -105;
- const int32_t ERROR_INVALID_RESULT_DATA = -106;
- const int32_t ERROR_SETTINGS_NOT_FOUND = -107;
- const int32_t ERROR_NO_SERVER_CONNECTION = -108; // no direct call to server possible (used in '..Direct' calls
- const int32_t ERROR_IN_EXECUTION = -109;
- const int32_t ERROR_IFC_BUSY = -110;
- // State constants generated from Bruker.API.*.dll
- const int32_t STATE_WAS_RUNNING_BEFORE = -201;
- bool LoadCommonFunctions(const LPCTSTR LibFile);
- // Convert int32_t to String
- std::string IntToString(int32_t number);
- // Convert Double to String
- std::string DoubleToString(double number);
- //----------------------------------------------------------------------------------
- // Interface functions of Bruker.API.*.DLL
- //----------------------------------------------------------------------------------
- /// <summary>Set active language for interface</summary>
- /// <param name="Language">Language identifier, 'ge' for german, any other for english</param>
- int32_t SetLanguage(char* Language);
- /// <summary>Query all known servers which can be used by API</summary>
- /// <param name="pServerList">Buffer for list of available server names</param>
- /// <param name = "BufSize">Initial size of this buffer</param>
- int32_t QueryServers(char* pServerList, int32_t BufSize);
- /// <summary>Query all running client programs for a given server</summary>
- /// <param name="pServer">name of the server to be queried</param>
- /// <param name = "pClientBuf">Buffer for list of available clients</param>
- /// <param name = "BufSize">Initial size of this buffer</param>
- int32_t QueryUser(char* pServer, char* pClientBuf, int32_t BufSize);
- /// <summary>Start Esprit and login automatically. Connection is done via Windows messaging, so Esprit must be installed on the same computer</summary>
- /// <param name="Password">Password of user with UserName</param>
- /// <param name="GUI">Whether to start the user interface or not</param>
- /// <param name="CID">Reference connection identifier, which must be used in all following API calls</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t OpenClient(char* pServer, char* pUser, char* pPassword, bool StartNew, bool GUI, uint32_t& CID);
- /// <summary>Start Esprit and login automatically. Connection is done via Windows messaging, so Esprit must be installed on the same computer</summary>
- /// <param name="Password">Password of user with UserName</param>
- /// <param name="Options">Structure with connection options</param>
- /// <param name="CID">Reference connection identifier, which must be used in all following API calls</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t OpenClientEx(char* pServer, char* pUser, char* pPassword, const TOpenClientOptions& Options, uint32_t& CID);
- /// <summary>Login to a running Esprit. Connection is done via TCP, so Esprit can be installed on any computer which is accessible via TCP/IP</summary>
- /// <param name="Password">Password of user with UserName</param>
- /// <param name="Host">IP address of the computer with Esprit</param>
- /// <param name="Port">IP port used by Esprit (default port is 5328), Esprit must be running before one can use this function</param>
- /// <param name="Options">Structure with connection options</param>
- /// <param name="CID">Reference connection identifier, which must be used in all following API calls</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t OpenClientTCP(char* pServer, char* pUser, char* pPassword, char* pHost, uint16_t Port, const TOpenClientOptions Options, uint32_t& CID);
- /// <summary>Query some information about a specific connection</summary>
- /// <param name="pInfo">pointer to string to be filled from API with some useful information</param>
- /// <param name="BufSize">Size of this buffer</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t QueryInfo(uint32_t CID, char* pInfo, int32_t BufSize);
- /// <summary>Close corrent API connection, Esprit remains running, CID cannot be used anymore after this call</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t CloseConnection(uint32_t CID);
- /// <summary>Shutdown Esprit, CID cannot be used anymore after this call</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t CloseClient(uint32_t CID);
- /// <summary>Returns description string for error values</summary>
- /// <param name="aError">error value returned from an API call</param>
- /// <param name="pErrorStr">buffer to string provided by caller, to be filled from API</param>
- /// <param name="BufSize">in: Size of this buffer, out: size used</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetDebugErrorString(uint32_t CID, int32_t aError, char* pErrorStr, int32_t& BufSize);
- /// <summary>Writes description string for error values to log</summary>
- /// <param name="aError">Error value returned from an API call</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t WriteDebugErrorStringToLog(uint32_t CID, int32_t aError);
- /// <summary>Is a specific client connection ok?</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t CheckConnection(uint32_t CID);
- /// <summary>Combines output of several spectrometers into one virtual spectrometer (to increase pulse rate for example)</summary>
- /// <param name="Devices">bit combination of spectrometers to combine</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t CombineSpectrometer(uint32_t CID, int32_t Devices);
- /// <summary></summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <param name="Status">Structure with status information from spectrometers and connected detectors</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrometerStatus(uint32_t CID, int32_t SPU, TRTSpectrometerStatus& Status);
- /// <summary></summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <param name="Det">Number of detector (1 in most cases)</param>
- /// <param name="aCoolingMode">Cooling mode (0=off, 1=on, 2=max. 3=heating, 4=unknown)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t SetDetectorCoolingMode(uint32_t CID, int32_t SPU, int32_t Det, int32_t aCoolingMode);
- /// <summary></summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t ResetSpectrometerInterlock(uint32_t CID, int32_t SPU);
- /// <summary></summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <param name="RealTime">Measure time in ms (0 means endless measurement)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t StartSpectrumMeasurement(uint32_t CID, int32_t Device, uint32_t RealTime);
- /// <summary></summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <param name="LifeTime">Life time in ms (>0)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t StartSpectrumLifeTimeMeasurement(uint32_t CID, int32_t Device, uint32_t LifeTime);
- /// <summary></summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <param name="StartEnergy">Lower spectrum region borders for counter measurement (in keV)</param>
- /// <param name="EndEnergy">Higher spectrum region borders for counter measurement (in keV)</param>
- /// <param name="Counts">Counter value for automatic measurement stop</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t StartSpectrumCounterMeasurement(uint32_t CID, int32_t SPU, double StartEnergy, double EndEnergy, uint32_t Counts);
- /// <summary></summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t StopSpectrumMeasurement(uint32_t CID, int32_t Device);
- /// <summary>Read status of ongoing spectrum aquisition</summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <param name="Running">Aquisition active or not</param>
- /// <param name="State">State of aquisition in % (100 % means ready)</param>
- /// <param name="PulseRate">
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrumMeasureState(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate);
- /// <summary>Read status of ongoing spectrum aquisition</summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <param name="Running">Aquisition active or not</param>
- /// <param name="State">State of aquisition in % (100 % means ready)</param>
- /// <param name="PulseRate">current input pulse rate in cps</param>
- /// <param name="RealTime">current measure time in ms</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrumMeasureStateEx(uint32_t CID, int32_t Device, bool& Running, double& State, double& PulseRate, int32_t& RealTime);
- /// <summary>Read current spectrum from spectrometer to buffer</summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t ReadSpectrum(uint32_t CID, int32_t Device);
- /// <summary>Read current spectrometer configuration</summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <param name="MaxEnergyIndex">Index of selected max energy setting</param>
- /// <param name="PulseThroughputIndex">Index of selected max throughput setting</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrometerConfiguration(uint32_t CID, int32_t SPU, uint32_t& MaxEnergyIndex, uint32_t& PulseThroughputIndex);
- /// <summary>Read current detector configuration</summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <param name="Det">Number of detector (1 in most cases)</param>
- /// <param name="MaxEnergyIndex">Index of selected max energy setting</param>
- /// <param name="PulseThroughputIndex">Index of selected max throughput setting</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrometerConfigurationEx(uint32_t CID, int32_t SPU, int32_t Det, uint32_t& MaxEnergyIndex, uint32_t& PulseThroughputIndex);
- /// <summary>Set configuration for a given detector</summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <param name="Det">Number of detector (1 in most cases)</param>
- /// <param name="MaxEnergyIndex">Index of selected max energy setting</param>
- /// <param name="PulseThroughputIndex">Index of selected max throughput setting</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t SetSpectrometerConfiguration(uint32_t CID, int32_t SPU, int32_t Det, const uint32_t MaxEnergyIndex, const uint32_t PulseThroughputIndex);
- /// <summary>Switch detectors into 'active' mode for a given spectrometer</summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <param name="Detectors">Active Detectors as bitmask (1 shl 0, etc.)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t SetActiveDetectors(uint32_t CID, int32_t SPU, const uint32_t Detectors);
- /// <summary>Read active detectors of a given spectrometer</summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <param name="Detectors">Active Detectors as bitmask (1 shl 0, etc.)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetActiveDetectors(uint32_t CID, int32_t SPU, uint32_t& Detectors);
- /// <summary></summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <param name="Detectors">Available Detectors as bitmask (1 shl 0, etc.)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetAvailableDetectors(uint32_t CID, int32_t SPU, uint32_t& Detectors);
- /// <summary>Ask for available WDS detetcors</summary>
- /// <param name="SPU">Number of spectrometer (1 in most cases)</param>
- /// <param name="Detectors">Available WDS detectors as bitmask (1 shl 0, etc.)
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetAvailableWDSDetectors(uint32_t CID, int32_t SPU, uint32_t& Detectors);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetHardwareConfiguration(uint32_t CID, TRTHardwareConfiguration& aHardwareConfiguration);
- /// <summary>Perform spectrometer eneryg/channel calibration</summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t CalibrateSpectrometer(uint32_t CID, int32_t Device, bool ShowProgress, PRTCalibSettings Settings, PRTCalibResults Results);
- /// <summary>Read a named parameter from spectrometer</summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param></param>
- /// <param name="ParamName : Name of the parameter to read</param>
- // Current implemented names: 'MaxEnergy', 'PulseThroughput', 'DetectorTemperature' as 'Integer' or 'Double'</param>
- /// <param name="ParamType">Type of the parameter to read (Byte,Boolean,Word,Integer,Double,Memory)</param>
- /// <param name="Buffer">Pointer to variable of that type</param>
- /// <param name="BufSize">if ParamType is Memory than BufSize if size of the memory block described by 'Buffer'</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrometerParam(uint32_t CID, int32_t Device, char* ParamName, char* ParamType, void* Buffer, int32_t BufSize);
- /// <summary>Reads the amount of available spectrometers</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrometerCount(uint32_t CID, int32_t& Value);
- /// <summary>Gets SpectrometerRanges (Pulserate and EnergyRange)</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrometerRanges(uint32_t CID, int32_t SPU, int32_t Det, TRTDetectorRanges& aDetectorSettings);
- /// <summary>Read full parameter block of current spectrometer params (needed to create full Bruker spectrum)</summary>
- int32_t GetSpectrometerParams(uint32_t CID, int32_t SPU, void* Buffer, int32_t& BufSize);
- /// <summary></summary>
- /// <param name="Buffer">Number of buffer (1..n for spectrometer, 0 for loaded spectrum)
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrum(uint32_t CID, int32_t Buffer, PRTSpectrumHeaderRec pSpectrumBuf, int32_t BufSize);
- /// <summary>Quantify spectrum in given buffer, returns</summary>
- /// <param name="Buffer">Number of buffer (1..n for spectrometer, 0 for loaded spectrum)</param>
- /// </param name="pMethodName">Name of the method file, this file must exist</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t QuantifySpectrum(uint32_t CID, int32_t Buffer, char* pMethodName, char* pParams, char* pResultBuf, int32_t ResultBufSize);
- /// <summary>Sends a RCL 2.2 command to spectrometer and returns the answer (see RCL 2.2 description of commands)</summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param></param>
- /// <param name="Command">Pointer to zero terminated command string</param>
- /// <param name="Answer">Pointer buffer for zero terminated answer string</param>
- /// <param name="AnswerBufSize">Size of this buffer</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t SendRCLCommand(uint32_t CID, int32_t Device, char* pCommand, char* pAnswer, int32_t AnswerBufSize);
- /// <summary>Sends a RCL 2.2 command to spectrometer, does not wait for answer (see RCL 2.2 description of commands)</summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param></param>
- /// <param name="Command">Pointer to zero terminated command string</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t SendRCLCommandOnly(uint32_t CID, int32_t Device, char* Command);
- /// <summary>Receives the answer of the above function</summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <param name="Answer">Pointer buffer for zero terminated answer string</param>
- /// <param name="AnswerBufSize">Size of this buffer</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t ReceiveRCLAnswer(uint32_t CID, int32_t Device, char* Answer, int32_t AnswerBufSize);
- /// <summary>Interupts hardware communication to specified device until 'UnlockSpectrometer' is called</summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t LockSpectrometer(uint32_t CID, int32_t Device);
- /// <summary></summary>
- /// <param name="Device">Number of spectrometer (1 in most cases)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t UnlockSpectrometer(uint32_t CID, int32_t Device);
- /// <summary>Load spectrum from file to buffer</summary>
- /// <param name="pFilename">Complete filename for spectrum (normally with *.spx extension)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t LoadSpectrum(uint32_t CID, char* pFileName);
- /// <summary>Send spectrum back to 'loaded' buffer</summary>
- /// <param name="Spectrum">Bruker spectrum buffer</param>
- /// <param name="BufferSize">size of spectrum buffer</param>
- // Remarks : if one wants to use that function one has to build a complete Bruker spectrum with
- // functions 'GetSpectrum', 'GetSpectrometerParams' and 'CreateSpectrum'
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t PutSpectrum(uint32_t CID, void* Spectrum, int32_t BufSize);
- /// <summary>Save spectrum buffer to file</summary>
- /// <param name="pFilename">Complete filename for spectrum (normally with *.spx extension)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t SaveSpectrum(uint32_t CID, int32_t Buffer, char* pFileName);
- /// <summary>Create a complete Bruker spectrum from</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t CreateSpectrum(char* SpectrometerParams, PRTSpectrumHeaderRec SpectrumData, char* ResultData, int32_t& ResultSize);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetCorrectedSpectrum(char* SpectrometerParams, PRTSpectrumHeaderRec Spectrum, double* ResultData);
- /// <summary>Show spectrum in Esprit UI</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t ShowSpectrum(uint32_t CID, int32_t Buffer, char* Name);
- /// <summary>Delete spectrum from presentation in UI</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t DeleteSpectrum(uint32_t CID, char* aName);
- /// <summary>Create and return a graphic for spectrum presentation</summary>
- /// <param name="Buffer">Buffer index (0 for loaded spectrum buffer, > 0 for spectrometer buffers)</param>
- /// <param name="Width">Requested graphic width</param>
- /// <param name="Height">Requested graphic Height</param>
- /// <param name="Format">Requested grapghic format (bmp, png, jpeg, tif)</param>
- /// <param name="ResultBuf">should be able to save the whole image</param>
- /// <param name="ResultBufSize">input is maximum, output is really used</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetSpectrumGraphic(uint32_t CID, int32_t Buffer, int32_t Width, int32_t Height, char* Format, void* ResultBuf, uint32_t& ResultBufSize);
- /// <summary>Get a list of avaliable hardware profiles from client</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetHardwareProfiles(uint32_t CID, char* pProfiles, int32_t BufSize);
- /// <summary>Set a specific hardware profile</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t SetHardwareProfile(uint32_t CID, char* pProfile);
- /// <summary>Get a list of avaliable quantification methods</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetQuantificationMethods(uint32_t CID, bool AutomaticOnly, char* pMethods, int32_t BufSize);
- /// <summary>Get a list of predefined elements from a given quant method</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetQuantificationMethodElements(uint32_t CID, char* MethodName, char* ElementBuffer, int32_t BufSize);
- /// <summary>Call method editor for a given quant method</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t EditQuantificationMethod(uint32_t CID, char* MethodName);
- /// <summary>Loads a method and saves it again. purpose: rename, conversion from mtd into mtdx</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t CopyQuantificationMethod(uint32_t CID, char* MethodName, char* TargetName, bool ToProfile);
- /// <summary>Get a channel region for desired element and X ray line</summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t GetRegionForElement(uint32_t CID, int32_t Buffer, char* Params, char* ResultBuf, int32_t ResultBufSize);
- // Xray tube functions
- /// <summary></summary>
- /// <param name="HighVoltage">tube voltate [Volt]</param>
- /// <param name="Current">tube current [µA]</param>
- /// <param name="FilterIndex">index of selected filter</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t XRayTubeSetConfiguration(uint32_t CID, int32_t Tube, uint32_t HighVoltage, uint32_t Current, uint32_t FilterIndex);
- /// <summary></summary>
- /// <param name="HighVoltage">tube voltate [Volt]</param>
- /// <param name="Current">tube current [µA]</param>
- /// <param name="FilterIndex">index of selected filter</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t XRayTubeGetState(uint32_t CID, int32_t Tube, uint32_t& HighVoltage, uint32_t& Current, uint32_t& FilterIndex, bool& ShutterOpen);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t XRayTubeOpenShutter(uint32_t CID, int32_t Tube);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t XRayTubeCloseShutter(uint32_t CID, int32_t Tube);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t XRayTubeHVOn(uint32_t CID, int32_t Tube, int32_t DestHV, int32_t DestCurrent, bool HVOn);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t XRaySetActiveTube(uint32_t CID, int32_t Tube);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t XRayGetActiveTube(uint32_t CID, int32_t& Tube);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t SetImageExportParameter(uint32_t CID, int32_t ExportImageWidth, bool ExportWithOverlay);
- // Hypermap functions, function 'HyMapStart' is specific for Esprit/M4
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapStop(uint32_t CID, bool WaitForFrameEnd);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapClearDatabase(uint32_t CID);
- /// <summary>Query status of a hypermap measurement</summary>
- /// <param name="Running">acquisition active or not</param>
- /// <param name="MeasureState">state of acquisition in %</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetState(uint32_t CID, bool& Running, double& MeasureState);
- /// <summary>Query status of a hypermap measurement</summary>
- /// <param name="Running">acquisition active or not</param>
- /// <param name="MeasureState">state of acquisition in %</param>
- /// <param name="CurrentLine">line which is currently scanned (0...map height-1)</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetStateEx(uint32_t CID, bool& Running, double& MeasureState, int32_t& CurrentLine);
- /// <summary>Query spectrum from a specific X/Y location in the map</summary>
- /// <param name="X">X coordinate</param>
- /// <param name="Y">Y coordinate</param>
- /// <param name="Corrected">Correct the spectrum for detector artefacts or not</param>
- /// <param name="SpectrumBuffer">pointer to memory, must have space for one full spectrum</param>
- /// <param name="BufferSize">preallocated size of the spectrum buffer, recommended is a size of 64kB</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetXYSpectrum(uint32_t CID, int32_t X, int32_t Y, bool Corrected, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize);
- /// <summary>Query spectra from a specific location in the map</summary>
- /// <param name="X">X coordinate</param>
- /// <param name="Y">Y coordinate</param>
- /// <param name="Count">Number of spectra with increasing X coordinate on line Y</param>
- /// <param name="Corrected">Correct the spectrum for detector artefacts or not</param>
- /// <param name="SpectrumBuffer">pointer to array of pointers for spectra, must have space for 'Count' pointers, each with allocated space for a full spectrum</param>
- /// <param name="BufferSize">preallocated size of the spectrum buffer</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetLineSpectra(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize);
- /// <summary>Query spectra from a specific location in the map, spectra are transmitted compressed internally. Funcction is much faster than "HyMapGetLineSpectra"</summary>
- /// <param name="X">X coordinate</param>
- /// <param name="Y">Y coordinate</param>
- /// <param name="Count">Number of spectra with increasing X coordinate on line Y</param>
- /// <param name="Corrected">Correct the spectrum for detector artefacts or not</param>
- /// <param name="SpectrumBuffer">pointer to array of pointers for spectra, must have space for 'Count' pointers, each with allocated space for a full spectrum</param>
- /// <param name="BufferSize">preallocated size of the spectrum buffer</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetCompressedLineSpectra(uint32_t CID, int32_t X, int32_t Y, int32_t Count, bool Corrected, PPointerArray SpectrumBuffer, int32_t BufferSize);
- /// <summary></summary>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapQuantifySpectra(uint32_t CID, PPointArray Points, int32_t PointCount, int32_t Binning, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize);
- /// <summary></summary>
- /// <param name="aFileName">file name</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapSaveToFile(uint32_t CID, char* aFileName);
- /// <summary>Load a hypermap file (*.bcf)</summary>
- /// <param name="aFileName">file name</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapLoadFromFile(unsigned _int32 CID, char* aFileName, int32_t& Width, int32_t& Height, int32_t& DetCount, int32_t& ImgCount);
- /// <summary></summary>
- /// <param name="SpectrumBuffer">pointer to memory, must have space for one full spectrum</param>
- /// <param name="BufferSize">size of the above buffer</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetMaxPixelSpectrum(uint32_t CID, PRTSpectrumHeaderRec SpectrumBuffer, int32_t BufferSize);
- #ifdef BRUKERAPIESPRITH
- int32_t HyMapQuantifyMaxPixelSpectrum(uint32_t CID, char* MethodName, char* Params, char* ResultBuf, int32_t ResultBufSize);
- #endif
- /// <summary></summary>
- /// <param name="pMethodName">name of method to be used</param>
- /// <param name="pElementBuffer">buffer to get a list of atomic numbers as result of element identification</param>
- /// <param name="ElementBufSize">size of element buffer</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapAutoIdent(uint32_t CID, char* pMethodName, char* pElementBuffer, int32_t ElementBufSize);
- /// <summary></summary>
- /// <param name="Format">Requested graphic format (bmp, png, jpeg, tif)</param>
- /// <param name="ImgChannel">the plane to be shown</param>
- /// <param name="Buffer">should be able to save the whole image</param>
- /// <param name="Buffersize">input is maximum, output is really used</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetImage(uint32_t CID, char* Format, int32_t ImgChannel, void* Buffer, uint32_t& BufferSize);
- /// <summary></summary>
- /// <param name="ElementIndex">index of the elemen to be shown</param>
- /// <param name="Buffer">should be able to save the whole image</param>
- /// <param name="Buffersiz">input is maximum, output is really used</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetElementData(uint32_t CID, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize);
- /// <summary></summary>
- /// <param name="Format">Requested graphic format (bmp, png, jpeg, tif)</param>
- /// <param name="ElementIndex">the plane to be shown</param>
- /// <param name="Buffer">should be able to save the whole image</param>
- /// <param name="Buffersize">input is maximum, output is really used</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetElementImage(uint32_t CID, char* Format, int32_t ElementIndex, void* Buffer, uint32_t& BufferSize);
- /// <summary></summary>
- /// <param name="Format">Requested graphic format (bmp, png, jpeg, tif)</param>
- /// <param name="Buffer">should be able to save the whole image</param>
- /// <param name="Buffersize">input is maximum, output is really used</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapGetMixedMapImage(uint32_t CID, char* Format, void* Buffer, uint32_t& BufferSize);
- /// <summary></summary>
- /// <param name="ImgChannel">Image channel</param>
- /// <param name="aFileName">file name</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapSaveImage(uint32_t CID, int32_t ImgChannel, char* aFileName);
- /// <summary></summary>
- /// <param name="ElementIndex">Plane to be shown</param>
- /// <param name="aFileName">file name</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapSaveElementImage(uint32_t CID, int32_t ElementIndex, char* aFileName);
- /// <summary></summary>
- /// <param name="aFileName">file name</param>
- /// <returns>Function call sucessful or not (0 = success, otherwise error)</returns>
- int32_t HyMapSaveMixedMapImage(uint32_t CID, char* aFileName);
- }
- #endif // BrukerAPICommonFunctionsH
|