Package de.desy.tine.dataUtils

Examples of de.desy.tine.dataUtils.TDataType


  public static int[] getAlarmSystemCodeList(String context,String server) throws IOException
  {
    if (context == null || server == null) return null;
    if (!isInitialized) initStructs();
    int[] results = new int[25];
    TDataType dtcodes = new TDataType(results);
    String dname = "/"+context+"/CAS/"+server;
    TLink tl = new TLink(dname,"AlmSystem4Server",dtcodes,null,TAccess.CA_READ);
    if (tl.executeAndClose(1000) != 0) throw new IOException(tl.getLastError());
    int len = dtcodes.getCompletionLength();
    return Arrays.copyOf(results, len);
  }
View Full Code Here


  }
  public static int setAlarmSystemCodeList(String context,String server,int[] sysCodes) throws IOException
  {
    if (context == null || server == null || sysCodes == null) return TErrorList.argument_list_error;
    if (!isInitialized) initStructs();
    TDataType dtcodes = new TDataType(sysCodes);
    String dname = "/"+context+"/CAS/"+server;
    TLink tl = new TLink(dname,"AlmSystem4Server",null,dtcodes,TAccess.CA_WRITE);
    int cc = tl.executeAndClose(1000);
    if (cc == TErrorList.connection_timeout || cc == TErrorList.link_timeout)
      throw new IOException(tl.getLastError());
View Full Code Here

          if (debugOutput)
            System.out.println(sys+" : signalling idle phase readout of last alarms ...");
        }
      }
    }
    TDataType dt = link.getOutputDataObject();
    int[] n = new int[dt.getArrayLength()];
    dt.getData(n);
    numDisabledAlarms = n[2]; // n.b. all of what follows assumes we're talking to the CAS
    synchronized (almTbl)
    {
      // almStateChanged = false; <- don't do this here (only when getLastAcquired is called)
      //timeNow = System.currentTimeMillis();
View Full Code Here

        MsgLog.log("GetAlarmsCallback","getAlarms for " + link.getDeviceName() + " failed",cc,null,0);
        ams = null;
      }
      else
      {
        TDataType amst = link.getOutputDataObject();
        int n = amst.getArrayLength();
        int nret = amst.getCompletionLength();
        // the link god-damn worked! so it's okay to update the friggen lastAcquired !!!!
        almTimeStamp = thisTimeStamp; //timeNow;
        if (nret > 0)
        {
          almTimeStamp = link.getLastTimeStamp();
View Full Code Here

    String tagName;
    int cc = TErrorList.connection_timeout;
    tagName = new String(currentConfiguredNameServerTag + "/");
    tagName = cname.length() > 0 ? tagName.concat(cname) : tagName.concat("#2");
    SrvAddr srv = new SrvAddr();
    TDataType d_null = new TDataType();
    TDataType d_srv = new TDataType(srv.toByteArray(),"");
    synchronized(getLinkFactory().ensMutex )
    {
      TLink ma = getLinkFactory().simpleLink(tagName,dname,d_srv,d_null,(short)1);
      if (ma == null)
      {
View Full Code Here

              }
              if (lnk.hasDependencies())
              { // already has dependencies ? (a jDDD specialty)
                TLink xlnk;
                LinkedList<TLink> xlst = lnk.getDependencies();
                TDataType dout;
                for (int k=0; k<xlst.size(); k++)
                {
                  if ((xlnk = (TLink)xlst.get(k)) == null) continue;
                  dout = xlnk.getOutputDataObject();
                  if (dout.dFormat != TFormat.CF_DEFAULT) continue;
                  int dlen = lnk.dOutput.dArrayLength;
                  if (xlnk.getMcaDevice() != null) dlen = 1;
                  if (lnk.dOutput.dFormat == TFormat.CF_MDA) dout.setTag(lnk.dOutput.getTag());
                  dout.setDataObject(dlen,lnk.dOutput.dFormat);
                  dout.dArrayLength = dlen;
                  dout.dFormat = lnk.dOutput.dFormat;
                  dout.dTimestamp = (long) dTimeStamp * 1000 + (long) (dTimeStampUSEC / 1000);
                  dout.timestamp = dTimeStamp;
                  dout.timestampMSEC = dTimeStampUSEC / 1000;
View Full Code Here

            TLink tLink = futureLink.get();
            int rc = tLink.execute();
            if (rc != TErrorList.success) {
                throw new RuntimeException("TLink has failed: " + TErrorList.getErrorString(rc));
            }
            TDataType dout = tLink.dOutput;
            long time = tLink.getLastTimeStamp();
            Timestamp timestamp = new Timestamp(time);
            return new AbstractMap.SimpleImmutableEntry<T, wpn.hdri.ss.data.Timestamp>((T) getDataObject(dout), timestamp);
        } catch (Exception e) {
            throw new ClientException("Read from " + getDeviceName() + "/" + attrName + " failed.", e);
View Full Code Here

                                @Override
                                public TLink call() throws Exception {
                                    TPropertyQuery meta = getTPropertyQuery(attrName);
                                    int size = getTPropertySize(meta);
                                    short dataFormat = getTPropertyFormat(meta);
                                    TDataType dout = new TDataType(size, dataFormat);
                                    // get a reference array : synchronous call ...
                                    TLink result = new TLink(getDeviceName(), attrName, dout, null, TAccess.CA_READ);
                                    return result;
                                }
                            });
View Full Code Here

    @Override
    public void subscribeEvent(final String attrName, final EventCallback cbk) throws ClientException {
        Future<TLink> futureLink = getFutureLink(attrName);
        try {
            final TLink link = futureLink.get();
            final TDataType dout = link.dOutput;
            long time = link.getLastTimeStamp();
            //read data for the first time
            cbk.onEvent(new EventData<Object>(getDataObject(dout), time));
            //attach event listener
            int rc = link.attach(TMode.CM_DATACHANGE, new TCallback() {
View Full Code Here

    @Override
    public Class<?> getAttributeClass(String attrName) throws ClientException {
        TPropertyQuery meta = getTPropertyQuery(attrName);
        int size = getTPropertySize(meta);
        short dataFormat = getTPropertyFormat(meta);
        TDataType dataType = new TDataType(size, dataFormat);
        //TODO it appears that TINE always returns array of values
        //TODO and the only interesting value is always the first one in this array
        //if (size > 1) {
//            return dataType.getDataObject().getClass();
        //      } else {
        return dataType.getDataObject().getClass().getComponentType();
        //    }
    }
View Full Code Here

TOP

Related Classes of de.desy.tine.dataUtils.TDataType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.