TLink.java. More...
Public Member Functions | |
| void | setNotificationTolerance (float absoluteValue, float percentValue) |
| Sets the tolerance level for asynchronous event notification. | |
| int | getLinkStatus () |
| Returns the current status for this link. | |
| String | getContext () |
| Returns the context of this link. | |
| String | getDeviceServer () |
| Returns the device server addressed in this link. | |
| String | getDeviceName () |
| Returns the device (module) name addressed in this link. | |
| String | getProperty () |
| Returns the device property addressed in this link. | |
| String | getFullDeviceName () |
| Returns the fully qualified device name addressed in this link. | |
| String | getFullDeviceNameAndProperty () |
| Returns the fully qualified device name and property addressed in this link. | |
| TDataType | getOutputDataObject () |
| Returns the output data object as a TDataType. | |
| TDataType | getInputDataObject () |
| Returns the output data input as a TDataType. | |
| long | getLastTimeStamp () |
| The last link timestamp. | |
| double | getLastDataTimeStamp () |
| The last link timestamp as a TINE double timestamp value. | |
| String | getLastError () |
| The last link status in plain text. | |
| String | getError (int code) |
| The specified error code in plain text. | |
| int | setErrorValue (double errValue) |
| Specifies an error value to fill in associated data buffers in case of link error. | |
| int | setErrorValue (String errString) |
| Specifies an error string to fill in associated data buffers in case of link error. | |
| TLink (String deviceName, String deviceProperty, TDataType dout, TDataType din, short devaccess) | |
| Defines a tine Data link. | |
| TLink (String devname, String devproperty, TDataType dout, TDataType din, int devaccess) | |
| Defines a tine Data link. | |
| TLink (String fullDeviceNameAndProperty, TDataType dout, TDataType din, short devaccess) | |
| Defines a tine Data link. | |
| TLink (String deviceName, String deviceProperty) | |
| Defines a read-only tine Data link with default behavior. | |
| TLink (String fullDeviceNameAndProperty) | |
| Defines a read-only tine Data link with default behavior. | |
| TLink (String globalKeyword, TDataType dout) | |
| Defines a tine GLobal Data link. | |
| int | attach (int mode, TCallback f) |
| Attaches the data sets to the created link at the default polling rate (1000 msec) | |
| synchronized int | Twait () |
| Stop thread execution until this link has been signalled. | |
| int | execute () |
| Executes a synchronous link using the data sets supplied at link creation. | |
| int | executeAndClose () |
| Executes a synchronous link using the data sets supplied at link creation and Closes the link upon completion. | |
| int | execute (int timeout, short appendMode) |
| Executes a synchronous link using the data sets supplied at link creation. | |
| int | execute (int timeout, boolean retryOnError) |
| Executes a synchronous link using the data sets supplied at link creation. | |
| int | executeAndClose (int timeout, short appendMode) |
| Executes a synchronous link using the data sets supplied at link creation and Closes the link upon completion. | |
| synchronized int | execute (int timeout, short appendMode, boolean retryOnError) |
| Executes a synchronous link using the data sets supplied at link creation. | |
| int | execute (int timeout) |
| Executes a synchronous link using the data sets supplied at link creation. | |
| int | executeAndClose (int timeout) |
| Executes a synchronous link using the data sets supplied at link creation and Closes the link upon completion. | |
| int | cancel () |
| Terminates an active link. | |
| int | close () |
| Terminates an active link. | |
| int | attach (int mode, TCallback f, int pollrate) |
| Attaches the data sets to the created link at the given polling rate. | |
| synchronized int | attach (int mode, TCallback f, int pollInterval, int notificationId) |
| Attaches the data sets to the created link at the given polling rate and signals the callback routine using the give notification parameter. | |
| int | attach (int mode, TLinkCallback f, int pollrate) |
| Attaches the data sets to the created link at the given polling rate and signals the callback routine using a reference to the TLink instance. | |
| synchronized int | attach (int mode, TLinkCallback f, int pollingInterval, Object reference) |
| Attaches the data sets to the created link at the given polling rate and signals the callback routine using a reference to the TLink instance. | |
| synchronized int | receive (TCallback f) |
| Attaches the data sets to the global link and signals the callback routine using the assigned link id. | |
| synchronized int | receive (TCallback f, int notificationId) |
| Attaches the data sets to the global link and signals the callback routine using a reference to the given notifcation ID in the callback. | |
| synchronized int | receive (TLinkCallback f) |
| Attaches the data sets to the global link and signals the callback routine using a reference to the referenced TLink object. | |
| void | waitForLinkCompletion () |
| Stops thread execution until this link has completed. | |
| String | getArrayDelimiter () |
| Gets the array delimiter for use in the toString() method of associated TDataType objects. | |
| void | setArrayDelimiter (String delimiter) |
| Sets the array delimiter for use in the toString() method of associated TDataType objects. | |
TLink.java.
User interface calls to access tine data links.
The methods presented here deal with linking local application data with remote data sources. Primarily you will need to create a TLink object, passing the necessary identifying parameters of the remote server to which the link is to be established. When the TLink object is instantiated, you will then need to retrieve the data using one of the retrieval methods, e.g. execute() for synchronous acquisition, or attach() for asynchronous acquisition, or receive() for the acquisition of network globals.
| de.desy.tine.client.TLink.TLink | ( | String | deviceName, |
| String | deviceProperty, | ||
| TDataType | dout, | ||
| TDataType | din, | ||
| short | devaccess | ||
| ) |
Defines a tine Data link.
This defines a tine Data Link, verifies that the requested deviceName exists and returns a non-null link object if successful. This does not establish the link! You must use either the execute method or the attach method to establish the link.
| devname | is the fully specified device name as in /<context>/<server>/<device> or <server>/<device> |
| devproperty | is the desired property |
| dout | is a reference to the output data object (which will receive the data from the server) |
| din | is a reference to the input data object (which will send data to the server) |
| devaccess | is the requested control access mode (TMode.CA_READ, TMode.CA_WRITE etc.) |
| UnresolvedAddressException | if fullDeviceNameAndProperty does not point to a valid address (i.e. if the address pointed to is unable to be resolved by the system) |
| InvalidDataReferenceException | if the output data object used (dout above) is already used as the output data object in another TLink. For instance, TLink("/TEST/Server1/Device1","Property1",dout,null,TAccess.CA_READ) already exists. An attempt to create TLink("/TEST/Server1/Device1","Property2",dout,null,TAccess.CA_READ) will throw this exception as 'dout' is the same object already in use in the |
Example:
...
int cc = 0;
int[] echobuf = new int[512];
int[] echoin = new int[512];
for (int i=0; i<512; i++) echoin[i] = i;
TDataType dout = new TDataType(echobuf);
TDataType din = new TDataType(echoin);
TLink ech = new TLink("/TEST/ECHOSERVER/DEVICE_0","ECHO",dout,din,TAccess.CA_READ);
if ((cc=ech.execute()) != 0) // synchronous access ...
{
String msg = "err: " + cc;
System.out.println(msg);
}
ech.cancel(); // remove the TLink completely
for (int i=0; i<512; i += 8)
{
System.out.println(echobuf[i] + " " + echobuf[i+1] + " " + echobuf[i+2] + " " + echobuf[i+3] + " " +
echobuf[i+4] + " " + echobuf[i+5] + " " + echobuf[i+6] + " " + echobuf[i+7] + " ");
}
...
| de.desy.tine.client.TLink.TLink | ( | String | devname, |
| String | devproperty, | ||
| TDataType | dout, | ||
| TDataType | din, | ||
| int | devaccess | ||
| ) |
Defines a tine Data link.
This defines a tine Data Link, verifies that the requested deviceName exists and returns a non-null link object if successful. This does not establish the link! You must use either the execute method or the attach method to establish the link.
| devname | is the fully specified device name as in /<context>/<server>/<device> or <server>/<device> |
| devproperty | is the desired property |
| dout | is a reference to the output data object (which will receive the data from the server) |
| din | is a reference to the input data object (which will send data to the server) |
| devaccess | is the requested control access mode (TMode.CA_READ, TMode.CA_WRITE etc.) |
| UnresolvedAddressException | if fullDeviceNameAndProperty does not point to a valid address (i.e. if the address pointed to is unable to be resolved by the system) |
| InvalidDataReferenceException | if the output data object used (dout above) is already used as the output data object in another TLink. For instance, TLink("/TEST/Server1/Device1","Property1",dout,null,TAccess.CA_READ) already exists. An attempt to create TLink("/TEST/Server1/Device1","Property2",dout,null,TAccess.CA_READ) will throw this exception as 'dout' is the same object already in use in the |
Example:
...
int cc = 0;
int[] echobuf = new int[512];
int[] echoin = new int[512];
for (int i=0; i<512; i++) echoin[i] = i;
TDataType dout = new TDataType(echobuf);
TDataType din = new TDataType(echoin);
TLink ech = new TLink("/TEST/ECHOSERVER/DEVICE_0","ECHO",dout,din,TAccess.CA_READ);
if ((cc=ech.execute()) != 0) // synchronous access ...
{
String msg = "err: " + cc;
System.out.println(msg);
}
ech.cancel(); // remove the TLink completely
for (int i=0; i<512; i += 8)
{
System.out.println(echobuf[i] + " " + echobuf[i+1] + " " + echobuf[i+2] + " " + echobuf[i+3] + " " +
echobuf[i+4] + " " + echobuf[i+5] + " " + echobuf[i+6] + " " + echobuf[i+7] + " ");
}
...
| de.desy.tine.client.TLink.TLink | ( | String | fullDeviceNameAndProperty, |
| TDataType | dout, | ||
| TDataType | din, | ||
| short | devaccess | ||
| ) |
Defines a tine Data link.
This defines a tine Data Link, verifies that the requested deviceName exists and returns a non-null link object if successful. This does not establish the link! You must use either the execute method or the attach method to establish the link.
| fullDeviceNameAndProperty | is the fully specified, property-appended device name as in /<context>/<server>/<device>/<property> or <server>/<device>/<property> |
| dout | is a reference to the output data object (which will receive the data from the server) |
| din | is a reference to the input data object (which will send data to the server) |
| devaccess | is the requested control access mode (TMode.CA_READ, TMode.CA_WRITE etc.) |
| UnresolvedAddressException | if fullDeviceNameAndProperty does not point to a valid address (i.e. if the address pointed to is unable to be resolved by the system) |
| InvalidDataReferenceException | if the output data object used (dout above) is already used as the output data object in another TLink. For instance, TLink("/TEST/Server1/Device1","Property1",dout,null,TAccess.CA_READ) already exists. An attempt to create TLink("/TEST/Server1/Device1","Property2",dout,null,TAccess.CA_READ) will throw this exception as 'dout' is the same object already in use in the initial link. |
Example:
...
int cc = 0;
float[] xorbit = new float[141];
TDataType dout = new TDataType(xorbit);
TLink xorb = new TLink("/HERA/HEPBPM/WL197 MX/ORBIT.X",dout,null,TAccess.CA_READ);
if ((id=xorb.attach(TMode.CM_POLL,xorbCb,1000)) < 0) // asynchronous access ...
{
String msg = "err: " + xorb.linkStatus;
System.out.println(msg);
xorb.cancel(); // remove the TLink completely
System.exit(1);
}
// link data is handled in callback routine xorbCb ...
...
| de.desy.tine.client.TLink.TLink | ( | String | deviceName, |
| String | deviceProperty | ||
| ) |
Defines a read-only tine Data link with default behavior.
This defines a tine Data Link, verifies that the requested deviceName exists and returns a non-null link object if successful. This does not establish the link! You must use either the execute method or the attach method to establish the link.
| devname | is the fully specified device name as in /<context>/<server>/<device> or <server>/<device> |
| devproperty | is the desired property |
| UnresolvedAddressException | if fullDeviceNameAndProperty does not point to a valid address (i.e. if the address pointed to is unable to be resolved by the system) |
| InvalidDataReferenceException | if the output data object used (dout above) is already used as the output data object in another TLink. For instance, TLink("/TEST/Server1/Device1","Property1",dout,null,TAccess.CA_READ) already exists. An attempt to create TLink("/TEST/Server1/Device1","Property2",dout,null,TAccess.CA_READ) will throw this exception as 'dout' is the same object already in use in the |
Example:
...
TLink idc = new TLink("/HERA/HEEIDC/GEAR0","Current");
int cc = idc.execute(1000);
int dsize = idc.dOutput.getLastDataSize();
int dfmt = idc.dOutput.getFormat();
System.out.println("completion " + cc + " size " + dsize + " format " + dfmt);
idc.setArrayDelimiter(", ");
System.out.println(idc.dOutput.toString());
...
| de.desy.tine.client.TLink.TLink | ( | String | fullDeviceNameAndProperty | ) |
Defines a read-only tine Data link with default behavior.
This defines a tine Data Link, verifies that the requested deviceName exists and returns a non-null link object if successful. This does not establish the link! You must use either the execute method or the attach method to establish the link.
| fullDeviceNameAndProperty | is the fully specified, property-appended device name as in /<context>/<server>/<device>/<property> or <server>/<device>/<property> |
| UnresolvedAddressException | if fullDeviceNameAndProperty does not point to a valid address (i.e. if the address pointed to is unable to be resolved by the system) |
| InvalidDataReferenceException | if the output data object used (dout above) is already used as the output data object in another TLink. For instance, TLink("/TEST/Server1/Device1","Property1",dout,null,TAccess.CA_READ) already exists. An attempt to create TLink("/TEST/Server1/Device1","Property2",dout,null,TAccess.CA_READ) will throw this exception as 'dout' is the same object already in use in the |
Example:
...
TLink idc = new TLink("/HERA/HEEIDC/GEAR0/Current");
int cc = idc.execute(1000);
int dsize = idc.dOutput.getLastDataSize();
int dfmt = idc.dOutput.getFormat();
System.out.println("completion " + cc + " size " + dsize + " format " + dfmt);
idc.setArrayDelimiter(", ");
System.out.println(idc.dOutput.toString());
...
| de.desy.tine.client.TLink.TLink | ( | String | globalKeyword, |
| TDataType | dout | ||
| ) |
Defines a tine GLobal Data link.
This defines a tine Data Link and assumes that the requested parameter is a network global, available on the tine multicast group. This method does not establish the link! You must use either the execute method or the attach method to establish the link.
| globalKeyword | is the desired network global parameter |
| dout | is a reference to the output data object (which will receive the network global data). |
Example:
| int de.desy.tine.client.TLink.attach | ( | int | mode, |
| TCallback | f | ||
| ) |
Attaches the data sets to the created link at the default polling rate (1000 msec)
Asynchronous. This method attaches the data sets to the created link using the calling parameters provided at instantiation. The arriving data will automatically update the output data set and then fire the callback method provided. If the callback is not needed, a null can be passed for this parameter.
| mode | is the tine control mode parameter, that is one of TMode.CM_POLL, TMode.CM_REFRESH, TMode.SINGLE, etc. in possible combination with TMode.CM_NETWORK or TMode.CM_CONNECT, etc. |
| f | is the 'callback function' to be called whenever either new data arrive or a change in link status occurs. The callback function should instantiate a class you create which implements the TCallback() class interface. |
Example:
public class OrbitCallback implements TCallback { public void callback(int id, int cc) { if (cc != 0) { System.out.println("Orbit Link Error : " + TErrorList.getErrorString(cc)); return; } orbitChart.update(); } } public int MonitorOrbit() { int cc = 0; float[] xorbit = new float[141]; TDataType dout = new TDataType(xorbit); OrbitCallback xorbCb = new OrbitCallback(); // create a callback instance ... TLink xorb = new TLink("/HERA/HEPBPM/WL197 MX/ORBIT.X",dout,null,TAccess.CA_READ); if ((id=xorb.attach(TMode.CM_POLL,xorbCb)) < 0) // asynchronous access ... { String msg = "err: " + xorb.linkStatus; System.out.println(msg); xorb.cancel(); // remove the TLink completely System.exit(1); } // link data is handled in callback routine xorbCb ... ... }
| int de.desy.tine.client.TLink.attach | ( | int | mode, |
| TCallback | f, | ||
| int | pollrate | ||
| ) |
Attaches the data sets to the created link at the given polling rate.
Asynchronous. This method attaches the data sets to the created link using the calling parameters provided at instantiation. The arriving data will automatically update the output data set and then fire the callback method provided. If the callback is not needed, a null can be passed for this parameter.
| mode | is the tine control mode parameter, that is one of TMode.CM_POLL, TMode.CM_REFRESH, TMode.SINGLE, etc. in possible combination with TMode.CM_NETWORK or TMode.CM_CONNECT, etc. |
| f | is the 'callback function' to be called whenever either new data arrive or a change in link status occurs. The callback function should instantiate a class you create which implements the TCallback() class interface. |
| pollrate | is the desired polling rate (at the server) in milliseconds. |
Example:
public class OrbitCallback implements TCallback { public void callback(int id, int cc) { if (cc != 0) { System.out.println("Orbit Link Error : " + TErrorList.getErrorString(cc)); return; } orbitChart.update(); } } public int MonitorOrbit() { int cc = 0; float[] xorbit = new float[141]; TDataType dout = new TDataType(xorbit); OrbitCallback xorbCb = new OrbitCallback(); // create a callback instance ... TLink xorb = new TLink("/HERA/HEPBPM/WL197 MX/ORBIT.X",dout,null,TAccess.CA_READ); if ((id=xorb.attach(TMode.CM_POLL,xorbCb,1000)) < 0) // asynchronous access ... { String msg = "err: " + xorb.linkStatus; System.out.println(msg); xorb.cancel(); // remove the TLink completely System.exit(1); } // link data is handled in callback routine xorbCb ... ... }
| synchronized int de.desy.tine.client.TLink.attach | ( | int | mode, |
| TCallback | f, | ||
| int | pollInterval, | ||
| int | notificationId | ||
| ) |
Attaches the data sets to the created link at the given polling rate and signals the callback routine using the give notification parameter.
Asynchronous. This method attaches the data sets to the created link using the calling parameters provided at instantiation. The arriving data will automatically update the output data set and then fire the callback method provided. If the callback is not needed, a null can be passed for this parameter.
| mode | is the tine control mode parameter, that is one of TMode.CM_POLL, TMode.CM_REFRESH, TMode.SINGLE, etc. in possible combination with TMode.CM_NETWORK or TMode.CM_CONNECT, etc. |
| f | is the 'callback function' to be called whenever either new data arrive or a change in link status occurs. The callback function should instantiate a class you create which implements the TCallback() class interface. |
| pollInterval | is the desired polling interval (at the server) in milliseconds. |
| notificationId | is the desired identifier to be passed to the supplied callback routine when it is fired. |
Example:
private int xid = 0; private int yid = 1; public class OrbitCallback implements TCallback { public void callback(int id, int cc) { if (cc != 0) { System.out.println("Orbit Link Error : " + TErrorList.getErrorString(cc)); return; } orbitChart[id].update(); } } public int MonitorOrbit() { OrbitCallback orbCb = new OrbitCallback(); // create a callback instance ... int cc = 0; float[] xorbit = new float[141]; TDataType dout = new TDataType(xorbit); TLink xorb = new TLink("/HERA/HEPBPM/WL197 MX/ORBIT.X",dout,null,TAccess.CA_READ); if (xorb.attach(TMode.CM_POLL,orbCb,500,xid) < 0) // asynchronous access ... { String msg = "err: " + xorb.linkStatus; System.out.println(msg); xorb.cancel(); // remove the TLink completely System.exit(1); } float[] yorbit = new float[141]; dout = new TDataType(yorbit); TLink yorb = new TLink("/HERA/HEPBPM/WL164 MY/ORBIT.Y",dout,null,TAccess.CA_READ); if (yorb.attach(TMode.CM_POLL,orbCb,500,yid) < 0) // asynchronous access ... { String msg = "err: " + yorb.linkStatus; System.out.println(msg); yorb.cancel(); // remove the TLink completely System.exit(1); } // link data is handled in callback routine xorbCb ... ... }
| int de.desy.tine.client.TLink.attach | ( | int | mode, |
| TLinkCallback | f, | ||
| int | pollrate | ||
| ) |
Attaches the data sets to the created link at the given polling rate and signals the callback routine using a reference to the TLink instance.
Asynchronous. This method attaches the data sets to the created link using the calling parameters provided at instantiation. The arriving data will automatically update the output data set and then fire the callback method provided. If the callback is not needed, a null can be passed for this parameter. This is the preferred AttachLink method to use. The Callback instantiates a TLinkCallback() interface which provides a TLink object as parameter.
| mode | is the tine control mode parameter, that is one of TMode.CM_POLL, TMode.CM_REFRESH, TMode.SINGLE, etc. in possible combination with TMode.CM_NETWORK or TMode.CM_CONNECT, etc. |
| f | is the 'callback function' to be called whenever either new data arrive or a change in link status occurs. The callback function should instantiate a class you create which implements the TLinkCallback() class interface. |
| pollrate | is the desired polling rate (at the server) in milliseconds. |
Example:
private int xid = 0; private int yid = 1; public class OrbitCallback implements TLinkCallback { public void callback(TLink lnk) { if (lnk.getLinkStatus() != 0) { System.out.println("Link Error : " + lnk.getProperty() + " -> " + lnk.getLastError()); return; } orbitChart.update(lnk.getProperty()); } } public int MonitorOrbit() { OrbitCallback orbCb = new OrbitCallback(); // create a callback instance ... int cc = 0; float[] xorbit = new float[141]; TDataType dout = new TDataType(xorbit); TLink xorb = new TLink("/HERA/HEPBPM/WL197 MX/ORBIT.X",dout,null,TAccess.CA_READ); if (xorb.attach(TMode.CM_POLL,orbCb,500) < 0) // asynchronous access ... { String msg = "err: " + xorb.linkStatus; System.out.println(msg); xorb.cancel(); // remove the TLink completely System.exit(1); } float[] yorbit = new float[141]; dout = new TDataType(yorbit); TLink yorb = new TLink("/HERA/HEPBPM/WL164 MY/ORBIT.Y",dout,null,TAccess.CA_READ); if (yorb.attach(TMode.CM_POLL,orbCb,500) < 0) // asynchronous access ... { String msg = "err: " + yorb.linkStatus; System.out.println(msg); yorb.cancel(); // remove the TLink completely System.exit(1); } // link data is handled in callback routine xorbCb ... ... }
| synchronized int de.desy.tine.client.TLink.attach | ( | int | mode, |
| TLinkCallback | f, | ||
| int | pollingInterval, | ||
| Object | reference | ||
| ) |
Attaches the data sets to the created link at the given polling rate and signals the callback routine using a reference to the TLink instance.
Asynchronous. This method attaches the data sets to the created link using the calling parameters provided at instantiation. The arriving data will automatically update the output data set and then fire the callback method provided. If the callback is not needed, a null can be passed for this parameter. This is the preferred AttachLink method to use. The Callback instantiates a TLinkCallback() interface which provides a TLink object as parameter.
| mode | is the tine control mode parameter, that is one of TMode.CM_POLL, TMode.CM_REFRESH, TMode.SINGLE, etc. in possible combination with TMode.CM_NETWORK or TMode.CM_CONNECT, etc. |
| f | is the 'callback function' to be called whenever either new data arrive or a change in link status occurs. The callback function should instantiate a class you create which implements the TLinkCallback() class interface. |
| pollingInterval | is the desired polling rate (at the server) in milliseconds. |
| reference | is an optional reference to any object of the caller's choosing. As the callback returns a reference to the original link, this extra reference can be used to quickly find a table entry position for example. |
| int de.desy.tine.client.TLink.close | ( | ) |
Terminates an active link.
Synonymous with cancel().
| int de.desy.tine.client.TLink.execute | ( | ) |
Executes a synchronous link using the data sets supplied at link creation.
Synchronous. This method executes the link using the data sets and parameters provided at instantiation. The call will block for 1000 msec or until the call completes.
| BoundToInactiveLinkException | (unchecked) if the link calling the method is bound to another TLink (the parent link) and the parent link is currently inactive (while has has not yet been accessed). For instance |
TLink lnk1 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
TLink lnk2 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
lnk2.execute();
will generate this exception as lnk2 is identical to lnk1, which was created first (and is therefore the parent link) but has not yet been activated via a call to attach() or execute().
Example:
...
TLink idc = new TLink("/HERA/HEEIDC/GEAR0","Current");
int cc = idc.execute();
int dsize = idc.dOutput.getLastDataSize();
int dfmt = idc.dOutput.getFormat();
System.out.println("completion " + cc + " size " + dsize + " format " + dfmt);
idc.setArrayDelimiter(", ");
System.out.println(idc.dOutput.toString());
...
| int de.desy.tine.client.TLink.execute | ( | int | timeout, |
| short | appendMode | ||
| ) |
Executes a synchronous link using the data sets supplied at link creation.
Synchronous. This method executes the link using the data sets and parameters provided at instantiation. The call will block for the duration of the timeout specified or until the call completes.
| timeout | The amount of time in milliseconds to block execution until the call completes. |
| appendMode | will be appended to the tine Control Mode, which is TMode.CM_SINGLE. (e.g. TMode.CM_CONNECT). |
| BoundToInactiveLinkException | (unchecked) if the link calling the method is bound to another TLink (the parent link) and the parent link is currently inactive (while has has not yet been accessed). For instance |
TLink lnk1 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
TLink lnk2 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
lnk2.execute();
will generate this exception as lnk2 is identical to lnk1, which was created first (and is therefore the parent link) but has not yet been activated via a call to attach() or execute().
Example:
...
TLink idc = new TLink("/HERA/HEEIDC/GEAR0","Current");
int cc = idc.execute(500,TMode.CM_CONNECT);
int dsize = idc.dOutput.getLastDataSize();
int dfmt = idc.dOutput.getFormat();
System.out.println("completion " + cc + " size " + dsize + " format " + dfmt);
idc.setArrayDelimiter(", ");
System.out.println(idc.dOutput.toString());
...
| int de.desy.tine.client.TLink.execute | ( | int | timeout, |
| boolean | retryOnError | ||
| ) |
Executes a synchronous link using the data sets supplied at link creation.
Synchronous. This method executes the link using the data sets and parameters provided at instantiation. The call will block for the duration of the timeout specified or until the call completes.
| timeout | The amount of time in milliseconds to block execution until the call completes. |
| retryOnError | if 'true' will instruct the tine engine to issue an automatic retry following a connection timeout. |
| BoundToInactiveLinkException | (unchecked) if the link calling the method is bound to another TLink (the parent link) and the parent link is currently inactive (while has has not yet been accessed). For instance TLink lnk1 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ); TLink lnk2 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ); lnk2.execute(); will generate this exception as lnk2 is identical to lnk1, which was created first (and is therefore the parent link) but has not yet been activated via a call to attach() or execute(). |
Example:
...
TLink idc = new TLink("/HERA/HEEIDC/GEAR0","Current");
int cc = idc.execute(500,true);
int dsize = idc.dOutput.getLastDataSize();
int dfmt = idc.dOutput.getFormat();
System.out.println("completion " + cc + " size " + dsize + " format " + dfmt);
idc.setArrayDelimiter(", ");
System.out.println(idc.dOutput.toString());
...
| synchronized int de.desy.tine.client.TLink.execute | ( | int | timeout, |
| short | appendMode, | ||
| boolean | retryOnError | ||
| ) |
Executes a synchronous link using the data sets supplied at link creation.
Synchronous. This method executes the link using the data sets and parameters provided at instantiation. The call will block for the duration of the timeout specified or until the call completes.
| timeout | The amount of time in milliseconds to block execution until the call completes. |
| appendMode | will be appended to the tine Control Mode, which is TMode.CM_SINGLE. (e.g. TMode.CM_CONNECT). |
| retryOnError | if 'true' will instruct the tine engine to issue an automatic retry following a connection timeout. |
| BoundToInactiveLinkException | (unchecked) if the link calling the method is bound to another TLink (the parent link) and the parent link is currently inactive (while has has not yet been accessed). For instance |
TLink lnk1 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
TLink lnk2 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
lnk2.execute();
will generate this exception as lnk2 is identical to lnk1, which was created first (and is therefore the parent link) but has not yet been activated via a call to attach() or execute().
Example:
...
TLink idc = new TLink("/HERA/HEEIDC/GEAR0","Current");
int cc = idc.execute(500,TMode.CM_CONNECT,true);
int dsize = idc.dOutput.getLastDataSize();
int dfmt = idc.dOutput.getFormat();
System.out.println("completion " + cc + " size " + dsize + " format " + dfmt);
idc.setArrayDelimiter(", ");
System.out.println(idc.dOutput.toString());
...
| int de.desy.tine.client.TLink.execute | ( | int | timeout | ) |
Executes a synchronous link using the data sets supplied at link creation.
Synchronous. This method executes the link using the data sets and parameters provided at instantiation. The call will block for the duration of the timeout specified or until the call completes.
| timeout | The amount of time in milliseconds to block execution until the call completes. |
| BoundToInactiveLinkException | (unchecked) if the link calling the method is bound to another TLink (the parent link) and the parent link is currently inactive (while has has not yet been accessed). For instance |
TLink lnk1 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
TLink lnk2 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
lnk2.execute();
will generate this exception as lnk2 is identical to lnk1, which was created first (and is therefore the parent link) but has not yet been activated via a call to attach() or execute().
Example:
...
TLink idc = new TLink("/HERA/HEEIDC/GEAR0","Current");
int cc = idc.execute(500);
int dsize = idc.dOutput.getLastDataSize();
int dfmt = idc.dOutput.getFormat();
System.out.println("completion " + cc + " size " + dsize + " format " + dfmt);
idc.setArrayDelimiter(", ");
System.out.println(idc.dOutput.toString());
...
| int de.desy.tine.client.TLink.executeAndClose | ( | ) |
Executes a synchronous link using the data sets supplied at link creation and Closes the link upon completion.
Synchronous. This method executes the link using the data sets and parameters provided at instantiation. The call will block for the duration of the timeout specified or until the call completes. When the link has completed (successfully or not) the TLink will be automatically closed and hence removed from the link tables, obviating the need for an additional call to closeLink().
| BoundToInactiveLinkException | (unchecked) if the link calling the method is bound to another TLink (the parent link) and the parent link is currently inactive (while has has not yet been accessed). For instance |
TLink lnk1 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
TLink lnk2 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
lnk2.execute();
will generate this exception as lnk2 is identical to lnk1, which was created first (and is therefore the parent link) but has not yet been activated via a call to attach() or execute().
| int de.desy.tine.client.TLink.executeAndClose | ( | int | timeout, |
| short | appendMode | ||
| ) |
Executes a synchronous link using the data sets supplied at link creation and Closes the link upon completion.
Synchronous. This method executes the link using the data sets and parameters provided at instantiation. The call will block for the duration of the timeout specified or until the call completes. When the link has completed (successfully or not) the TLink will be automatically closed and hence removed from the link tables, obviating the need for an additional call to closeLink().
| timeout | The amount of time in milliseconds to block execution until the call completes. |
| appendMode | will be appended to the tine Control Mode, which is TMode.CM_SINGLE. (e.g. TMode.CM_CONNECT). |
| BoundToInactiveLinkException | (unchecked) if the link calling the method is bound to another TLink (the parent link) and the parent link is currently inactive (while has has not yet been accessed). For instance |
TLink lnk1 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
TLink lnk2 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
lnk2.execute();
will generate this exception as lnk2 is identical to lnk1, which was created first (and is therefore the parent link) but has not yet been activated via a call to attach() or execute().
| BoundToInactiveLinkException | (unchecked) if the link calling the method is bound to another TLink (the parent link) and the parent link is currently inactive (while has has not yet been accessed). For instance |
TLink lnk1 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
TLink lnk2 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
lnk2.execute();
will generate this exception as lnk2 is identical to lnk1, which was created first (and is therefore the parent link) but has not yet been activated via a call to attach() or execute().
| int de.desy.tine.client.TLink.executeAndClose | ( | int | timeout | ) |
Executes a synchronous link using the data sets supplied at link creation and Closes the link upon completion.
Synchronous. This method executes the link using the data sets and parameters provided at instantiation. The call will block for the duration of the timeout specified or until the call completes. When the link has completed (successfully or not) the TLink will be automatically closed and hence removed from the link tables, obviating the need for an additional call to closeLink().
| timeout | The amount of time in milliseconds to block execution until the call completes. |
| BoundToInactiveLinkException | (unchecked) if the link calling the method is bound to another TLink (the parent link) and the parent link is currently inactive (while has has not yet been accessed). For instance |
TLink lnk1 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
TLink lnk2 = new TLink("/TEST/Svr1/Dev1","Prp1",dout,din,TAccess.CA_READ);
lnk2.execute();
will generate this exception as lnk2 is identical to lnk1, which was created first (and is therefore the parent link) but has not yet been activated via a call to attach() or execute().
| String de.desy.tine.client.TLink.getArrayDelimiter | ( | ) |
Gets the array delimiter for use in the toString() method of associated TDataType objects.
| String de.desy.tine.client.TLink.getContext | ( | ) |
Returns the context of this link.
| String de.desy.tine.client.TLink.getDeviceName | ( | ) |
Returns the device (module) name addressed in this link.
| String de.desy.tine.client.TLink.getDeviceServer | ( | ) |
Returns the device server addressed in this link.
| String de.desy.tine.client.TLink.getError | ( | int | code | ) |
The specified error code in plain text.
| code | Is the tine error code for which the error text is desired |
| String de.desy.tine.client.TLink.getFullDeviceName | ( | ) |
Returns the fully qualified device name addressed in this link.
| String de.desy.tine.client.TLink.getFullDeviceNameAndProperty | ( | ) |
Returns the fully qualified device name and property addressed in this link.
| TDataType de.desy.tine.client.TLink.getInputDataObject | ( | ) |
Returns the output data input as a TDataType.
| double de.desy.tine.client.TLink.getLastDataTimeStamp | ( | ) |
The last link timestamp as a TINE double timestamp value.
| String de.desy.tine.client.TLink.getLastError | ( | ) |
The last link status in plain text.
| long de.desy.tine.client.TLink.getLastTimeStamp | ( | ) |
The last link timestamp.
| int de.desy.tine.client.TLink.getLinkStatus | ( | ) |
Returns the current status for this link.
| TDataType de.desy.tine.client.TLink.getOutputDataObject | ( | ) |
Returns the output data object as a TDataType.
| String de.desy.tine.client.TLink.getProperty | ( | ) |
Returns the device property addressed in this link.
| synchronized int de.desy.tine.client.TLink.receive | ( | TLinkCallback | f | ) |
Attaches the data sets to the global link and signals the callback routine using a reference to the referenced TLink object.
Asynchronous. This method attaches the data sets to the created link using the calling parameters provided at instantiation. The arriving data will automatically update the output data set and then fire the callback method provided. If the callback is not needed, a null can be passed for this parameter. Using the receive() method assumes that the data requested are global available. This is the preferred receive method to use. The Callback instantiates a TLinkCallback() interface which provides a TLink object as parameter.
| f | is the 'callback function' to be called whenever either new data arrive or a change in link status occurs. The callback function should instantiate a class you create which implements the TLinkCallback() class interface. |
Example:
private int eid = 0; private int cid = 1; public float[] energy = new float[1]; public float[] current = new float[1]; public class glbCallback implements TLinkCallback { public void callback(TLink lnk) { if (lnk.getLinkStatus() != 0) { System.out.println("Link Error : " + lnk.getProperty() + " -> " + lnk.getLastError()); return; } if (lnk.getProperty().compareTo("HEMAGEN") == 0) System.out.println("energy : " + energy[0]); if (lnk.getProperty().compareTo("HEDCCur") == 0) System.out.println("current : " + current[0]); } } public int MonitorGlobals() { glbCallback glbCb = new glbCallback(); // create a callback instance ... int cc = 0; TDataType dout = new TDataType(energy); TLink ene = new TLink("HEMAGEN",dout); if (ene.receive(glbCb) < 0) // asynchronous global access ... { String msg = "err: " + ene.getLinkStatus; System.out.println(msg); ene.cancel(); // remove the TLink completely System.exit(1); } ene.waitForLinkCompletion(); // make sure the first energy value is available // before continuing dout = new TDataType(current); TLink cur = new TLink("HEDCCur",dout); if (cur.receive(glbCb) < 0) // asynchronous access ... { String msg = "err: " + cur.getLinkStatus; System.out.println(msg); cur.cancel(); // remove the TLink completely System.exit(1); } // link data is handled in callback routine glbbCb ... ... }
| synchronized int de.desy.tine.client.TLink.receive | ( | TCallback | f, |
| int | notificationId | ||
| ) |
Attaches the data sets to the global link and signals the callback routine using a reference to the given notifcation ID in the callback.
Asynchronous. This method attaches the data sets to the created link using the calling parameters provided at instantiation. The arriving data will automatically update the output data set and then fire the callback method provided. If the callback is not needed, a null can be passed for this parameter. Using the receive() method assumes that the data requested are global available.
| f | is the 'callback function' to be called whenever either new data arrive or a change in link status occurs. The callback function should instantiate a class you create which implements the TCallback() class interface. |
| notificationId | is the desired identifier to be passed to the supplied callback routine when it is fired. |
Example:
private int eid = 0; private int cid = 1; public float[] energy = new float[1]; public float[] current = new float[1]; public class glbCallback implements TCallback { public void callback(int id, int cc) { if (cc != 0) { System.out.println("globals Link Error : " + TErrorList.getErrorString(cc)); return; } glb[id].update(); // for example ... } } public int MonitorGlobals() { glbCallback glbCb = new glbCallback(); // create a callback instance ... int cc = 0; TDataType dout = new TDataType(energy); TLink ene = new TLink("HEMAGEN",dout); if (ene.receive(glbCb,eid) < 0) // asynchronous global access ... { String msg = "err: " + ene.getLinkStatus; System.out.println(msg); ene.cancel(); // remove the TLink completely System.exit(1); } dout = new TDataType(current); TLink cur = new TLink("HEDCCur",dout); if (cur.receive(glbCb,500,cid) < 0) // asynchronous global access ... { String msg = "err: " + cur.getLinkStatus; System.out.println(msg); cur.cancel(); // remove the TLink completely System.exit(1); } // link data is handled in callback routine glbbCb ... ... }
| synchronized int de.desy.tine.client.TLink.receive | ( | TCallback | f | ) |
Attaches the data sets to the global link and signals the callback routine using the assigned link id.
Asynchronous. This method attaches the data sets to the created link using the calling parameters provided at instantiation. The arriving data will automatically update the output data set and then fire the callback method provided. If the callback is not needed, a null can be passed for this parameter. Using the receive() method assumes that the data requested are global available.
| f | is the 'callback function' to be called whenever either new data arrive or a change in link status occurs. The callback function should instantiate a class you create which implements the TCallback() class interface. |
Example:
public class glbCallback implements TCallback { public void callback(int id, int cc) { if (cc != 0) { System.out.println("Global Link Error : " + TErrorList.getErrorString(cc)); return; } eneDisplay.update(); // <- for example ... } } public int MonitorEnergy() { int cc = 0; float[] energy_e = new float[1]; TDataType dout = new TDataType(energy_e); glbCallback eneCb = new glbCallback(); // create a callback instance ... TLink ene = new TLink("HEMAGEN",dout); if ((id=ene.receive(eneCb)) < 0) // asynchronous access of global variable ... { String msg = "err: " + xorb.getLinkStatus; System.out.println(msg); ene.cancel(); // remove the TLink completely System.exit(1); } // link data is handled in callback routine eneCb ... ... }
| void de.desy.tine.client.TLink.setArrayDelimiter | ( | String | delimiter | ) |
Sets the array delimiter for use in the toString() method of associated TDataType objects.
| delimiter | is the string delimiter to use in separating data variables in a string dump (default ",") |
| int de.desy.tine.client.TLink.setErrorValue | ( | String | errString | ) |
Specifies an error string to fill in associated data buffers in case of link error.
| errString | Is the string to use in case of link errors |
0 if successful
| int de.desy.tine.client.TLink.setErrorValue | ( | double | errValue | ) |
Specifies an error value to fill in associated data buffers in case of link error.
| errValue | Is the error value to use in case of link errors |
0 if successful
| void de.desy.tine.client.TLink.setNotificationTolerance | ( | float | absoluteValue, |
| float | percentValue | ||
| ) |
Sets the tolerance level for asynchronous event notification.
Link callback notification can be suppressed if changes in the link data do not exceed the tolerance applied in this call. The tolerance can have an absolute part (in the units of the data) and/or a percent part.
| absoluteValue | is the absolute tolerance any particular data element is allowed to have before an event notification is called. |
| percentValue | is the percent tolerance any particular data element is allowed to have before an event notification is called. |
| void de.desy.tine.client.TLink.waitForLinkCompletion | ( | ) |
Stops thread execution until this link has completed.
Useful for grouped asynchronous links.
1.7.4