Spectrion as COM server


The connection to Spectrion is thru COM standard of Windows. The properties and methods should be visible immediately after importing "Spectrion.tlb" into your program environment, in some program languages special care for event handling should be taken.

The example project SpcnClient (source included) demonstrates the abilities of Spectrion as COM server. Notice that for Command and Procedur methods separate threads are created to keep user interface free for user access and especially for Abort button (and method).

Properties

ExePath: WideString, read-only

    Get back the full path to Spectrion.exe, usually needed to find the directory for scans, tunes etc.

    The version number of Spectrion should be checked as well - Itr.ShwVer

Methods

Command(var InOutText: WideString; out Success: WordBool);

    Execute one command from Spectrion script  

    InOutText contents the command (including the parameters) according Spectrion script syntax and gets back the result from execution of the command. Success is true when the execution is successful and vice verce.

Procedur(const WhichProc, PrmList: WideString);

    Execute a specific procedure with parameters list in a setting file with name in "PrmList".

    Possible procedures:

        UniScan, setting file extension -> '.scn', directory -> RootPath+'Scan\'

        AutoTune, setting file extension -> '.tun', directory -> RootPath+'Scan\'

Abort

    Closes all the data streams and simulates pressing Stop button on Synchro device

GetSpec(Num: Integer; var SpecX, SpecY: OleVariant);

    returns the mass-spec of Num plot as two arrays of double (0-based); 

    if Num<0 then the active plot is returned

Events

EventCommand(const Cmd: WideString; const Reply: WideString); dispid 1;

    Spectrion fires that event when the command from Spectrion script has been executed, "Cmd" is the command itself and "Reply" is the answer.


EventDvcState(const DvcName: WideString; OldSt: Integer; NewSt: Integer); dispid 2;

    Spectrion fires that event, if any of the devices has been changed its state. "DvcName" is the name of the device

    and OldSt (old state)/ NewSt (new state) are coded as follow:

    0 - None: blue caption, undefined initial state
    1 - OffLine:   white caption, initialization did not pass either because device has been switched Off from Options or there is no connection to the real device
    2 - Standby:   inactive caption, all tensions '0' and NO remotely access
    3 - Running:   active caption, normal state
    4 - Warning:  yellow caption, as Running but with warning
    5 - Danger:    red caption, switches to Standby internal state due to dangerous conditions