Main Page | Features | Central Services | csv-Files | Types | Transfer | Access | API-C | API-VB/ActiveX | API-Java | Examples | Downloads
Public Member Functions
de.desy.tine.client.TLinkCallback Interface Reference

Interface to a TLink callback class for use in asynchronous links. More...

Inheritance diagram for de.desy.tine.client.TLinkCallback:
de.desy.tine.client.TAwtAsyncCallback de.desy.tine.client.TAwtSyncCallback

List of all members.

Public Member Functions

void callback (TLink link)
 The method which will be called when new data arrive.

Detailed Description

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 ...
    ...
  }

Member Function Documentation

void de.desy.tine.client.TLinkCallback.callback ( TLink  link)

The method which will be called when new data arrive.

Parameters:
linkis 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.
See also:
de.desy.tine.client.TLink.attach

Implemented in de.desy.tine.client.TAwtAsyncCallback, and de.desy.tine.client.TAwtSyncCallback.


The documentation for this interface was generated from the following file: