Examples of TDataType


Examples of de.desy.tine.dataUtils.TDataType

          { // at least this many with the same code
              code = TAlarm.isDiskSpaceAlarm(code) ? (code & 0xff) : TAlarm.getBaseCode(code);
              TAlarmDefinition ad = getAlarmDefinition(code);
              atag = ""+n+" alarms: "+ ad != null ? ad.getAlarmTag() : "<no defined alarm tag>";
          }
          TDataType dt = new TDataType(tna);
          ams[0] = new TAlarmMessage(thisEqm.getExportName(),thisEqm.getExportName(),atag,code,
                          deviceList.getHighestAlarmSeverity(null,0),almDynSet,dt);
          //tba = new byte[buflength * TAlarmMessage.sizeInBytes];
        }
        else
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  {
    if (prp == null || !prp.isSaveAndRestore) return false;
    try
    {
      int sizOut,sizIn,sizSr=0;
      TDataType srData = prp.getSaveRestoreData();
      if (srData != null) return true;
      if (!TAccess.isWrite((byte)prp.getAccessMode())) return false;
      if ((sizIn=prp.getInputSize()) < 1) return false;
      if ((sizOut=prp.getOutputSize()) < 1) return false;
      short fmt=prp.getOutputFormat();
      if (fmt != prp.getInputFormat()) return false;
      if (!TFormat.isAllowedSaveAndRestoreFormat(fmt)) return false;
      //if (!TFormat.isSimpleFormat(fmt)) return false;
      if (fmt == TFormat.CF_TEXT)
      { // actually 1 string = an array of chars
        fmt = TFormat.CF_STRING;
        sizSr = deviceList.getNumberOfDevices();
        if (sizSr < 1) sizSr = numDevicesFromExportsFile;
      }
      else if (sizIn == 1)
      { // property sets one at a time
        if (sizOut == 1)
        { /* attribute style */
          sizSr = deviceList.getNumberOfDevices();
        }
        else
        { /* part of a multi-channel array ? */
          if (!TArrayType.isChannel(prp.getDescription().getArrayType())) return false;
          sizSr = sizOut;
        }
      }
      else
      { // property sets multiple values : allow only if multi-channel array
        if (sizIn != sizOut) return false;
        if (TArrayType.isChannel(prp.getDescription().getArrayType()))
        {
          sizSr = sizOut;
        }
        else if (TFormat.isNumberFormat(fmt))
        { // an array of primitives -> make allocation adjustments
          int n = deviceList.getNumberOfDevices();
          ArrayList<String> pdl = prp.getDeviceList();
          if (pdl != null) n = pdl.size();
          sizSr = n * sizOut;     
        }
        else
        {
          return false;
        }
      }
      prp.setSaveRestoreData(new TDataType(sizSr,fmt));
      return true;
    }
    catch (Exception any)
    {
      return false;
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  {
    if (srLst.size() == 0) return;
    Iterator<String> it = srLst.iterator();
    String prp = null, dev = "";
    TExportProperty p = null;
    TDataType srdt = null, tdt = null, ndt = new TDataType();
    int len = 0, siz = 1, cc = 0;
    TAccess wacc = new TAccess(TAccess.CA_WRITE|TAccess.CA_SAVERESTORE);
    TAccess racc = new TAccess(TAccess.CA_READ|TAccess.CA_SAVERESTORE);
    ArrayList<String>alst = null;
    String[] dlst = null;
    TEquipmentModuleFactory f = TEquipmentModuleFactory.getInstance();
    TContractTable tct = new TContractTable();
    TClientEntry tce = new TClientEntry();
    tce.cln = new TClient();
    tce.cln.userName = "INITIALIZATION";
    tct.clt.add(tce);
    while (it.hasNext())
    {
      prp = it.next();
      it.remove();
      if ((p=propertyList.getFirstProperty(prp)) == null) continue;
      if ((srdt=p.getSaveRestoreData()) == null) continue;
      alst = p.getDeviceList();
      dlst = (alst != null) ?
          alst.toArray(new String[0]) :
          deviceList.getDeviceNameList();
      siz = 1; hasSrValues = null;
      if (srdt.isArrayOfPrimitives())
      {
        siz = p.getInputSize();
        if (siz > 1) hasSrValues = new boolean[siz];
      }
      tdt = new TDataType(siz,srdt.getFormat());
      len = srdt.getArrayLength();
      if (dlst != null && dlst.length > 0 && len > dlst.length)
      { // TODO: this should always be the case :
        len = dlst.length;
      }
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

                case TFormat.CF_HISTORY:
                  data = new HISTORY[dataSize];
                  // create the first one so as to pass the tag along
                  short f = TFormat.getFormatCode(dout.getTag());
                  if (f == TFormat.CF_NULL) return TErrorList.illegal_format;
                  TDataType d = new TDataType(1,f);
                  ((HISTORY[])data)[0] = new HISTORY(d);
                  break;
                default:
                  data = TFormat.makeCompoundDataObjectArray(dout.dFormat, dout.getTag(), dataSize);
                  break;
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    return getTagList(context,tagtype,subsys,TLink.defaultTimeout);
  }
  private static String[] getTagList(String context,String tagtype,String subsys,int timeout)
  {
    int cc,n,i;
    TDataType dout;
    TDataType din;
    TLink tl;
    StringBuffer host = new StringBuffer(32);
    StringBuffer query = new StringBuffer(32);
    short[] numout = new short[1];
    TDataType numoutData = new TDataType(numout);
    NAME16[] taglist16;
    NAME32[] taglist32;
    String[] strlist;

    if (subsys == null || subsys.compareTo("ALL") == 0)
    {
      din = new TDataType();
    }
    else
    {
      din = new TDataType(subsys);
    }
   
    host.delete(0,31); query.delete(0,31);
    if (context != null && context.length() != 0)
    {
      host.insert(0,"ENS/" + context);
    }
    else
    {
      host.insert(0,"ENS");
    }
    query.insert(0,"N" + tagtype);
    try
    {
      tl = new TLink(host.toString(),query.toString(),numoutData,din,TAccess.CA_READ);
      cc = tl.execute(timeout,true);
      srvAddr = tl.srvAddr;
      tl.close();
    }
    catch (Exception e)
    { // if the host name cannot be resolved -> runtime exception
      MsgLog.log("getTagList", e.getMessage(),TErrorList.non_existent_elem,e,0);
      cc = TErrorList.non_existent_elem;
    }
    if (cc != 0) return null;
    if (numout[0] == 0 && subsys != null && subsys.length() > 0) numout[0] = 100;   
    query.delete(0,31);
    query.insert(0,tagtype);
    n = numout[0];

    taglist32 = new NAME32[n];
    for (i=0; i<n; i++) taglist32[i] = new NAME32();
    if (taglist32.length == 0) return null;
    if (numout[0] > taglist32.length) numout[0] = (short)taglist32.length; 
    dout = new TDataType(taglist32);
    tl = new TLink(host.toString(),query.toString(),dout,din,TAccess.CA_READ);
    cc = tl.execute(TLink.defaultTimeout,true);
    if (dout.getCompletionLength() < n) n = dout.getCompletionLength();
    tl.close();
    if (cc == 0)
    { // this worked, so we're finished
      strlist = new String[n];
      for (i=0; i<n; i++) strlist[i] = taglist32[i].name;     
      return strlist;
    }
    if (cc == TErrorList.illegal_format)
    { // old ENS ? -> try with reduced lengths ...
      taglist16 = new NAME16[n];
      for (i=0; i<n; i++) taglist16[i] = new NAME16();
      if (taglist16.length == 0) return null;
      if (numout[0] > taglist16.length) numout[0] = (short)taglist16.length; 
      dout = new TDataType(taglist16);
      tl = new TLink(host.toString(),query.toString(),dout,din,TAccess.CA_READ);
      cc = tl.execute(TLink.defaultTimeout,true);
      tl.close();
      if (cc != 0) return null;
      strlist = new String[n];
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  }
  private static int getNumberOf(String property,String target,int timeout) throws IOException
  {
    int cc = TErrorList.non_existent_elem;
    short[] n = new short[1];
    TDataType dout;
    TLink tl;
    String propertyq;
   
    if (property == null || target == null) return -TErrorList.argument_list_error;
  
    dout = new TDataType(n);
    propertyq = new String("N" + property);
    try
    {
      tl = new TLink(target,propertyq,dout,null,TAccess.CA_READ);
      cc = tl.execute(timeout,true);
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  public static String[] getContexts(String serverName,String importance)
  {
    if (!TLinkFactory.getInstance().isRunningStandAlone())
    {   
      int cc,n,i;
      TDataType dout;
      TDataType din;
      TLink tl;
      NAME32[] taglist32;
      String[] strlist;
 
      if (serverName == null || serverName.compareToIgnoreCase("ALL") == 0)
      {
        din = new TDataType();
      }
      else if (importance == null)
      {
        din = new TDataType(serverName);
      }
      else
      {
        if (importance.length() == 0) importance = "ALL";
        NAME32[] n32a = new NAME32[2];
        n32a[0] = new NAME32(serverName);
        n32a[1] = new NAME32(importance);
        din = new TDataType(n32a);
      }
      taglist32 = new NAME32[niceContextsQuerySize];
      for (i=0; i<niceContextsQuerySize; i++) taglist32[i] = new NAME32();
      if (taglist32.length == 0) return null;
      dout = new TDataType(taglist32);
      tl = new TLink("/SITE/ENS","CONTEXTS",dout,din,TAccess.CA_READ);
      cc = tl.execute(TLink.defaultTimeout,true);
      tl.close();
      n = dout.getCompletionLength();
      if (cc == 0)
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    }

    int rc;
    boolean isOffline = false;
    TLink lnk;
    TDataType tdt;
    NAME32[] n32 = new NAME32[100];
    al.add("security :");
    tdt = new TDataType(n32);
    lnk = new TLink(tgt,"USERS",tdt,null,TAccess.CA_READ);   
    rc = lnk.executeAndClose();
    if (rc == TErrorList.link_timeout || rc == TErrorList.connection_timeout)
      isOffline = true;
    if (rc == 0 && tdt.getCompletionLength() > 0)
    {
      al.add("WRITE access open to Users : ");
      for (int i=0; i<tdt.getCompletionLength(); i++)
        al.add("\t"+n32[i].name);
    }
    else
    {
      if (!isOffline) al.add("WRITE access open to : ALL users");
    }
    lnk = new TLink(tgt,"IPNETS",tdt,null,TAccess.CA_READ);   
    rc = isOffline ? TErrorList.connection_timeout : lnk.executeAndClose();
    if (rc == 0 && tdt.getCompletionLength() > 0)
    {
      al.add("WRITE access open to Network Addresses : ");
      for (int i=0; i<tdt.getCompletionLength(); i++)
        al.add("\t"+n32[i].name);
    }
    else
    {
      if (!isOffline) al.add("WRITE access open to : ALL network addresses");
    }
    al.add("servers running on same host :");   
    ServerQuery[] sqhst = TQuery.getDeviceServersEx(context, ip,"ALL");
    for (ServerQuery sq : sqhst) al.add("\t"+sq.getName());

    String[] alst = ENSTools.getServerAliasList(tgt);
    if (alst != null && alst.length > 0)
    {
      al.add("aliases for "+tgt+":");   
      for (String s : alst) al.add("\t"+s+ " -> "+tgt);
    }
    if (!isOffline)
    {
      String[] devs = TQuery.getDeviceNames(context, server);
      if (devs != null)
      {
        al.add(tgt+" has "+devs.length+" devices");
        if (TQuery.devices_have_query_function)
        {
          al.add(tgt+" has property query precedence (classic property server model)");
          tgtdev = "#0";
        }
        if (devs.length > 0 && tgtdev == null) tgtdev = devs[0];
        //for (String s: devs) al.add(s);
      }
   
      String[] prps = TQuery.getDeviceProperties(context, server, tgtdev);
      if (prps != null)
      {
        al.add(tgt+" has "+prps.length+" properties");
        if (TQuery.properties_have_query_function)
        {
          al.add(tgt+" has device query precedence (classic device server model)");
        }
        if (devs.length > 0 && tgtdev == null) tgtdev = devs[0];
        //for (String s: prps) al.add(s);
      }
      TPropertyQuery pztpq[] = null;
      long t0;
      String rdr = null, lclhststr = null;
      int callsOK = 0;
      int callsErr = 0;
      int callsNA = 0;
      int len = prps.length;
      if (limit > 0 && limit < len) len = limit;
      for (int i=0; prps != null && i<len; i++)
      {
        pztpq = TQuery.getPropertyInformation(context, server, tgtdev, prps[i]);
        if (pztpq == null)
        {
          callsErr++;
          continue;
        }
        for (TPropertyQuery p: pztpq)
        {
          if (TAccess.isRead(p.prpAccess))
          {
            al.add("read "+p.prpName+" : "+p.prpDescription);
            lclhststr = p.prpHistoryDepthShort == 0 ? "none" :
                        p.prpHistoryDepthShort < 0 ? "redirected" :
                        p.prpHistoryDepthLong > 0 ? ""+p.prpHistoryDepthLong+" month(s)" :
                        ""+p.prpHistoryDepthShort+" entries in ring buffer";
            al.add("\tlocal history : "+lclhststr);
            al.add("\tarray type : "+TArrayType.toString(p.prpArrayType));
            if (p.prpRedirection.length() > 0)
              al.add("\tis redirected to "+p.prpRedirection);
            if (p.prpSizeIn > 0) al.add("\ttakes input: "+p.prpSizeIn+" "+TFormat.toString(p.prpFormatIn)+" elements");
            al.add("\tresults:");
            if (p.prpFormat == TFormat.CF_STRUCT)
            {
              int ssiz = 0;
              if ((ssiz=TStructRegistry.getSizeInBytes(p.prpTag)) <= 0)
              {
                TQuery.AcquireAndRegisterStructInfo(context, server, p.prpTag);
                ssiz = TStructRegistry.getSizeInBytes(p.prpTag,context,server);
              }
              if (ssiz > 0) tdt = new TDataType(new byte[ssiz],p.prpTag);
              else
              {
                al.add("\tunable to acquire and register structure tag "+p.prpTag);
                tdt = new TDataType(p.prpSize,p.prpFormat);
              }
            }
            else if (p.prpFormat == TFormat.CF_AIMAGE || p.prpFormat == TFormat.CF_ASPECTRUM)
            {
              al.add("\t"+lnk.getFullDeviceNameAndProperty()+" adjustable format not accessed");
              callsNA++;  
              continue;
            }
            else
            {
              tdt = new TDataType(p.prpSize,p.prpFormat);
            }
            lnk = new TLink(tgt+"/"+tgtdev,p.prpName,tdt,null,TAccess.CA_READ);
            t0 = System.currentTimeMillis();
            rc = lnk.executeAndClose();
            if (rc == TErrorList.illegal_read_write && p.prpSizeIn > 0)
            {
              al.add("\t"+lnk.getFullDeviceNameAndProperty()+" not accessed: requires input data");
              callsNA++;
            }
            else
            {
              al.add("\t"+lnk.getFullDeviceNameAndProperty()+" "+p.prpSize+" "+
                TFormat.toString(p.prpFormat)+" value(s) in "+
                (System.currentTimeMillis()-t0)+" ms : "+lnk.getLastError());
              TDataType dout = lnk.getOutputDataObject();
              switch (dout.dFormat)
              {
                case TFormat.CF_STRUCT:
                  al.add("\tStructure type "+dout.getTag());
                  break;
                case TFormat.CF_BITFIELD8:
                case TFormat.CF_BITFIELD16:
                case TFormat.CF_BITFIELD32:
                case TFormat.CF_BITFIELD64:
                  al.add("\tBitfield type "+dout.getTag());
                  break;
                case TFormat.CF_IMAGE:
                  IMAGE img = (IMAGE)dout.getDataObject();
                  al.add("\tImage; Frame size "+img.getFrameHeader().appendedFrameSize+" bytes");
                  break;
                default:
                  if (dout.dCompletionLength <= 10)
                  {
                    dout.setArrayDelimiter(" ");
                    al.add("\tvalues: "+dout.toString());                 
                  }
                  else
                  {
                    al.add("\treceived "+dout.dCompletionLength+" values");
                  }
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  public static TClientStruct[] getServerClients(String fullServerName)
  {
    if (fullServerName == null) return null;
    TClientStruct[] tcs = new TClientStruct[100];
    for (int i=0; i<100; i++) tcs[i] = new TClientStruct();
    TDataType tcsd = new TDataType(tcs);
    TLink tl = new TLink(fullServerName,"CLIENTS",tcsd,null,TAccess.CA_READ);
    if (tl.executeAndClose(TLink.defaultTimeout) == 0)
    {
      int len;
      for (len=0; len<100 && tcs[len].getProtocol()[0] != (short)0; len++);
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  public static TContractStruct[] getServerContracts(String fullServerName)
  {
    if (fullServerName == null) return null;
    TContractStruct[] tcs = new TContractStruct[100];
    for (int i=0; i<100; i++) tcs[i] = new TContractStruct();
    TDataType tcsd = new TDataType(tcs);
    TLink tl = new TLink(fullServerName,"CONTRACTS",tcsd,null,TAccess.CA_READ);
    if (tl.executeAndClose(TLink.defaultTimeout) == 0)
    {
      int len;
      for (len=0; len<100 && tcs[len].getEqpProperty()[0] != (char)0; len++);
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.