Main Page | Features | Central Services | csv-Files | Types | Transfer | Access | API-C | API-VB/ActiveX | API-Java | Examples | Downloads
Public Member Functions
tine::TLink Class Reference

Defines a connection between the local client and the remote server's targeted end point. More...

List of all members.

Public Member Functions

int Attach (TLinkCallback cb)
 Initiates an asynchronous link.
int Attach (UInt32 mode, TLinkCallback cb)
 Initiates an asynchronous link.
int Attach (UInt32 mode, TLinkCallback cb, Int32 accessRate)
 Initiates an asynchronous link.
int Close ()
 Closes a TLink.
int Execute (UInt32 timeout)
 Executes a synchronous link.
int Execute ()
 Executes a synchronous link.
Int32 GetStatus ()
 The current link status as an integer value.
string GetStatusString ()
 The current link status as a string.
 TLink (string devName, string devProperty, TDataType dout, TDataType din, UInt16 access)
 Establishes a link endpoint to the targeted server.

Detailed Description

Defines a connection between the local client and the remote server's targeted end point.

TLink is a TINE Link object which defines a connection between the local client and the remote server's targeted end point. Data may be exchanged either synchronously (via the Execute() method) or asynchronously (via the Attach() method). Simple commands which do not involve data can likewise be issued synchronously.


Constructor & Destructor Documentation

tine::TLink::TLink ( string  devName,
string  devProperty,
TDataType  dout,
TDataType  din,
UInt16  access 
) [inline]

Establishes a link endpoint to the targeted server.

Creating a TLink instance will only register the desired link parameters at the client side. It will NOT exchange data or otherwise establish a connection.

Note that supplying an input data object does NOT constitute a 'WRITE' command to the targeted server! Input data is simply 'input data'. The access of the call is determined by the the access parameter.

Parameters:
devNameis the desired device name of the target, in the form of '/context/server/device'.
devPropertyis the desired property of the target
doutis the desired output data object (data returned from the server)
dinis the given input data object (data sent to the server)
accessis the desired access of this link object

Member Function Documentation

int tine::TLink::Attach ( TLinkCallback  cb) [inline]

Initiates an asynchronous link.

Asynchronous data exchange. Attach() returns immediately with a positive link index if the device name can be resolved and there are sufficient resources on the client side. Otherwise, a call to Attach() returns a negative completion code. This method automatically choses to monitor the endpoint in CM_TIMER mode at an access rate of 1 Hz (1000 msec polling interval).

Parameters:
cbis the event callback routine which is fired when new data arrive or an error conditions arrises. This must have the prototype: void TLinkCallback(TLink lnk);
Returns:
a positive link index or the negative of a TINE completion code.
int tine::TLink::Attach ( UInt32  mode,
TLinkCallback  cb 
) [inline]

Initiates an asynchronous link.

Asynchronous data exchange. Attach() returns immediately with a positive link index if the device name can be resolved and there are sufficient resources on the client side. Otherwise, a call to Attach() returns a negative completion code. This method uses an access rate of 1 Hz (1000 msec polling interval).

Parameters:
modeis the desired access mode, i.e. CM_TIMER, CM_DATACHANGE, CM_EVENT, etc. with possible modifiers (see Modes).
cbis the event callback routine which is fired when new data arrive or an error conditions arrises. This must have the prototype: void TLinkCallback(TLink lnk);
Returns:
a positive link index or the negative of a TINE completion code.
int tine::TLink::Attach ( UInt32  mode,
TLinkCallback  cb,
Int32  accessRate 
) [inline]

Initiates an asynchronous link.

Asynchronous data exchange. Attach() returns immediately with a positive link index if the device name can be resolved and there are sufficient resources on the client side. Otherwise, a call to Attach() returns a negative completion code.

Parameters:
modeis the desired access mode, i.e. CM_TIMER, CM_DATACHANGE, CM_EVENT, etc. with possible modifiers (see Modes).
cbis the event callback routine which is fired when new data arrive or an error conditions arrises. This must have the prototype: void TLinkCallback(TLink lnk);
accessRateis the desired access polling interval in milliseconds. This interval is maintained at the server and is used to trigger the server's scheduler.
Returns:
a positive link index or the negative of a TINE completion code.

Example:

    public void lcb(tine.TLink lnk)
    {
      if (lnk.GetStatus() != 0) Console.WriteLine("Link Status : " + lnk.GetStatus());
      if (bunchProfile.InvokeRequired)
        bunchProfile.Invoke(new MethodInvoker(updatePlot));
      else
        updatePlot();
    }

    public void startLink()
    {
      cb = new TLink.TLinkCallback(lcb);
      tdt = new TDataType(currBuffer);
      tnull = new TDataType(IntPtr.Zero);

      currLink = new TLink("/PETRA/BunchScope/Bunch-1", "I.Bunch.SCH", tdt, tnull, tine.Access.CA_READ);

      int id = currLink.Attach(tine.Modes.CM_TIMER, cb, 1000);
    }
int tine::TLink::Close ( ) [inline]

Closes a TLink.

If the link is not currently attached to an input, this call has no effect.

Returns:
0 upon success or a TINE error code.
int tine::TLink::Execute ( UInt32  timeout) [inline]

Executes a synchronous link.

Synchronous data exchange. ExecLink() does not complete until the data transfer has completed or a timeout has ensued.

Parameters:
timeoutis the designated timeout in milliseconds.
Returns:
0 if successful, otherwise a TINE completion code.
int tine::TLink::Execute ( ) [inline]

Executes a synchronous link.

Synchronous data exchange. ExecLink() does not complete until the data transfer has completed or a timeout has ensued. This call uses the default timeout of 1000 msec.

Returns:
0 if successful, otherwise a TINE completion code.

Example:

      float[] a = new float[10];
      TDataType t1 = new TDataType(v);
      tnull = new TDataType(IntPtr.Zero);
      TLink lnk = new TLink("/TEST/SineServer/SineGen0", "Amplitude", t1, tnull, tine.Access.CA_READ);
 
      int cc = lnk.Execute();

      if (cc != 0)
      {
        Console.WriteLine("link error: " + lnk.GetStatusString());
      }
Int32 tine::TLink::GetStatus ( ) [inline]

The current link status as an integer value.

Returns:
The current link status.
string tine::TLink::GetStatusString ( ) [inline]

The current link status as a string.

Returns:
The current link status as a string.

The documentation for this class was generated from the following file:

Generated for TINE API by  doxygen 1.5.8