Defines a connection between the local client and the remote server's targeted end point. More...
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. | |
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.
| 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.
| devName | is the desired device name of the target, in the form of '/context/server/device'. |
| devProperty | is the desired property of the target |
| dout | is the desired output data object (data returned from the server) |
| din | is the given input data object (data sent to the server) |
| access | is the desired access of this link object |
| 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).
| cb | is 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); |
| 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).
| mode | is the desired access mode, i.e. CM_TIMER, CM_DATACHANGE, CM_EVENT, etc. with possible modifiers (see Modes). |
| cb | is 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); |
| 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.
| mode | is the desired access mode, i.e. CM_TIMER, CM_DATACHANGE, CM_EVENT, etc. with possible modifiers (see Modes). |
| cb | is 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); |
| accessRate | is the desired access polling interval in milliseconds. This interval is maintained at the server and is used to trigger the server's scheduler. |
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.
| 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.
| timeout | is the designated timeout in milliseconds. |
| 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.
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.
| string tine::TLink::GetStatusString | ( | ) | [inline] |
The current link status as a string.
1.5.8