Interface to a TLink callback class for use in asynchronous links. More...
Public Member Functions | |
| void | callback (TLink link) |
| 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 TLinkCallback 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:
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 ... ... }
| void de.desy.tine.client.TLinkCallback.callback | ( | TLink | link | ) |
The method which will be called when new data arrive.
| link | is the client TLink object which created the link. The property values of this object will reflect the current link status and timestamp (among other things) of the associated link. |
Implemented in de.desy.tine.client.TAwtAsyncCallback, and de.desy.tine.client.TAwtSyncCallback.
1.7.4