Examples of TDataType


Examples of de.desy.tine.dataUtils.TDataType

  private static String[] getDeviceProperties64(String context,String server,String device,String property,int timeout) throws IOException
  {
    String tgt = getNamesQueryTarget(context,server,device);
    if (tgt == null) return null;
    TLink tl;
    TDataType dout;
    TDataType din;
    int cc = 0,n,i,j;
    NAME64[] properties;
    String[] strprops;

    n = getNumberOf("PROPS",tgt);
    if (n == -TErrorList.illegal_device_number)
    { // a Steve special ...
      strprops = new String[1];
      strprops[0] = "INVALID";
      properties_have_query_function = true;
      return strprops;
    }
    if (n <= 0) return null;
    if (n < 128) n = 256; else n += 100; // room for aliases
    if (n*32 > maxQueryBufferSize) n = maxQueryBufferSize/64;
    properties = new NAME64[n];
    for (i=0; i<n; i++) properties[i] = new NAME64();
    if (properties.length <= 0) return null;
    dout = new TDataType(properties);
    if (property != null) din = new TDataType(property); else din = null;
    properties_have_query_function = false;
    try
    {
      tl = new TLink(tgt,"PROPS",dout,din,TAccess.CA_READ);
      cc = tl.execute(TLink.defaultTimeout,true);
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    throw new IOException("Could not acquire property information for " + server + " (" + TErrorList.getErrorString(cc) + ")");
  }
  private static String getTineStockString(String context,String server,String property,String text)
  {
    TLink tl;
    TDataType dout;
    String tgt;
    int cc = 0;
    StringBuffer ver = new StringBuffer(32);
 
    tgt = new String("/" + context + "/" + server + "/#0");
    dout = new TDataType(ver);
    try
    {
      tl = new TLink(tgt,property,dout,null,TAccess.CA_READ);
      cc = tl.execute(TLink.defaultTimeout,true);
      tl.close();
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

   * as obtained from the given device server
   */
  public static String[] getStockProperties(String context,String server,String device,String property)
  {
    TLink tl;
    TDataType dout;
    TDataType din;
    String tgt;
    int cc = 0,n = 0,i,j;
    NAME32[] properties;
    String[] strprops;

    tgt = new String("/" + context + "/" + server + "/" + device);
    try
    {
      n = getNumberOf("STOCKPROPS",tgt);
    }
    catch (IOException e)
    {
      return null;
    }
    if (n <= 0) return null;
    if (n*32 > maxQueryBufferSize) n = maxQueryBufferSize/32;
    properties = new NAME32[n];
    for (i=0; i<n; i++) properties[i] = new NAME32();
    dout = new TDataType(properties);
    if (property != null) din = new TDataType(property); else din = null;
    properties_have_query_function = false;
    tl = new TLink(tgt,"STOCKPROPS",dout,din,TAccess.CA_READ);
    cc = tl.execute(TLink.defaultTimeout,true);
    if ((cc & TErrorList.CE_SENDDATA) == TErrorList.CE_SENDDATA)
    {
      if ((cc & TErrorList.has_query_function) == TErrorList.has_query_function)
      {
        properties_have_query_function = true;
      }
      cc = 0;
    }
    tl.close();
    if (cc == 0)
    {
      for (i=0,n=0; i<properties.length; i++) if (properties[i].name.length() > 0) n++;
      strprops = new String[n];
      for (i=0,j=0; j<n && i<properties.length; i++)
      {
        if (properties[i].name.length() == 0) continue;
        strprops[j++] = properties[i].name;
      }
      return strprops;
    }
    else if (cc != TErrorList.link_not_open)
    {
      if (lastQueriedContext == context && lastQueriedServer == server &&
          lastQueriedDevice == device && lastQueriedServer != null)
      {
        cc = 0;
      }
      else
      {
        hLegacyByteBlob = new byte[n * PropertyQuery.sizeInBytes];
        dout = new TDataType(hLegacyByteBlob,"");
        tl = new TLink(tgt,"STOCKPROPS",dout,din,TAccess.CA_READ);
        cc = tl.execute(TLink.defaultTimeout,false);
        tl.close();
      }
      if (cc == 0)
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

   * as obtained from the given device server
   */
  public static String[] getMetaProperties(String context,String server,String device,String property)
  {
    TLink tl;
    TDataType dout;
    TDataType din;
    String tgt;
    int cc = 0,n = 0,i,j;
    NAME64[] properties;
    String[] strprops;

    tgt = new String("/" + context + "/" + server + "/" + device);
    try
    {
      TPropertyQuery[] pq = getStockPropertyInformation(context,server,device,"METAPROPS");
      if (pq != null) {
        n = pq[0].prpSize;
      }
    }
    catch (Exception e)
    {
      return null;
    }
    if (n <= 0) return null;
    if (n*32 > maxQueryBufferSize) n = maxQueryBufferSize/32;
    properties = new NAME64[n];
    for (i=0; i<n; i++) properties[i] = new NAME64();
    dout = new TDataType(properties);
    if (property != null) din = new TDataType(property); else din = null;
    properties_have_query_function = false;
    tl = new TLink(tgt,"METAPROPS",dout,din,TAccess.CA_READ);
    cc = tl.execute(TLink.defaultTimeout,true);
    if ((cc & TErrorList.CE_SENDDATA) == TErrorList.CE_SENDDATA)
    {
      if ((cc & TErrorList.has_query_function) == TErrorList.has_query_function)
      {
        properties_have_query_function = true;
      }
      cc = 0;
    }
    tl.close();
    if (cc == 0)
    {
      for (i=0,n=0; i<properties.length; i++) if (properties[i].name.length() > 0) n++;
      strprops = new String[n];
      for (i=0,j=0; j<n && i<properties.length; i++)
      {
        if (properties[i].name.length() == 0) continue;
        strprops[j++] = properties[i].name;
      }
      return strprops;
    }
    else if (cc != TErrorList.link_not_open)
    {
      if (lastQueriedContext == context && lastQueriedServer == server &&
          lastQueriedDevice == device && lastQueriedServer != null)
      {
        cc = 0;
      }
      else
      {
        hLegacyByteBlob = new byte[n * PropertyQuery.sizeInBytes];
        dout = new TDataType(hLegacyByteBlob,"");
        tl = new TLink(tgt,"METAPROPS",dout,din,TAccess.CA_READ);
        cc = tl.execute(TLink.defaultTimeout,false);
        tl.close();
      }
      if (cc == 0)
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    DeviceNamesQueryParams dnqp = getDeviceNamesQueryProperty(context,server,property,null,timeout);
    if (dnqp == null) return null;
    int n = dnqp.size;

    TLink tl;
    TDataType dout;
    int cc = 0,i,j;
    String tmp;
    NAME16[] devices;
    String[] strdevs;

    //if (n*16 > maxQueryBufferSize) n = maxQueryBufferSize/16;
    devices = new NAME16[n];
    for (i=0; i<n; i++) devices[i] = new NAME16();
    if (devices.length == 0) return null;
    if (n == 1)
    { // server claimed not to have device names ?
      devices[0].name = "#0";
    }
    dout = new TDataType(devices);
    tl = new TLink(dnqp.target,dnqp.property,dout,null,TAccess.CA_READ);
    cc = tl.execute(timeout,true);
    tl.close();
   
    if ((cc & TErrorList.CE_SENDDATA) == TErrorList.CE_SENDDATA)
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  {
    DeviceNamesQueryParams dnqp = getDeviceNamesQueryProperty(context,server,property,filter,timeout);
    if (dnqp == null) return null;
   
    TLink tl;
    TDataType dout;
    int cc = 0,i;
    NAME64[] devices;
    String[] strdevs;
    int n = dnqp.size;

    //if (n*64 > maxQueryBufferSize) n = maxQueryBufferSize/64;
    devices = new NAME64[n];
    for (i=0; i<n; i++) devices[i] = new NAME64();
    if (devices.length == 0) return null;
    dout = new TDataType(devices);
    tl = new TLink(dnqp.target,dnqp.property,dout,null,TAccess.CA_READ);
    cc = tl.executeAndClose(timeout);
    if ((cc & TErrorList.CE_SENDDATA) == TErrorList.CE_SENDDATA)
    {
      if ((cc & TErrorList.has_query_function) == TErrorList.has_query_function)
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    //if (TStructRegistry.contains(tag)) return 0; // already registered
    boolean doOnce = TStructRegistry.acquireOnce(tag);
    if (!doOnce && TStructRegistry.contains(tag,context,server)) return 0; // already registered
    int cc = 0, fmt, siz;
    NAME64DBLDBL[] sf = new NAME64DBLDBL[64];
    TDataType din = new TDataType(tag);
    TDataType dout = new TDataType(sf);
    String tgt;
    if (context == null || context.length() == 0) context = "DEFAULT";
    tgt = new String("/"+context+"/"+server+"/#0");
    TLink tl = new TLink(tgt,"STRUCTFORMAT",dout,din,TAccess.CA_READ);
    cc = tl.execute(TLink.defaultTimeout,true);
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  private static int AcquireAndRegisterStructInfoLegacy(String context,String server,String tag)
  {
    if (TStructRegistry.contains(tag)) return 0; // already registered
    int cc = 0;
    INTINT[] sf = new INTINT[64];
    TDataType din = new TDataType(tag);
    TDataType dout = new TDataType(sf);
    String tgt;
    if (context == null || context.length() == 0) context = "DEFAULT";
    tgt = new String("/"+context+"/"+server+"/#0");
    TLink tl = new TLink(tgt,"STRUCTFORMAT",dout,din,TAccess.CA_READ);
    cc = tl.execute(TLink.defaultTimeout,true);
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    return getDevicePropertyInformationX("PROPS", context,server,device,property,timeout);
  }
  private static synchronized XPropertyQuery[] getDevicePropertyInformationX(String stockprop, String context,String server,String device,String property,int timeout)
  {
    TLink tl;
    TDataType dout, din;
    int cc = 0,i;
    String tgt, dev;
    XPropertyQuery[] xpq = null;
    XPropertyQuery xpq1 = new XPropertyQuery();
    byte[] blob = hByteBlobX;
    boolean hasTarget = true;
 
    if (server == null || server.length() == 0) return null;
    if (device == null || device.length() == 0)
      dev = new String("#0");
    else
      dev = device;
    if (context == null || context.length() == 0)
      tgt = new String("/DEFAULT/" + server + "/" + dev);
    else
      tgt = new String("/" + context + "/" + server + "/" + dev);
    int np = nicePropertyQuerySize;
    if (property == null || property.compareTo("*") == 0)
    {
      din = new TDataType();
      String target = "/" + context + "/" + server;
      try
      {
        np = getNumberOf("PROPERTIES", target, timeout);
      }
      catch (IOException e)
      {
        throw new RuntimeException("Could not acquire property information for " + server + " (" + TErrorList.getErrorString(cc) + ")");
      }
      int fudge_factor = np > 150 ? 1 : 2;
      blob = new byte[fudge_factor * np * XPropertyQuery.sizeInBytes]; // allow room for overloads
      hasTarget = false;
    }
    else
    {
      din = new TDataType(property);
    }
    dout = new TDataType(blob,"XPQS");

    while (np > 0)
    {
      try
      {
        tl = new TLink(tgt,stockprop,dout,din,TAccess.CA_READ);
        cc = tl.execute(timeout,true);
        srvAddr = tl.srvAddr;
        if ((cc & TErrorList.CE_SENDDATA) == TErrorList.CE_SENDDATA) cc = 0;
        tl.close();
      }
      catch (Exception e)
      {
        MsgLog.log("getDevicePropertyInformationX", e.getMessage(),TErrorList.non_existent_elem,e,0);
        cc = TErrorList.non_existent_elem;
      }
      if (cc == TErrorList.invalid_transport_size)
      {
        np /= 2;
        blob = new byte[np * XPropertyQuery.sizeInBytes]; // allow room for overloads
        dout = new TDataType(blob,"XPQS");
      }
      else
      {
        break;
      }
    }
    if (cc == 0) // it's at lease a 3.31 server
    {     
      try
      {
        TStructIo.bytesToStruct(xpq1, blob,0,XPropertyQuery.sizeInBytes);
      }
      catch (IOException e1) { e1.printStackTrace(); }

      int nxpq = dout.dCompletionLength;
      if (hasTarget)
      {
        if (xpq1.prpNumOverloads < 1) xpq1.prpNumOverloads = 1; // can't be less than 1 !
        nxpq = xpq1.prpNumOverloads;
        if (nxpq > nicePropertyQuerySize) nxpq = nicePropertyQuerySize;
      }
      if (nxpq == 0) return null;     
     
      if (xpq1.prpNumOverloads < 1) xpq1.prpNumOverloads = 1; // can't be less than 1 !
      if (nxpq > np) nxpq = np;
      xpq = new XPropertyQuery[nxpq];
      xpq[0] = xpq1;
      for (i=1; i<nxpq; i++)
      {
        xpq[i] = new XPropertyQuery();
        try {
          TStructIo.bytesToStruct(xpq[i],blob,i*XPropertyQuery.sizeInBytes,XPropertyQuery.sizeInBytes);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      return xpq;
    }
    if (cc == TErrorList.link_not_open)
    {
      throw new RuntimeException("Could not acquire property information for " + server + " (" + TErrorList.getErrorString(cc) + ")");
    }
    if (cc == TErrorList.non_existent) return null;
    PropertyQueryLegacy[] pqx = null;
    PropertyQueryLegacy pqx1 = new PropertyQueryLegacy();
    dout = new TDataType(hByteBlobL,"PQSX");
    tl = new TLink(tgt,stockprop,dout,din,TAccess.CA_READ);
    cc = tl.execute(timeout,true);
    tl.close();
    if (cc == 0) // it's at lease a 3.20 server
    {
      byte b[] = pqx1.toByteArray();
      System.arraycopy(hByteBlobL,0,b,0,PropertyQueryLegacy.sizeInBytes);
      pqx1.toStruct();
      int npqx = np;
      if (hasTarget)
      {
        if (pqx1.prpNumOverloads < 1) pqx1.prpNumOverloads = 1; // can't be less than 1 !
        npqx = pqx1.prpNumOverloads;
      }
      if (npqx > nicePropertyQuerySize) npqx = nicePropertyQuerySize;
      pqx = new PropertyQueryLegacy[npqx];
      xpq = new XPropertyQuery[npqx];
      pqx[0] = pqx1;
      for (i=1; i<npqx; i++)
      {
        pqx[i] = new PropertyQueryLegacy();
        b = pqx[i].toByteArray();
        System.arraycopy(hByteBlobL,i*PropertyQueryLegacy.sizeInBytes,b,0,PropertyQueryLegacy.sizeInBytes);
        pqx[i].toStruct();
      }
      for (i=0; i<npqx; i++)
      {
        xpq[i] = new XPropertyQuery();
        xpq[i].prpFormat = pqx[i].prpFormat;
        xpq[i].prpFormatIn = pqx[i].prpFormatIn;
        xpq[i].prpSize = pqx[i].prpSize;
        xpq[i].prpSizeIn = pqx[i].prpSizeIn;
        xpq[i].prpAccess = pqx[i].prpAccess;
        xpq[i].prpDescription = pqx[i].prpDescription;
        xpq[i].prpName = pqx[i].prpName;
        xpq[i].prpNumOverloads = pqx[i].prpNumOverloads;
        xpq[i].prpTag = pqx[i].prpTag;
        xpq[i].prpTagIn = pqx[i].prpTagIn;
        xpq[i].prpRedirection = pqx[i].prpRedirection;
        xpq[i].prpHistoryDepthLong = pqx[i].prpHistoryDepthLong;
        xpq[i].prpHistoryDepthShort = pqx[i].prpHistoryDepthShort;
        xpq[i].prpUnits = pqx[i].prpUnits;
        xpq[i].prpMaxValue = pqx[i].prpMaxValue;
        xpq[i].prpMinValue = pqx[i].prpMinValue;
        xpq[i].prpGraphType = pqx[i].prpGraphType;
      }
      return xpq;
    }
    if (cc == TErrorList.link_not_open)
    {
      throw new RuntimeException("Could not acquire property information for " + server + " (" + TErrorList.getErrorString(cc) + ")");
    }
    // legacy server
    hLegacyByteBlob = null;
    String[] prps = getDeviceProperties(context,server,device);
    if (prps == null || prps.length == 0) return null;
    PropertyQuery[] pq = new PropertyQuery[prps.length];
    xpq = new XPropertyQuery[1];
    byte b[];
    if (hLegacyByteBlob == null) return null;
    for (i=0; i<prps.length; i++)
    {
      pq[i] = new PropertyQuery();
      b = pq[i].toByteArray();
      System.arraycopy(hLegacyByteBlob,i*PropertyQuery.sizeInBytes,b,0,PropertyQuery.sizeInBytes);
      pq[i].toStruct();
      if (pq[i].name.compareTo(property) != 0) continue;
      xpq[0] = new XPropertyQuery();
      xpq[0].prpFormat = pq[i].prpFormat;
      xpq[0].prpSize = pq[i].prpSize;
      xpq[0].prpAccess = pq[i].prpAccess;
      xpq[0].prpDescription = pq[i].prpDesc;
      xpq[0].prpName = pq[i].name;
      xpq[0].prpNumOverloads = 1;
      if ((pq[0].prpAccess & TAccess.CA_WRITE) == TAccess.CA_WRITE)
      {
         xpq[0].prpFormatIn = pq[i].prpFormat;
         xpq[0].prpSizeIn = pq[i].prpSize;
      }
      else    
      {
         xpq[0].prpFormatIn = (byte)TFormat.CF_NULL;
         xpq[0].prpSizeIn = 0;
      }
      USTRING[] egu = new USTRING[1];
      egu[0] = new USTRING();
      dout = new TDataType(egu);
      din = new TDataType();
      String prpegu = new String(property + ".EGU");
      tl = new TLink(tgt,prpegu,dout,din,TAccess.CA_READ);
      cc = tl.execute(timeout,false);
      tl.close();
      if (cc == 0)
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

      if (output) System.out.println("error: parameter list error");
      return TErrorList.argument_list_error;
    }
    String target = "/"+context+"/"+server;
    char[] st = new char[32];
    TDataType dout = new TDataType(st);
    int cc = TErrorList.address_unknown;
    try
    {
      TLink tl = new TLink(target,"SRVSTARTTIME",dout,null,TAccess.CA_READ);
      cc = tl.execute(timeout,true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.