12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283 |
- using System;
- using System.IO;
- using System.Runtime.InteropServices;
- using System.Windows.Forms;
- namespace Bruker.API
- {
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)]
- public struct TRTHardwareConfiguration
- {
- [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.I4, SizeConst = 4)]
- public int[] EDSDetector; // [0..3] is SPU
- [MarshalAs(UnmanagedType.I1)]
- public bool EBSD; // EBSD present
- [MarshalAs(UnmanagedType.I1)]
- public bool Raster; // Scan engine present
- public int XrayTubes; // Number of Xray tubes
- }
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TRTSpectrumHeaderRec
- {
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst=25)] public string Identifier; // 'Rontec XRay spectrum'
- public int Version; // Version information
- public int Size; // Size in byte
- public double DateTime; // Delphi 5.0 version of date and time
- public int ChannelCount; //
- public int ChannelOffset; // First channel index
- public double CalibrationAbs; // Energy of first channel
- public double CalibrationLin; // keV per channel
- public double SigmaAbs; // Sigma^2 energy calibration
- public double SigmaLin;
- public int RealTime; // real measure time in ms
- public int LifeTime; // life time in ms
- }
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TRTCalibSettings
- {
- public int Version; // Version of record structure, should be '1' at the moment
- public int Element1;
- public string Line1;
- public double Energy1;
- public int Element2;
- public string Line2;
- public double Energy2;
- public int MaxTime; // Maximum time to calibrate in ms, '0' indicates to use a internal statistics to decide to stop
- public bool ShowProgress; // Show progress information
- }
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TRTCalibResults
- {
- public int Version; // Version of record structure, should be '1' at the moment
- public double CalibLin; // Channel with in keV
- public double CalibAbs; // Energy offset in keV
- public double FWHM; // Mn FWHM in keV
- public double Fano; // Fano factor
- }
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TRTSpectrometerRanges
- {
- [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.I4, SizeConst = 8)]
- public int[] MaxEnergy;
- [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.I4, SizeConst = 8)]
- public int[] PulseThroughPut;
- public int EnergyIndexCount;
- public int PulseIndexCount;
- }
- // structure to describe Quantax start options in 'OpenClientEx'
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TOpenClientOptions
- {
- public int Version; // Version of record structure, should be '1' at the moment
- public int GUIMode; // '0'=no GUI, '1'=full GUI, '2'=reduced GUI (spectrum chart only)
- public bool StartNew; // start new instance of Quantax
- }
- // structure for Delphi's TPoint
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TPoint
- {
- public int X;
- public int Y;
- }
- // structure for Delphi's TPointArray
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TPointArray
- {
- public TPoint[] Points;
- }
- // structure for Delphi's TPointerArray
- [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
- public struct TPointerArray
- {
- public TRTSpectrumHeaderRec[] Pointers;
- }
- /// <summary>
- /// BrukerException-Class
- /// </summary>
- public class BrukerException : Exception
- {
- public BrukerException(string message) : base(message) { }
- }
- /// <summary>
- /// CommonFunctions-Class
- /// </summary>
- public class CommonFunctions
- {
- #if WIN32
- const string rtdll = "Bruker.API.Esprit.DLL";
- #else
- const string rtdll = "Bruker.API.Esprit64.DLL";
- #endif
- // Error constants generated from client program
- public const int IFC_ERROR_IN_EXECUTION = -1;
- public const int IFC_ERROR_WRONG_PARAMETER = -2;
- public const int IFC_ERROR_SPECTRUM_BUFFER_EMPTY = -3;
- public const int IFC_ERROR_PARAMETER_MISSED = -4;
- public const int IFC_ERROR_TOO_MANY_PARAMETERS = -5;
- public const int IFC_ERROR_USER_TERMINATED = -6;
- public const int IFC_ERROR_TIMEOUT = -7;
- public const int IFC_ERROR_UNKNOWN_VALUE_NAME = -8;
- public const int IFC_ERROR_WRONG_VALUE_TYPE = -9;
- public const int IFC_ERROR_WRONG_LICENCE = -10;
- public const int IFC_ERROR_RESULT_BUFFER_INSUFFICIENT= -11;
- public const int IFC_ERROR_HARDWARE_LOCKED = -12;
- public const int IFC_ERROR_PARAMETER_MISSED_1 = -51;
- public const int IFC_ERROR_FUNCTION_NOT_IMPLEMENTED = -52;
- // Errors coming from OpenClient()
- public const int CONN_ERROR_UNKNOWN = -21;
- public const int CONN_ERROR_INTERFACE_NOT_CONNECTED = -22;
- public const int CONN_ERROR_PARAMETER_MISSED = -23;
- public const int CONN_ERROR_ANSWER_TIMEOUT = -24;
- public const int CONN_ERROR_SERVER_NOT_RESPONDING = -25;
- public const int CONN_ERROR_RESULT_MISSED = -26;
- public const int CONN_ERROR_NO_INTERFACE = -27;
- public const int CONN_ERROR_INVALID_LOGIN = -28;
- public const int CONN_ERROR_NO_CONNECTION_TO_SERVER = -29;
- public const int CONN_ERROR_SERVER = -30;
- public const int CONN_ERROR_ACTION_ABORTED = -31;
- // Error constants generated from Bruker.API.XXX.dll
- public const int ERROR_WRONG_PARAMETER = -101;
- public const int ERROR_FILE_NOT_EXIST = -102;
- public const int ERROR_NO_CONNECTION = -103;
- public const int ERROR_NO_ANSWER = -104;
- public const int ERROR_CAN_NOT_START_PROCESS = -105;
- public const int ERROR_INVALID_RESULT_DATA = -106;
- public const int ERROR_SETTINGS_NOT_FOUND = -107;
- public const int ERROR_NO_SERVER_CONNECTION = -108; // no direct call to server possible (used in '..Direct' calls
- public const int ERROR_IN_EXECUTION = -109;
- // State constants generated from Bruker.API.XXX.dll
- public const int STATE_WAS_RUNNING_BEFORE = -201;
-
- //Element Names
- public static string[] ElementName = { "null", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al",
- "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co",
- "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb",
- "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs",
- "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm",
- "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi",
- "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk",
- "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg",
- "Cn", "Uut", "Fl", "Uup", "Lv", "Uus", "Uuo" };
- /// <summary>
- /// Handler for BrukerApiReturnValues
- /// if BrukerApiReturnValue <> 0, an BrukerException will be generated.
- /// </summary>
- /// <param name="BrukerApiCallReturnValue">the Return Value of BrukerApi-Function-Call </param>
- /// <returns>BrukerApiCallReturnValue</returns>
- public static int HandleReturnValue(int BrukerApiCallReturnValue)
- {
- if (BrukerApiCallReturnValue == -1)
- throw new BrukerException("Bruker.API: IFC_ERROR_IN_EXECUTION");
- else if (BrukerApiCallReturnValue == -2)
- throw new BrukerException("Bruker.API: IFC_ERROR_WRONG_PARAMETER");
- else if (BrukerApiCallReturnValue == -3)
- throw new BrukerException("Bruker.API: IFC_ERROR_SPECTRUM_BUFFER_EMPTY");
- else if (BrukerApiCallReturnValue == -4)
- throw new BrukerException("Bruker.API: FC_ERROR_PARAMETER_MISSED");
- else if (BrukerApiCallReturnValue == -5)
- throw new BrukerException("Bruker.API: IFC_ERROR_TOO_MANY_PARAMETERS");
- else if (BrukerApiCallReturnValue == -6)
- throw new BrukerException("Bruker.API: IFC_ERROR_USER_TERMINATED");
- else if (BrukerApiCallReturnValue == -7)
- throw new BrukerException("Bruker.API: IFC_ERROR_TIMEOUT");
- else if (BrukerApiCallReturnValue == -8)
- throw new BrukerException("Bruker.API: IFC_ERROR_UNKNOWN_VALUE_NAME");
- else if (BrukerApiCallReturnValue == -9)
- throw new BrukerException("Bruker.API: IFC_ERROR_WRONG_VALUE_TYPE");
- else if (BrukerApiCallReturnValue == -10)
- throw new BrukerException("Bruker.API: IFC_ERROR_WRONG_LICENCE");
- else if (BrukerApiCallReturnValue == -11)
- throw new BrukerException("Bruker.API: IFC_ERROR_RESULT_BUFFER_INSUFFICIENT");
- else if (BrukerApiCallReturnValue == -12)
- throw new BrukerException("Bruker.API: IFC_ERROR_HARDWARE_LOCKED");
- else if (BrukerApiCallReturnValue == -51)
- throw new BrukerException("Bruker.API: IFC_ERROR_PARAMETER_MISSED_1");
- else if (BrukerApiCallReturnValue == -52)
- throw new BrukerException("Bruker.API: IFC_ERROR_FUNCTION_NOT_IMPLEMENTED");
- else if (BrukerApiCallReturnValue == -21)
- throw new BrukerException("Bruker.API: CONN_ERROR_UNKNOWN");
- else if (BrukerApiCallReturnValue == -22)
- throw new BrukerException("Bruker.API: CONN_ERROR_INTERFACE_NOT_CONNECTED");
- else if (BrukerApiCallReturnValue == -23)
- throw new BrukerException("Bruker.API: CONN_ERROR_PARAMETER_MISSED");
- else if (BrukerApiCallReturnValue == -24)
- throw new BrukerException("Bruker.API: CONN_ERROR_ANSWER_TIMEOUT");
- else if (BrukerApiCallReturnValue == -25)
- throw new BrukerException("Bruker.API: CONN_ERROR_SERVER_NOT_RESPONDING");
- else if (BrukerApiCallReturnValue == -26)
- throw new BrukerException("Bruker.API: CONN_ERROR_RESULT_MISSED");
- else if (BrukerApiCallReturnValue == -27)
- throw new BrukerException("Bruker.API: CONN_ERROR_NO_INTERFACE");
- else if (BrukerApiCallReturnValue == -28)
- throw new BrukerException("Bruker.API: CONN_ERROR_INVALID_LOGIN");
- else if (BrukerApiCallReturnValue == -29)
- throw new BrukerException("Bruker.API: CONN_ERROR_NO_CONNECTION_TO_SERVER");
- else if (BrukerApiCallReturnValue == -30)
- throw new BrukerException("Bruker.API: CONN_ERROR_SERVER");
- else if (BrukerApiCallReturnValue == -31)
- throw new BrukerException("Bruker.API: CONN_ERROR_ACTION_ABORTED");
- else if (BrukerApiCallReturnValue == -101)
- throw new BrukerException("Bruker.API: ERROR_WRONG_PARAMETER");
- else if (BrukerApiCallReturnValue == -102)
- throw new BrukerException("Bruker.API: ERROR_FILE_NOT_EXIST");
- else if (BrukerApiCallReturnValue == -103)
- throw new BrukerException("Bruker.API: ERROR_NO_CONNECTION");
- else if (BrukerApiCallReturnValue == -104)
- throw new BrukerException("Bruker.API: ERROR_NO_ANSWER");
- else if (BrukerApiCallReturnValue == -105)
- throw new BrukerException("Bruker.API: ERROR_CAN_NOT_START_PROCESS");
- else if (BrukerApiCallReturnValue == -106)
- throw new BrukerException("Bruker.API: ERROR_INVALID_RESULT_DATA");
- else if (BrukerApiCallReturnValue == -107)
- throw new BrukerException("Bruker.API: ERROR_SETTINGS_NOT_FOUND");
- else if (BrukerApiCallReturnValue == -108)
- throw new BrukerException("Bruker.API: ERROR_NO_SERVER_CONNECTION");
- else if (BrukerApiCallReturnValue == -109)
- throw new BrukerException("ERROR_IN_EXECUTION");
- else if (BrukerApiCallReturnValue == -201)
- throw new BrukerException("Bruker.API: STATE_WAS_RUNNING_BEFORE");
- else if (BrukerApiCallReturnValue != 0)
- throw new BrukerException("Bruker.API: Unknown Bruker Error #" + BrukerApiCallReturnValue.ToString());
- return BrukerApiCallReturnValue;
- }
- public static string RclCommand(int Device, string Command)
- {
- string s = "".PadRight(1000);
- int r = SendRCLCommand(FCID, Device, Command, ref s, 1000);
- return s;
- }
- //----------------------------------------------------------------------------------
- // Interface functions of Bruker.API.XXX library
- //----------------------------------------------------------------------------------
- /// <summary>
- /// Set log level for internal API logging
- /// 0 : no logging
- /// 1 : Error logging
- /// 2 : Warning logging
- /// 3 : All logging
- /// </summary>
- /// <param name="Value"></param>
- /// <returns>Error code (0 = no error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetLogLevel(
- int Value);
- /// <summary>
- /// Ask for log data, transfered log data are removed from internal API log after this call
- /// </summary>
- /// <param name="Language"></param>
- /// <returns>Error code (0 = no error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetLogData(
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string Buffer,
- ref uint BufferSize);
- /// <summary>
- /// Clear API log data
- /// </summary>
- /// <returns>Error code (0 = no error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ClearLogData();
- /// <summary>
- /// Save API log data to file
- /// </summary>
- /// <param name="FileName"></param>
- /// <returns>Error code (0 = no error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SaveLogData(
- [MarshalAs(UnmanagedType.LPWStr)] string FileName);
- /// <summary>
- /// Set active language for interface, 'ge' for german, any other for english
- /// </summary>
- /// <param name="Language"></param>
- /// <returns>Error code (0 = no error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetLanguage(
- string Language);
- /// <summary>
- /// Query all known servers for which can be used by client program
- /// </summary>
- /// <param name="pServerList"></param>
- /// <param name="BufSize"></param>
- /// <returns>Error code (0 = no error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int QueryServers(
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string pServerList,
- int BufSize);
- /// <summary>
- /// Query all running client programs for connected servers
- /// </summary>
- /// <param name="pServer"></param>
- /// <param name="pClientBuf"></param>
- /// <param name="BufSize"></param>
- /// <returns>Error code (0 = no error)</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int QueryUser(
- string pServer,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string pClientBuf,
- int BufSize);
- /// <summary>
- /// Start Quantax program and login automatically
- /// </summary>
- /// <param name="pServer">Server name</param>
- /// <param name="pUser">User name</param>
- /// <param name="pPassword">Password of user with User Name</param>
- /// <param name="StartNew"></param>
- /// <param name="GUI">Whether to start the user interface or not</param>
- /// <param name="CID">Connection Id</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int OpenClient(
- string pServer,
- string pUser,
- string pPassword,
- bool StartNew,
- bool GUI,
- ref uint CID);
- /// <summary>
- /// Start Quantax programm and login automatically
- /// </summary>
- /// <param name="pServer">Server name</param>
- /// <param name="pUser">User Name</param>
- /// <param name="pPassword">Password of User with User Name</param>
- /// <param name="Options">TOpenClientOptions Structur</param>
- /// <param name="CID">Connection Id</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int OpenClientEx(
- string pServer,
- string pUser,
- string pPassword,
- ref TOpenClientOptions Options,
- ref uint CID);
- /// <summary>
- /// Start Quantax programm and login automatically
- /// </summary>
- /// <param name="pServer">Server name</param>
- /// <param name="pUser">User Name</param>
- /// <param name="pPassword">Password of User with User Name</param>
- /// <param name="Options">TOpenClientOptions Structur</param>
- /// <param name="CID">Connection Id</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int OpenClientTCP(
- string pServer,
- string pUser,
- string pPassword,
- string pHost,
- ushort pPort,
- ref TOpenClientOptions Options,
- ref uint CID);
- /// <summary>
- /// query some information about a specific connection
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="pInfo">StringBuffer (contains informations about connection</param>
- /// <param name="BufSize">Size of Buffer</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int QueryInfo(
- uint CID,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string pInfo,
- int BufSize);
- /// <summary>
- /// Close corrent connection
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int CloseConnection(
- uint CID);
- /// <summary>
- /// Stop Quantax
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int CloseClient(
- uint CID);
- /// <summary>
- /// Is a specific client connection ok?
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <returns>0, if connection ok, otherwise error-no</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int CheckConnection(
- uint CID);
- /// <summary>
- /// Combine Spectrometer
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Devices">bit combination of spectrometers to combine</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int CombineSpectrometer(
- uint CID,
- int Devices);
- /// <summary>
- /// Starts Realtime Measurement
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <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>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int StartSpectrumMeasurement(
- uint CID,
- int Device,
- int RealTime);
- /// <summary>
- /// Starts Lifetime Measurement
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <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>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int StartSpectrumLifeTimeMeasurement(
- uint CID,
- int Device,
- int LifeTime);
- /// <summary>
- /// Starts Counter Measuremnet
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="SPU">Number of spectrometer ( 1 in most cases )</param>
- /// <param name="StartEnergy">Spectrum region low border for counter measurement (in keV)</param>
- /// <param name="EndEnergy">Spectrum region high border 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>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int StartSpectrumCounterMeasurement(
- uint CID,
- int SPU,
- double StartEnergy,
- double EndEnergy,
- int Counts);
- /// <summary>
- /// Stops current Measurement
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Device">Number of spectrometer ( 1 in most cases )</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error ) </returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int StopSpectrumMeasurement(
- uint CID,
- int Device);
- /// <summary>
- /// Read some values about current aquisition
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <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"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSpectrumMeasureState(
- uint CID,
- int Device,
- ref bool Running,
- ref double State,
- ref double PulseRate);
- /// <summary>
- /// Read some more values about current aquisition
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <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>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSpectrumMeasureStateEx(
- uint CID,
- int Device,
- ref bool Running,
- ref double State,
- ref double PulseRate,
- ref int RealTime);
- /// <summary>
- /// Read current spectrum from spectrometer to buffer
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Device">Number of spectrometer ( 1 in most cases )</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ReadSpectrum(
- uint CID,
- int Device);
- /// <summary>
- /// Get Spectrometer Configuration
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="SPU"></param>
- /// <param name="MaxEnergy"></param>
- /// <param name="PulseThroughput"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSpectrometerConfiguration(
- uint CID,
- int SPU,
- ref uint MaxEnergy,
- ref uint PulseThroughput);
- /// <summary>
- /// Get Spectrometer Configuration
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="SPU"></param>
- /// <param name="Det">Detector-Number</param>
- /// <param name="MaxEnergy"></param>
- /// <param name="PulseThroughput"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSpectrometerConfigurationEx(
- uint CID,
- int SPU,
- int Det,
- ref uint MaxEnergy,
- ref uint PulseThroughput);
- /// <summary>
- /// Sets Spectrometer Configuration
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="SPU"></param>
- /// <param name="Det">Detector-Number</param>
- /// <param name="MaxEnergy"></param>
- /// <param name="PulseThroughput"></param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetSpectrometerConfiguration(
- uint CID,
- int SPU,
- int Det,
- uint MaxEnergyIndex,
- uint PulseThroughputIndex);
- /// <summary>
- /// Sets active Detectors
- /// </summary>
- /// <param name="CID"></param>
- /// <param name="SPU"></param>
- /// <param name="Detectors">Active Detectors as bitmask (1 shl 0, etc.)</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetActiveDetectors(
- uint CID,
- int SPU,
- int Detectors);
- /// <summary>
- /// Get active Detectors
- /// </summary>
- /// <param name="CID"></param>
- /// <param name="SPU"></param>
- /// <param name="Detectors">Active Detectors as bitmask (1 shl 0, etc.)</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetActiveDetectors(
- uint CID,
- int SPU,
- out int Detectors);
- /// <summary>
- /// Get active Detectors
- /// </summary>
- /// <param name="CID"></param>
- /// <param name="SPU"></param>
- /// <param name="Detectors">Available Detectors as bitmask (1 shl 0, etc.)</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetAvailableDetectors(
- uint CID,
- int SPU,
- out int Detectors);
- /// <summary>
- /// Get active Detectors
- /// </summary>
- /// <param name="CID"></param>
- /// <param name="SPU"></param>
- /// <param name="Detectors">Available WDS Detectors as bitmask (1 shl 0, etc.)</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetAvailableWDSDetectors(
- uint CID,
- int SPU,
- out int Detectors);
- /// <summary>
- /// Get Hardware Configuration
- /// </summary>
- /// <param name="CID"></param>
- /// <param name="aHardwareConfiguration"></param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetHardwareConfiguration(
- uint CID,
- out TRTHardwareConfiguration aHardwareConfiguration);
- /// <summary>
- /// Calibrates the Spectrometer
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Device">Number of spectrometer ( 1 in most cases )</param>
- /// <param name="ShowProgress"></param>
- /// <param name="Settings"></param>
- /// <param name="Results"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int CalibrateSpectrometer(
- uint CID,
- int Device,
- bool ShowProgress,
- TRTCalibSettings Settings,
- TRTCalibResults Results);
- /// <summary>
- /// Get Spectrometer Parameter
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Device">Number of spectrometer ( 1 in most cases )</param>
- /// <param name="ParamName">
- /// Name of the parameter to read
- /// Current implemented names: 'MaxEnergy', 'PulseThroughput', 'DetectorTemperature' as 'longint' or 'Double'
- /// </param>
- /// <param name="ParamType">Type of the parameter to read (Byte,Boolean,Word,longint,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>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSpectrometerParam(
- uint CID,
- int Device,
- string ParamName,
- string ParamType,
- object Buffer,
- int BufSize);
- /// <summary>
- /// Read full parameter block of current spectrometer params (needed to create full Bruker spectrum)
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="SPU"></param>
- /// <param name="Buffer"></param>
- /// <param name="BufSize"></param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSpectrometerParams(
- uint CID,
- int SPU,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string Buffer,
- ref int BufSize);
- /// <summary>
- ///
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Buffer">Buffer index ( 0 for loaded spectrum buffer, > 0 for spectrometer buffers )</param>
- /// <param name="pSpectrumBuf"></param>
- /// <param name="BufSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetSpectrum(
- uint CID,
- int Buffer,
- TRTSpectrumHeaderRec pSpectrumBuf,
- int BufSize);
- /// <summary>
- /// Quantifies Spectrum
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Buffer">Number of spectrometer ( 1 in most cases )</param>
- /// <param name="pMethodName"></param>
- /// <param name="pParams"></param>
- /// <param name="pResultBuf"></param>
- /// <param name="ResultBufSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int QuantifySpectrum(
- uint CID,
- int Buffer,
- string pMethodName,
- string pParams,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string pResultBuf,
- int ResultBufSize);
- /// <summary>
- /// Sends a RCL 2.2 command to spectrometer and returns the answer( see RCL 2.2 description of commands )
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Device">Number of spectrometer ( 1 in most cases )</param>
- /// <param name="pCommand"></param>
- /// <param name="pAnswer"></param>
- /// <param name="AnswerBufSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SendRCLCommand(
- uint CID,
- int Device,
- string pCommand,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string pAnswer,
- int 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="CID">Connection Id</param>
- /// <param name="Device">Number of spectrometer ( 1 in most cases )</param>
- /// <param name="Command"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SendRCLCommandOnly(
- uint CID,
- int Device,
- string Command);
- /// <summary>
- /// Receives the answer of the SendRCLCommandOnly function
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Device">Number of spectrometer ( 1 in most cases )</param>
- /// <param name="Answer"></param>
- /// <param name="AnswerBufSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- //
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ReceiveRCLAnswer(
- uint CID,
- int Device,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string Answer,
- int AnswerBufSize);
- /// <summary>
- /// Interupts QM100's communication to specified device until 'UnlockSpectrometer' is called
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Device">Number of spectrometer ( 1 in most cases )</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int LockSpectrometer(
- uint CID,
- int Device);
- /// <summary>
- /// Starts QM100's communication to specified device after 'LockSpectrometer' was called
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Device">Number of spectrometer ( 1 in most cases )</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int UnlockSpectrometer(
- uint CID,
- int Device);
- /// <summary>
- /// Load spectrum from file to buffer
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="pFileName">Complete filename for spectrum ( normally with *.spx extension )</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int LoadSpectrum(
- uint CID,
- string pFileName);
- /// <summary>
- /// Send spectrum back to 'loaded' buffer
- /// if one wants to use that function one has to build a complete Bruker spectrum with
- /// functions 'GetSpectrum', 'GetSpectrometerParams' and 'CreateSpectrum'
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Spectrum">Bruker spectrum buffer</param>
- /// <param name="BufSize">size of spectrum buffer</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int PutSpectrum(
- uint CID,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string Spectrum,
- int BufSize);
- /// <summary>
- /// Save spectrum buffer to file
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Buffer"></param>
- /// <param name="pFileName">Complete filename for spectrum ( normally with *.spx extension )</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SaveSpectrum(
- uint CID,
- int Buffer,
- string pFileName);
- /// <summary>
- /// Create a complete Bruker spectrum from
- /// </summary>
- /// <param name="SpectrometerParams"></param>
- /// <param name="SpectrumData"></param>
- /// <param name="ResultData"></param>
- /// <param name="ResultSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int CreateSpectrum(
- string SpectrometerParams,
- TRTSpectrumHeaderRec SpectrumData,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string ResultData,
- ref int ResultSize);
- /// <summary>
- /// Get Corrected Spectrum
- /// </summary>
- /// <param name="SpectrometerParams"></param>
- /// <param name="Spectrum"></param>
- /// <param name="ResultData"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetCorrectedSpectrum(
- string SpectrometerParams,
- TRTSpectrumHeaderRec Spectrum,
- double ResultData);
- /// <summary>
- /// Shows Spectrum
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Buffer"></param>
- /// <param name="Name"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int ShowSpectrum(
- uint CID,
- int Buffer,
- string Name);
- /// <summary>
- /// Delete Spectrum
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="aName"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int DeleteSpectrum(
- uint CID,
- string aName);
- /// <summary>
- /// Get a list of avaliable hardware profiles from client
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="pProfiles"></param>
- /// <param name="BufSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetHardwareProfiles(
- uint CID,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string pProfiles,
- int BufSize);
- /// <summary>
- /// Set a specific hardware profile
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// /// <param name="pProfiles"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- // Set a specific hardware profile
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int SetHardwareProfile(
- uint CID,
- string pProfile);
- /// <summary>
- /// Get a list of avaliable quantification methods
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="AutomaticOnly"></param>
- /// <param name="pMethods"></param>
- /// <param name="BufSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetQuantificationMethods(
- uint CID,
- bool AutomaticOnly,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string pMethods,
- int BufSize);
- /// <summary>
- /// Get a list of predefined elements from a given quant method
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="MethodName"></param>
- /// <param name="ElementBuffer"></param>
- /// <param name="BufSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetQuantificationMethodElements(
- uint CID,
- string MethodName,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string ElementBuffer,
- int BufSize);
- /// <summary>
- /// Call method editor for a given quant method
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="MethodName"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int EditQuantificationMethod(
- uint CID,
- string MethodName);
- /// <summary>
- /// Get a channel region for desired element and X ray line
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Buffer"></param>
- /// <param name="Params"></param>
- /// <param name="ResultBuf"></param>
- /// <param name="ResultBufSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int GetRegionForElement(
- uint CID,
- int Buffer,
- string Params,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string ResultBuf,
- int ResultBufSize);
- // Xray tube functions
- /// <summary>
- /// XRay Tube Set Configuration
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Tube"></param>
- /// <param name="HighVoltage">tube voltage [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>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int XRayTubeSetConfiguration(
- uint CID,
- int Tube,
- int HighVoltage,
- int Current,
- int FilterIndex);
- /// <summary>
- /// XRay Tube Get State
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Tube"></param>
- /// <param name="HighVoltage">tube voltate [Volt]</param>
- /// <param name="Current">tube current [µA]</param>
- /// <param name="FilterIndex">index of selected filter</param>
- /// <param name="ShutterOpen"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int XRayTubeGetState(
- uint CID,
- int Tube,
- out int HighVoltage,
- out int Current,
- out int FilterIndex,
- out bool ShutterOpen);
- /// <summary>
- /// XRay Tube Open Shutter
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Tube"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int XRayTubeOpenShutter(
- uint CID,
- int Tube);
- /// <summary>
- /// XRay Tube Close Shutter
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Tube"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int XRayTubeCloseShutter(
- uint CID,
- int Tube);
-
- /// <summary>
- /// XRay Set active tube
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Tube"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int XRaySetActiveTube(
- uint CID,
- int Tube);
-
- /// <summary>
- /// XRay Get active tube
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Tube"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int XRaySetActiveTube(
- uint CID,
- out int Tube);
- // Hypermap functions, function 'HyMapStart' is specific for Esprit/M4
- /// <summary>
- /// Hypermap Stop
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="WaitForFrameEnd"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapStop(
- uint CID,
- bool WaitForFrameEnd);
- /// <summary>
- /// Clear Hypermap database structure
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapClearDatabase(
- uint CID);
- /// <summary>
- /// Gets Hypermap State
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <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>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapGetState(
- uint CID,
- ref bool Running,
- ref double MeasureState);
- /// <summary>
- /// Gets more Informations about Hypermap State
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <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>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapGetStateEx(
- uint CID,
- ref bool Running,
- ref double MeasureState,
- ref int CurrentLine);
- /// <summary>
- /// Hypermap Get XY-Spectrum
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="X"></param>
- /// <param name="Y"></param>
- /// <param name="Corrected"></param>
- /// <param name="SpectrumBuffer">SpectrumBuffer : pointer to memory, must have space for one full spectrum</param>
- /// <param name="BufferSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapGetXYSpectrum(
- uint CID,
- int X,
- int Y,
- bool Corrected,
- TRTSpectrumHeaderRec SpectrumBuffer,
- int BufferSize);
- /// <summary>
- /// Hypermap GetLineSpectra
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="X"></param>
- /// <param name="Y"></param>
- /// <param name="Count"></param>
- /// <param name="Corrected"></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"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapGetLineSpectra(
- uint CID,
- int X,
- int Y,
- int Count,
- bool Corrected,
- TPointerArray SpectrumBuffer,
- ref int BufferSize);
-
- /// <summary>
- /// Hypermap GetCompressedLineSpectra
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="X"></param>
- /// <param name="Y"></param>
- /// <param name="Count"></param>
- /// <param name="Corrected"></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"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapCompressedGetLineSpectra(
- uint CID,
- int X,
- int Y,
- int Count,
- bool Corrected,
- TPointerArray SpectrumBuffer,
- ref int BufferSize);
-
- /// <summary>
- /// Hypermap Quantifiy Spectra
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="Points"></param>
- /// <param name="PointCount"></param>
- /// <param name="Binning"></param>
- /// <param name="MethodName"></param>
- /// <param name="Params"></param>
- /// <param name="ResultBuf"></param>
- /// <param name="ResultBufSize"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapQuantifySpectra(
- uint CID,
- TPointArray Points,
- int PointCount,
- int Binning,
- string MethodName,
- string Params,
- [MarshalAs(UnmanagedType.VBByRefStr)] ref string ResultBuf,
- int ResultBufSize);
- /// <summary>
- /// Hapermap Save to File
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="aFileName">file name</param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapSaveToFile(
- uint CID,
- string aFileName);
- /// <summary>
- /// Hypermap Load from File
- /// </summary>
- /// <param name="CID">Connection Id</param>
- /// <param name="aFileName">file name</param>
- /// <param name="Width"></param>
- /// <param name="Height"></param>
- /// <param name="DetCount"></param>
- /// <param name="ImgCount"></param>
- /// <returns>Function call sucessful or not ( 0 = success, otherwise error )</returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapLoadFromFile(
- uint CID,
- string aFileName,
- out int Width,
- out int Height,
- out int DetCount,
- out int ImgCount);
- /// <summary>
- /// Extract a mixed map image
- /// </summary>
- /// <param name="Format">Image format which shell be used for image buffer creation, can be 'bmp','png','tif','jpg'</param>
- /// <param name="Buffer">Memory buffer provided by caller, must be large enough to handle image data</param>
- /// <param name="BufferSize">Maximum size of buffer available, returns size which really used</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapGetMixedMapImage(
- uint CID,
- string Format,
- IntPtr Buffer,
- ref int BufferSize);
- /// <summary>
- /// Extract an element image for a predefined element
- /// </summary>
- /// <param name="Format">Image format which shell be used for image buffer creation, can be 'bmp','png','tif','jpg'</param>
- /// <param name="ElementIndex">Index into list of previously defined elements from 'InitializeSpectrumDatabaseElementIntensities'</param>
- /// <param name="Buffer">Memory buffer provided by caller, must be large enough to handle image data</param>
- /// <param name="BufferSize">Maximum size of buffer available, returns size which really used</param>
- /// <returns></returns>
- [DllImport(rtdll, CharSet = CharSet.Ansi)]
- public static extern int HyMapGetElementImage(
- uint CID,
- string Format,
- int ElementIndex,
- object Buffer,
- ref int BufferSize);
- public static uint FCID = 0;
- public static string Servername = "Lokaler Server";
- public static string Username = "edx";
- public static string Password = "edx";
- public static string TCPHost = "127.0.0.1";
- public static int TCPPort = 5328;
- }
- }
|