Examples of TDevice


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

  {
    if (numberOfDevices <= 0) return;
    TDevice[] devices = new TDevice[numberOfDevices];
    for (int i=0; i<numberOfDevices; i++)
    {
      devices[i] = new TDevice(i);
      devices[i].setEqm(this);
      deviceList.addDevice(devices[i]);
    }
  }
View Full Code Here

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

                catch (Exception ignore) {}; // then mask stays = 0
              }
            }
            if (chkOn || chkMask)
            {
              TDevice dev;
              LinkedList<String> dl = new LinkedList<String>();
              for (int i=0; i<deviceList.getNumberOfDevices(); i++)
              {
                if ((dev=deviceList.getDevice(i)) == null) continue;
                if (chkOn && dev.isOffline()) continue;
                if (chkMask && !dev.isMaskSet(mask)) continue;
                dl.add(dev.getName());
              }
              slst = dl.toArray(new String[0]);
            }
          }
          return (short)dout.putData(StringToName.stringArrayToName64(slst));
View Full Code Here

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

          int ndevs = dlst.getNumberOfDevices();
          if (ndevs == 0) return TErrorList.device_not_connected;
          LinkedList<DeviceCfg> dl = ec.getDeviceList();
          for (DeviceCfg dc : dl)
          {
            TDevice tdv = dlst.getDevice(dc.getNumber().getValue());
            if (tdv == null) return TErrorList.device_not_connected;
            prpSet = dc.getPropertySet();
            if (prpSet != null && prpSet.length() > 0)
            { // is there a device-specific property list ?
              for (NameCfgList nc : nl)
              { // yes ! find it
                if (nc.getName().compareToIgnoreCase(prpSet) == 0)
                { // assign the names list
                  tdv.setPropertyList(nc.getMembers());
                }
              }
              propertyList.setDeviceOriented(true);
            }
            String oldName = tdv.getName();
            if (dc.getName().compareTo(oldName) != 0)
            {
              dlst.renameDevice(oldName,dc.getName());
            }
            deviceRedirection = dc.getRedirection();
            if (deviceRedirection != null && deviceRedirection.length() > 0)
            {
              tdv.setRedirection(deviceRedirection);
              deviceRedirection = null; // reset this !
            }
            deviceDescription = dc.getDescription();
            if (deviceDescription != null && deviceDescription.length() > 0)
            {
              tdv.setDescription(deviceDescription);
              deviceDescription = null; // reset this !
            }
          }
          break;
        }
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);

    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, tct.din, 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, tct.din, 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, tct.din, 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

      tgtProperty = TMetaProperties.getTargetProperty(ts.contract.eqmProperty);
      if (pl.hasProperty(ts.contract.eqmProperty))
        chkFullPropertyForRedirection = true;
    }
    // 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
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.