Main Page | Features | Central Services | csv-Files | Types | Transfer | Access | API-C | API-.NET | API-Java | Examples | Downloads
page generated on 21.11.2024 - 04:45
Public Member Functions | Static Public Member Functions | List of all members
tine.TLink Class Reference

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

Public Member Functions

int Attach (string devName, string devProperty, TDataType dout, TDataType din, UInt16 access, Int32 accessRate, TLinkCallback cb, UInt32 mode, UInt32 cbId, IntPtr cbRef)
 Initiates an asynchronous link based exclusively on the calling parameters, irrespective of those assigned to this TLink object. More...
 
int Attach (TLinkCallback cb)
 Initiates an asynchronous link. More...
 
int Attach (UInt32 mode, TLinkCallback cb)
 Initiates an asynchronous link. More...
 
int Attach (UInt32 mode, TLinkCallback cb, Int32 accessRate)
 Initiates an asynchronous link. More...
 
int Close ()
 Closes a TLink. More...
 
int Execute ()
 Executes a synchronous link. More...
 
int Execute (string devName, string devProperty, TDataType dout, TDataType din, Int16 access, UInt32 timeout)
 Executes a synchronous link based exclusively on the calling parameters, irrespective of those assigned to this TLink object. More...
 
int Execute (UInt16 mode, UInt32 timeout)
 Executes a synchronous link. More...
 
int Execute (UInt32 timeout)
 Executes a synchronous link. More...
 
UInt32 GetAccessMode ()
 The assigned access mode (e.g. CM_SINGLE, CM_TIMER, CM_DATACHANGE). More...
 
Int32 GetAccessRate ()
 The assigned access rate (or timeout parameter if a synchronous call is underway). More...
 
int GetCompletionDataSize ()
 The size (array length) of the returned data More...
 
double GetCompletionDataStamp ()
 The user-supplied data stamp of the returned data More...
 
double GetCompletionDataTimeStamp ()
 The timestamp of the returned data More...
 
double GetCompletionSystemStamp ()
 The system stamp assigned to the returned data More...
 
String GetDeviceName ()
 Returns the device (module) name addressed in this link. More...
 
TDataType GetInputDataType ()
 Returns the input TDataType object. More...
 
Int32 GetLinkId ()
 Gets the associated link ID for this TLink instance; More...
 
TDataType GetOutputDataType ()
 Returns the output TDataType object. More...
 
String GetProperty ()
 Returns the device property addressed in this link. More...
 
Int32 GetStatus ()
 The current link status as an integer value. More...
 
string GetStatusString ()
 The current link status as a string More...
 
int SetNotificationTolerance (float toleranceAbsolute, float tolerancePercent)
 
int SetNotificationTolerance (float toleranceAbsolute, float tolerancePercent, Int32 flags)
 
int SetNotificationTolerance (float toleranceAbsolute, float tolerancePercent, Int32 offset, Int32 length, Int32 flags)
 
void SetQueueDepth (int queueLength)
 Sets the client-side receive queue depth More...
 
 TLink (string devName, string devProperty, TDataType dout, TDataType din, UInt16 access)
 Establishes a link endpoint to the targeted server. More...
 
delegate void TLinkCallback (TLink lnk)
 A callback delegate to be called when the associated TLink needs to notify the caller that a data or status update has occured. More...
 

Static Public Member Functions

static UInt32 EncodeLinkFlagsForAcop (UInt16 access, UInt16 mode)
 Combines at TINE access code and a TINE transfer mode code into a single 'link flags' value for use in the ACOP transport layer. More...
 
static void FlushFecAddrCache ()
 Flushes the current client-side address cache, redirection table and black list More...
 
static void SetCommonQueueDepth (int queueLength)
 Sets the client-side receive queue depth setting for all links More...
 

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

◆ TLink()

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

◆ Attach() [1/4]

int tine.TLink.Attach ( string  devName,
string  devProperty,
TDataType  dout,
TDataType  din,
UInt16  access,
Int32  accessRate,
TLinkCallback  cb,
UInt32  mode,
UInt32  cbId,
IntPtr  cbRef 
)
inline

Initiates an asynchronous link based exclusively on the calling parameters, irrespective of those assigned to this TLink object.

