Interface to a TLink callback class for use in asynchronous links. More...
Public Member Functions | |
| void | callback (int LinkIndex, int LinkStatus) |
| The method which will be called when new data arrive. | |
Interface to a TLink callback class for use in asynchronous links.
This class provides an inteface to a TCallback object whose callback method will be called which the link state of an asynchronous link has changed, either due to incoming data or non-zero status code.
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 ... ... }
| void de.desy.tine.client.TCallback.callback | ( | int | LinkIndex, |
| int | LinkStatus | ||
| ) |
The method which will be called when new data arrive.
| LinkIndex | is either the index returned when calling the TLink.attach(short mode,TCallback f) or TLink.attach(short mode,TCallback f,int pollrate) methods, or the index supplied when calling the TLink.attach(short mode,TCallback f,int pollrate,int notificationId) method. |
| LinkStatus | is the current link status code. The caller should always inspect this value to determine the validity of the data. |
1.7.4