Examples of TDevice


Examples of de.desy.tine.server.devices.TDevice

  }
  public void clearFecLinkErrorAlarm(TLink lnk)
  {
    if (eqmTable == null || eqmTable[0] == null) return;
    TEquipmentModule eqm = eqmTable[0]; // take the first one
    TDevice d = eqm.getDeviceList().getDevice(0);
    if (d == null) return;
    d.removeAlarm(TAlarm.encodeLinkErrorAlarm(lnk.linkId));
  }
View Full Code Here

Examples of de.desy.tine.server.devices.TDevice

  }
  private boolean isMemberDeviceAclList(TEquipmentModule eqm, TClient tc, String devName)
  {
    try
    {
      TDevice dev = eqm.getDeviceList().getDevice(devName);
      return dev.isMemberUsersList(tc) && dev.isMemberControlNets(tc);
    }
    catch (Exception ignore) {}
    return true;
  }
View Full Code Here

Examples of de.desy.tine.server.devices.TDevice

    if (em == null) return;
    if (srvCycleTime < lastCheckFreeBlocks + 60000) return;
    lastCheckFreeBlocks = srvCycleTime;
    String txt;
    MinDiskSpaceTblEntry te = null;
    TDevice td = null;
    for (i=0; i<minDiskSpaceTbl.size(); i++)
    {
      te = minDiskSpaceTbl.get(i);
      if (te.minFreeBlks <= 0) continue;
      td = em.getDeviceList().getDevice(0);
      td.clearAlarm(TErrorList.warn_disk_space);
      td.clearAlarm(TErrorList.low_disk_space);
      freeblks = getAvailableDiskSpaceInBlocks(te.path);
      if (freeblks < te.minFreeBlks)
      {
        txt = te.path+" "+freeblks+" kb";
        if (freeblks < te.minFreeBlks/10) code = TErrorList.low_disk_space;
        code = TAlarm.encodeDiskSpaceAlarm(i,code);
        td.setAlarm(code,txt.getBytes());
      }
    }
  }
View Full Code Here