Parameters
devNamethe target device name
devPropertythe target property
doutthe desired link output data object
dinthe link input data object
accessthe requested link access (CA_READ or CA_WRITE)
accessRatethe requested access interval in milliseconds.
cbis the event callback routine which is fired when new data arrive or an error
Parameters
modeis the desired access mode, i.e. CM_TIMER, CM_DATACHANGE, CM_EVENT, etc. with possible modifiers (see Modes).
conditions arrises. This must have the prototype: void TLinkCallback(TLink lnk);
cbIda requested callback ID to receive when the callback delegate is called
cbRefa requested object reference to receive when the callback delegate is called
Returns
a positive link index or the negative of a TINE completion code.

Referenced by tine.TLink.Attach(), and tine.TTrace.MonitorTrace().

◆ Attach() [2/4]

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.

References tine.TLink.Attach().

◆ Attach() [3/4]

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.

References tine.TLink.Attach().

◆ Attach() [4/4]

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()
{
TLink.TLinkCallback cb = new TLink.TLinkCallback(lcb);
TDataType tdt = new TDataType(currBuffer);
TDataType tnull = new TDataType(IntPtr.Zero);
TLink 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);
}

◆ Close()

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.

Referenced by tine.TTrace.StopMonitor().

◆ EncodeLinkFlagsForAcop()

static UInt32 tine.TLink.EncodeLinkFlagsForAcop ( UInt16  access,
UInt16  mode 
)
inlinestatic

Combines at TINE access code and a TINE transfer mode code into a single 'link flags' value for use in the ACOP transport layer.

Parameters
accessA code or combination of codes from the Access constants
modeA code or combination of codes from the Modes constants
Returns
The encoded value for use in the ACOP transport layer

Using the ACOP Attach() method without passing any flags (i.e. flags = 0) defaults to mode = Modes.CM_TIMER and access = Access.CA_READ. Using the ACOP Execute() method with flags = 0 defaults to mode = Modes.CM_SINGLE and access = Access.CA_READ.
The simplest way of issuing a WRITE command is to pass Access.CA_WRITE directly to the ACOP Execute() method as the 'flags' parameter.

◆ Execute() [1/4]

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[] v = new float[10];
TDataType t1 = new TDataType(v);
TDataType 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());
}
else
{
Console.WriteLine("v : "+v[0].ToString());
}

◆ Execute() [2/4]

int tine.TLink.Execute ( string  devName,
string  devProperty,
TDataType  dout,
TDataType  din,
Int16  access,
UInt32  timeout 
)
inline

Executes a synchronous link based exclusively on the calling parameters, irrespective of those assigned to this TLink object.

Parameters
devNamethe target device name
devPropertythe target property
doutthe desired link output data object
dinthe link input data object
accessthe requested link access (CA_READ or CA_WRITE)
timeoutthe timeout in milliseconds.
Returns
0 if successful, otherwise a TINE completion code.

Referenced by tine.THistory.GetArchivedDataSnapshot(), tine.TQuery.GetSystemDevices(), and tine.TTrace.GetTraceSequence().

◆ Execute() [3/4]

int tine.TLink.Execute ( UInt16  mode,
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
modeis a mode specification to force standard TCP communication (CM_CONNECT) or STREAM communication (CM_STREAM).
timeoutis the designated timeout in milliseconds.
Returns
0 if successful, otherwise a TINE completion code.

◆ Execute() [4/4]

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.

◆ FlushFecAddrCache()

static void tine.TLink.FlushFecAddrCache ( )
inlinestatic

Flushes the current client-side address cache, redirection table and black list

◆ GetAccessMode()

UInt32 tine.TLink.GetAccessMode ( )
inline

The assigned access mode (e.g. CM_SINGLE, CM_TIMER, CM_DATACHANGE).

Returns
The assigned access mode

◆ GetAccessRate()

Int32 tine.TLink.GetAccessRate ( )
inline

The assigned access rate (or timeout parameter if a synchronous call is underway).

Returns
The assigned access rate (or timeout parameter if a synchronous call is underway)

◆ GetCompletionDataSize()

int tine.TLink.GetCompletionDataSize ( )
inline

The size (array length) of the returned data

Returns
the size in elements of the returned data

Referenced by tine.THistory.GetArchivedDataSnapshot().

◆ GetCompletionDataStamp()

double tine.TLink.GetCompletionDataStamp ( )
inline

The user-supplied data stamp of the returned data

Returns
The user-supplied data stamp of the returned data

◆ GetCompletionDataTimeStamp()

double tine.TLink.GetCompletionDataTimeStamp ( )
inline

The timestamp of the returned data

Returns
The timestamp of the returned data

Referenced by tine.THistory.GetArchivedDataSnapshot(), tine.TTrace.GetReferenceTimestamp(), and tine.TTrace.GetTraceTimestamp().

◆ GetCompletionSystemStamp()

double tine.TLink.GetCompletionSystemStamp ( )
inline

The system stamp assigned to the returned data

Returns
The system stamp assigned to the returned data

◆ GetDeviceName()

String tine.TLink.GetDeviceName ( )
inline

Returns the device (module) name addressed in this link.

Returns
The device (module) name addressed in the current link

◆ GetInputDataType()

TDataType tine.TLink.GetInputDataType ( )
inline

Returns the input TDataType object.

Returns
the intput TDataType object

◆ GetLinkId()

Int32 tine.TLink.GetLinkId ( )
inline

Gets the associated link ID for this TLink instance;

Returns
The associated link ID ('-1' => unassigned)

◆ GetOutputDataType()

TDataType tine.TLink.GetOutputDataType ( )
inline

Returns the output TDataType object.

Returns
the output TDataType object

◆ GetProperty()

String tine.TLink.GetProperty ( )
inline

Returns the device property addressed in this link.

Returns
The device property addressed in the current link

◆ GetStatus()

Int32 tine.TLink.GetStatus ( )
inline

The current link status as an integer value.

Returns
The current link status.

Referenced by tine.TTrace.GetReferenceTimestamp().

◆ GetStatusString()

string tine.TLink.GetStatusString ( )
inline

The current link status as a string

Returns
The current link status as a string.

Referenced by tine.TTrace.GetTraceSequence().

◆ SetCommonQueueDepth()

static void tine.TLink.SetCommonQueueDepth ( int  queueLength)
inlinestatic

Sets the client-side receive queue depth setting for all links

Parameters
queueLengthis the requested queue depth (values less than zero are ignored). A value of zero implies no queue will be maintained.

◆ SetNotificationTolerance() [1/3]

int tine.TLink.SetNotificationTolerance ( float  toleranceAbsolute,
float  tolerancePercent 
)
inline

Allows the caller to apply a tolerance pertaining to link notification.

When a TINE client subscribes to data using CM_DATACHANGE mode, the data is sent from server to client when the data change without regard to any applied tolerance (zero tolerance). The client application may nonetheless wish to be notified only when the data have changed outside a given tolerance. This can be achieved by calling this routine. The same applies to CM_TIMER mode, where the data are sent server-to-client according to the schedule. In the latter case, all data comparisons are made entirely at the client side. Note that if this feature is desired in CM_TIMER mode, the CM_NODUPLICATES switch must be applied to the mode parameter in the call to AttachLink() or AttachLinkEx(). This switch will be appended automatically if SetSuppressHeartbeatNotification(TRUE) is called.

Parameters
toleranceAbsoluteif non-zero is a tolerance in the data units of the in-coming data. It is checked against irrespective of the current data values.
tolerancePercentif non-zero is a tolerance expressed as a percent, and refers to the previous data set.

If both an absolute tolerance and a percent tolerance are used, the absolute value of both contributions are added together to define the total tolerance which should be checked against.

Returns
0 upon success

References tine.TLink.SetNotificationTolerance().

◆ SetNotificationTolerance() [2/3]

int tine.TLink.SetNotificationTolerance ( float  toleranceAbsolute,
float  tolerancePercent,
Int32  flags 
)
inline

Allows the caller to apply a tolerance pertaining to link notification.

When a TINE client subscribes to data using CM_DATACHANGE mode, the data is sent from server to client when the data change without regard to any applied tolerance (zero tolerance). The client application may nonetheless wish to be notified only when the data have changed outside a given tolerance. This can be achieved by calling this routine. The same applies to CM_TIMER mode, where the data are sent server-to-client according to the schedule. In the latter case, all data comparisons are made entirely at the client side. Note that if this feature is desired in CM_TIMER mode, the CM_NODUPLICATES switch must be applied to the mode parameter in the call to AttachLink() or AttachLinkEx(). This switch will be appended automatically if SetSuppressHeartbeatNotification(TRUE) is called.

Parameters
toleranceAbsoluteif non-zero is a tolerance in the data units of the in-coming data. It is checked against irrespective of the current data values.
tolerancePercentif non-zero is a tolerance expressed as a percent, and refers to the previous data set.
flagsis one of DTF_SUPPRESS or DTF_NOTIFY and specifies the desired form of the the 'out of tolerance' notification (DEFAULT: DTF_SUPPRESS). If DTF_SUPPRESS is specified, then callbacks will be suppressed unless there is an error or the most recent data set is out of tolerance.
If DTF_NOTIFY is specified, then callbacks will not be suppressed. However, if the most recent data set is out of tolerance, then an otherwise successful callback completion code will be flagged as CE_SENDDATA + out_of_tolerance. The caller can then make use of this form of 'out of tolerance' signal to suit his needs.

If both an absolute tolerance and a percent tolerance are used, the absolute value of both contributions are added together to define the total tolerance which should be checked against.

Returns
0 upon success

References tine.TLink.SetNotificationTolerance().

◆ SetNotificationTolerance() [3/3]

int tine.TLink.SetNotificationTolerance ( float  toleranceAbsolute,
float  tolerancePercent,
Int32  offset,
Int32  length,
Int32  flags 
)
inline

Allows the caller to apply a tolerance pertaining to link notification.

When a TINE client subscribes to data using CM_DATACHANGE mode, the data is sent from server to client when the data change without regard to any applied tolerance (zero tolerance). The client application may nonetheless wish to be notified only when the data have changed outside a given tolerance. This can be achieved by calling this routine. The same applies to CM_TIMER mode, where the data are sent server-to-client according to the schedule. In the latter case, all data comparisons are made entirely at the client side. Note that if this feature is desired in CM_TIMER mode, the CM_NODUPLICATES switch must be applied to the mode parameter in the call to AttachLink() or AttachLinkEx(). This switch will be appended automatically if SetSuppressHeartbeatNotification(TRUE) is called.

Parameters
toleranceAbsoluteif non-zero is a tolerance in the data units of the in-coming data. It is checked against irrespective of the current data values.
tolerancePercentif non-zero is a tolerance expressed as a percent, and refers to the previous data set.
offsetspecifies the array offset to be used in data comparison (DEFAULT: 0). If the given offset is less then 0 or greater than the length of the acquired data array (i.e. > 1 if a single value is acquired) it will be automatically set to 0.
lengthspecifes the length of the data array (beginning at the given offset) to be used in data comparison (DEFAULT: length of the acquire data array, or 1 if a single value is acquired). If the given value exceeds the array bounds, then it will be adjusted.
flagsis one of DTF_SUPPRESS or DTF_NOTIFY and specifies the desired form of the the 'out of tolerance' notification (DEFAULT: DTF_SUPPRESS). If DTF_SUPPRESS is specified, then callbacks will be suppressed unless there is an error or the most recent data set is out of tolerance.
If DTF_NOTIFY is specified, then callbacks will not be suppressed. However, if the most recent data set is out of tolerance, then an otherwise successful callback completion code will be flagged as CE_SENDDATA + out_of_tolerance. The caller can then make use of this form of 'out of tolerance' signal to suit his needs.

If both an absolute tolerance and a percent tolerance are used, the absolute value of both contributions are added together to define the total tolerance which should be checked against.

Returns
0 upon success

Referenced by tine.TLink.SetNotificationTolerance().

◆ SetQueueDepth()

void tine.TLink.SetQueueDepth ( int  queueLength)
inline

Sets the client-side receive queue depth

Parameters
queueLengthis the requested queue depth (values less than zero are ignored). A value of zero implies no queue will be maintained.

◆ TLinkCallback()

delegate void tine.TLink.TLinkCallback ( TLink  lnk)

A callback delegate to be called when the associated TLink needs to notify the caller that a data or status update has occured.

Parameters
lnkA reference to the TLink object which is calling the delegate.

The documentation for this class was generated from the following file:
tine.Modes
Available Link Transfer Modes
Definition: tine.cs:49
tine.Access
Available Access Flags
Definition: tine.cs:136
tine
Definition: tine.cs:12

Impressum   |   Imprint   |   Datenschutzerklaerung   |   Data Privacy Policy   |   Declaration of Accessibility   |   Erklaerung zur Barrierefreiheit
Generated for TINE API by  doxygen 1.5.8