Examples of de.desy.tine.server.devices.TDevice

    int devlistsize = 0;  
    String[] devlist = null;
    int atype;
    NAME16FI[] nfi;
    NAME16II[] nii;
    TDevice dev;

    TEquipmentModule eqm = tct.eqm;
    TDeviceList dlst = eqm.getDeviceList();
    String devprp = tct.contract.eqmProperty;
    String devnam = tct.contract.eqmDeviceName;
    TExportProperty prp = eqm.propertyList.getFirstProperty(devprp);
    if ((atype=prp.getDescription().getArrayType()) == TArrayType.AT_SPECTRUM)
      return TErrorList.not_allowed;
    if (tct.dout == null || tct.dout.dArrayLength < 1) return TErrorList.not_allowed;
    if (!eqm.isDeviceSetLocal(devnam,devprp)) return TErrorList.data_not_local;

    if (prp.getDeviceList() != null)
    {
      devlistsize = prp.getDeviceList().size();
      devlist = new String[devlistsize];
      prp.getDeviceList().toArray(devlist);
    }
    if (devlistsize == 0)
    { // normal state of affairs: use the registered device list
      devlist = dlst.getDeviceNameList();
      devlistsize = devlist.length;
      chkOffline = true;
      if (tct.din != null && tct.din.dArrayLength == 1 && tct.din.dFormat == TFormat.CF_INT32)
      { // appears to be an input device mask
        int[] msk = new int[1];
        tct.din.getData(msk);
        mask = msk[0];
        if (mask != 0) chkMask = true;
      }
    }
    if ((atype & TArrayType.AT_CHANNEL) == TArrayType.AT_CHANNEL)
    {
      len = devlistsize;
      int endpoints[] = StringToName.getContiguousEndpoints(devlist,devnam);
      if (endpoints != null)
      {
        isCont = true;
        start = endpoints[0];
        len = endpoints[1] - endpoints[0] + 1;
      }
    }
    WildcardMatch wc = new WildcardMatch(devnam);
    dnull = new TDataType();
    switch (tct.dout.dFormat)
    {
      case TFormat.CF_NAME16DBLDBL:
      case TFormat.CF_NAME32DBLDBL:
      case TFormat.CF_NAME64DBLDBL:
      case TFormat.CF_USTRING:
      case TFormat.CF_NAME16FI:
        if (isCont)
        {
          int dsiz = tct.contract.dataSizeOut > len ? len : tct.contract.dataSizeOut;
          nfi = new NAME16FI[dsiz];
          float[] frb = new float[dsiz];
          drdb = new TDataType(frb);
          cc = tct.eqm.callProperty(devprp, devlist[start], drdb, dnull, acc);
          if (cc != 0) return cc;
          for (i=0, k=0; i<drdb.dArrayLength; i++)
          {
            dev = dlst.getDevice(i);
            if (chkMask) if (dev == null || !dev.isMaskSet(mask)) continue;
            if (chkOffline) if (dev == null || dev.isOffline()) continue;
            nfi[k] = new NAME16FI(devlist[start+i],0,frb[i]);
            k++;
          }
          tct.drb.dArrayLength = k;
        }
        else
        {
          int dsiz = tct.contract.dataSizeOut;
          nfi = new NAME16FI[dsiz];
          float[] frb = new float[1];
          drdb = new TDataType(frb);
          for (i=0, k=0; i<devlistsize && k<tct.dout.dArrayLength; i++)
          {
            if (!wc.matches(devlist[i])) continue;
            dev = dlst.getDevice(i);
            if (chkMask) if (dev == null || !dev.isMaskSet(mask)) continue;
            if (chkOffline) if (dev == null || dev.isOffline()) continue;
            cc = tct.eqm.callProperty(devprp, devlist[i], drdb, dnull, acc);
            if (cc == TErrorList.server_redirection) return TErrorList.data_not_local;
            nfi[k] = new NAME16FI(devlist[i],cc,frb[0]);
            k++;
          }
          tct.drb.dArrayLength = k;
        }
        tct.drb.putData(nfi);
        return 0;
      case TFormat.CF_NAME16II:
        if (isCont)
        {
          int dsiz = tct.contract.dataSizeOut > len ? len : tct.contract.dataSizeOut;
          nii = new NAME16II[dsiz];
          int[] irb = new int[dsiz];
          drdb = new TDataType(irb);
          cc = tct.eqm.callProperty(devprp, devlist[start], drdb, dnull, acc);
          if (cc != 0) return cc;
          for (i=0,k=0; i<drdb.dArrayLength; i++)
          {
            dev = dlst.getDevice(i);
            if (chkMask) if (dev == null || !dev.isMaskSet(mask)) continue;
            if (chkOffline) if (dev == null || dev.isOffline()) continue;
            nii[k] = new NAME16II(devlist[start+i],0,irb[i]);
            k++;
          }
          tct.drb.dArrayLength = k;
        }
View Full Code Here

Examples of de.desy.tine.server.devices.TDevice

    boolean gateOffline = (gateType == TMetaProperties.GATE_ARRAY) && (gate == -1);
    boolean gateArray = (gateType == TMetaProperties.GATE_ARRAY) && (gate > 0);
    boolean gateData = true;
    Object hDataObject = dout.getDataObject();
    int size = dout.getArrayLength();
    TDevice dev;
    if (gateOffline || gateArray)
    { // need to have a valid device list
      if (devlst == null) return;
      if (devlst.getNumberOfDevices() != size) return;
      gateData = false;
    }
    switch (dout.getFormat())
    {
      case TFormat.CF_BYTE:
      {
        byte[] data = (byte[])hDataObject;
        for (i=0; i<size; i++)
        {
          if ((dev=devlst.getDevice(i)) == null) continue;
          if (gateOffline && dev.isOffline()) continue;
          if (gateArray && !dev.isMaskSet(gate)) continue;
          if (i > n) data[n] = data[i];
          if (gateData) data[n] &= gate;
          if (gateBoolean) data[n] = (byte)(data[n] == (byte)gate ? 1 : 0);
          n++;
        }
        if (n < size) dout.setArrayLength(n);
        dout.putData(data);
        break;
      }
      case TFormat.CF_INT16:
      {
        short[] data = (short[])hDataObject;
        for (i=0; i<size; i++)
        {
          if ((dev=devlst.getDevice(i)) == null) continue;
          if (gateOffline && dev.isOffline()) continue;
          if (gateArray && !dev.isMaskSet(gate)) continue;
          if (i > n) data[n] = data[i];
          if (gateData) data[n] &= gate;
          if (gateBoolean) data[n] = (short)(data[n] == (short)gate ? 1 : 0);
          n++;
        }
        if (n < size) dout.setArrayLength(n);
        dout.putData(data);
        break;
      }
      case TFormat.CF_INT32:
      {
        int[] data = (int[])hDataObject;
        for (i=0; i<size; i++)
        {
          if ((dev=devlst.getDevice(i)) == null) continue;
          if (gateOffline && dev.isOffline()) continue;
          if (gateArray && !dev.isMaskSet(gate)) continue;
          if (i > n) data[n] = data[i];
          if (gateData) data[n] &= gate;
          if (gateBoolean) data[n] = (int)(data[n] == (int)gate ? 1 : 0);
          n++;
        }
        if (n < size) dout.setArrayLength(n);
        dout.putData(data);
        break;
      }
      default:
        if (!gateArray) break;
        Object data = hDataObject;
        if (!data.getClass().isArray()) break;
        for (i=0; i<size; i++)
        {
          if ((dev=devlst.getDevice(i)) == null) continue;
          if (gateOffline && dev.isOffline()) continue;
          if (gateArray && !dev.isMaskSet(gate)) continue;
          if (i > n) Array.set(data, n, Array.get(data, i));
          n++;
        }
        if (n < size) dout.setArrayLength(n);
        dout.putData(data);
View Full Code Here

Examples of de.desy.tine.server.devices.TDevice

    {
      if (isWildcardContract(tgtDevice)) return TErrorList.not_allowed;
      if (isWildcardContract(tgtProperty)) return TErrorList.not_allowed;
    }
    // check if device is categorically redirected ...
    TDevice td = eqm.getDeviceList().getDevice(tgtDevice);
    if (td != null && (rdirStr=td.getRedirection()) != null)
    {
      byte[] rdb = redirectionStringToBytes(rdirStr);
      System.arraycopy(rdb,0,errorData,0,rdb.length);
      return TErrorList.server_redirection;     
    }
View Full Code Here

Examples of de.desy.tine.server.devices.TDevice

  }
  public void setFecLinkErrorAlarm(TLink lnk,int mode)
  {
    if (eqmTable == null || eqmTable[0] == null || lnk == null) return;
    TEquipmentModule eqm = eqmTable[0]; // take the first one
    TDevice d = eqm.getDeviceList().getDevice(0);
    if (d == null) return;
    short flags = TAlarmDescriptor.NEW;
    if (mode == TMode.CM_SINGLE) flags = TAlarmDescriptor.TRANSIENT;
    d.setAlarm(TAlarm.encodeLinkErrorAlarm(lnk.linkId), lnk.getFullDeviceNameAndProperty().getBytes(), flags);
  }
View Full Code Here

Examples of de.desy.tine.server.devices.TDevice

  }
  public void clearFecLinkErrorAlarm(TLink lnk)
  {
    if (eqmTable == null || eqmTable[0] == null) return;
    TEquipmentModule eqm = eqmTable[0]; // take the first one
    TDevice d = eqm.getDeviceList().getDevice(0);
    if (d == null) return;
    d.removeAlarm(TAlarm.encodeLinkErrorAlarm(lnk.linkId));
  }
View Full Code Here

Examples of de.desy.tine.server.devices.TDevice

    TDataType din = new TDataType();
    TAccess access = new TAccess(TAccess.CA_ALARM + TAccess.CA_READ);
    TAlarmWatchEntry awe = null;
    TAlarmDefinition adef = null;
    TAlarm alm = null;
    TDevice dev = null;
    int cc = 0, cnt = 0, siz = 0, sev = 0, devNr, code = 0, asys = 0;
    String tag = null;
    float fvals[] = null;
    int ivals[] = null;
    byte[] abytes = null;
    synchronized (gAlarmWatchList)
    {
      TEquipmentModuleFactory f = getEquipmentModuleFactory();
      f.setCurrentContractEntry(f.awtcon);
      int awlength = gAlarmWatchList.size();
      for (int i=0; i<awlength; i++)
      {
        awe = (TAlarmWatchEntry)gAlarmWatchList.get(i);
        int chk = awe.checkNormal();
        if (chk != 0)
        {
          ivals = new int[awe.getSiz()];
          dout = new TDataType(ivals);
          cc = callProperty(awe.getPrp(),awe.getDev(),dout,din,access);
        }
        else
        {
          fvals = new float[awe.getSiz()];
          dout = new TDataType(fvals);
          cc = callProperty(awe.getPrp(),awe.getDev(),dout,din,access);
        }
        if (cc != 0) continue;
        boolean hasAlarm = false;
        devNr = deviceList.getDeviceNumber(awe.getDev());
        cnt = 0; siz = awe.getSiz();
        for (int j=0; j<siz; j++)
        {
          if (awe.getAtyp() == TArrayType.AT_CHANNEL) devNr = j;
          if (awe.getAtyp() != TArrayType.AT_WAVEFORM && siz == deviceList.getNumberOfDevices())
            devNr = j; /* assume array of devices */
          dev = deviceList.getDevice(devNr);
          hasAlarm = false;
          if (ivals != null)
          {   
            int nval = awe.getNormal();
            if ((chk == 1 && nval != (awe.getMask() & ivals[j])) ||
                (chk == -1 && nval == (awe.getMask() & ivals[j])) )
            {
             if (TEquipmentModuleFactory.debugLevel > 1)
               DbgLog.log("checkAlarmsInWatchTable", awe.getPrp()+" "+awe.getDev()+
                   " alarm state ! : "+(awe.getMask() & ivals[j])+" vs "+nval);
              code = awe.getCode();
              if (code == 0) code = TErrorList.invalid_data;
              sev = awe.getSev();
              asys = awe.getAsys();
              hasAlarm = true;
            }
            abytes = Swap.LongToBytes(ivals[j]);
          }
          else if (fvals != null)
          {
            if (fvals[j] > awe.getHi())
            {
              if (TEquipmentModuleFactory.debugLevel > 1)
                DbgLog.log("checkAlarmsInWatchTable", awe.getPrp()+" "+awe.getDev()+
                    " alarm state ! : "+fvals[j]+" > "+awe.getHi());
              code = awe.getCode();
              if (code == 0) code = awe.getCodeHigh();
              if (code == 0) code = TErrorList.value_too_high;
              sev = awe.getSev();
              asys = awe.getAsys();
              tag = awe.getTagHigh();
              hasAlarm = true;
            }
            else if (fvals[j] > awe.getHiwarn())
            {
              if (TEquipmentModuleFactory.debugLevel > 1)
                DbgLog.log("checkAlarmsInWatchTable", awe.getPrp()+" "+awe.getDev()+
                    " warn state ! : "+fvals[j]+" > "+awe.getHiwarn());
              code = awe.getCode();
              if (code == 0) code = awe.getCodeHigh();
              if (code == 0) code = TErrorList.warn_too_high;         
              sev = awe.getSev()-2;
              asys = awe.getAsys();
              tag = awe.getTagHigh();
              hasAlarm = true;
            }
            else if (fvals[j] < awe.getLo())
            {
              if (TEquipmentModuleFactory.debugLevel > 1)
                DbgLog.log("checkAlarmsInWatchTable", awe.getPrp()+" "+awe.getDev()+
                    " alarm state ! : "+fvals[j]+" < "+awe.getLo());
              code = awe.getCode();
              if (code == 0) code = awe.getCodeLow();
              if (code == 0) code = TErrorList.value_too_low;         
              sev = awe.getSev();
              asys = awe.getAsys();
              tag = awe.getTagLow();
              hasAlarm = true;
            }
            else if (fvals[j] < awe.getLowarn())
            {
              if (TEquipmentModuleFactory.debugLevel > 1)
                DbgLog.log("checkAlarmsInWatchTable", awe.getPrp()+" "+awe.getDev()+
                    " warn state ! : "+fvals[j]+" < "+awe.getLowarn());
              code = awe.getCode();
              if (code == 0) code = awe.getCodeLow();
              if (code == 0) code = TErrorList.warn_too_low;         
              sev = awe.getSev()-2;
              asys = awe.getAsys();
              tag = awe.getTagLow();
              hasAlarm = true;
            }
            abytes = Swap.Float(fvals[j]);
          }
          if (!hasAlarm)
          { // run through clearAlarm()
            dev.clearAlarm(TErrorList.invalid_data,awe);
            dev.clearAlarm(TErrorList.value_too_high,awe);
            dev.clearAlarm(TErrorList.value_too_low,awe);
            dev.clearAlarm(TErrorList.warn_too_high,awe);
            dev.clearAlarm(TErrorList.warn_too_low,awe);
            if (awe.getCode() > 0) dev.clearAlarm(awe.getCode(),awe);
            if (awe.getCodeHigh() > 0) dev.clearAlarm(awe.getCodeHigh(),awe);
            if (awe.getCodeLow() > 0) dev.clearAlarm(awe.getCodeLow(),awe);
            continue;
          }
          if (code == 0) continue;
          if (!awe.isPastFilter()) continue;
          cnt = awe.getCnt() + 1;
          awe.setCnt(cnt);
          if (cnt > awe.getCntThreshold() && dev != null)
          {
            alm = dev.setAlarm(code,abytes,awe);
            if (alm != null)
            {
              adef = alm.getAlmDef();
              if (sev != 0) adef.setAlarmSeverity(sev);
              if (asys != 0) adef.setAlarmSystem(asys);
View Full Code Here

Examples of de.desy.tine.server.devices.TDevice

   * Registers the equipment module's stock properties
   */
  private int prpQueryCall(String devName, TDataType dout, TDataType din, TAccess devAccess)
  { // use in calls for "PROPS" or "PROPERTIES"
    int cc = 0;
    TDevice dev = getDeviceList().getDevice(devName);
    LinkedList<String> lst = null;
    boolean checkWildCard = (devName.compareTo("*") != 0 && devName.indexOf("*") != -1);
   
    if (dev != null && (lst=dev.getPropertyList()) != null)
    {
      propertyList.setDeviceOriented(true);
      String[] slst = new String[lst.size()];
      lst.toArray(slst);
      if (checkWildCard) slst = StringToName.matchStringsInArray(slst,devName);
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.