Package de.desy.tine.server.devices

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


      for( EqmCfg ec : el )
      {
        if (ec.getName().compareTo(eqmName) == 0)
        {   
          LinkedList<NameCfgList> nl = ec.getNameCfgList();
          TDeviceList dlst = getDeviceList();
          if (dlst == null) return TErrorList.device_not_connected;
          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);
View Full Code Here


    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++;
          }
View Full Code Here

    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++;
          }
View Full Code Here

      srData = dt;
      prp = property;
    }
    public int process(int index)
    {
      TDeviceList dlst = getDeviceList();
      if (dlst == null) return TErrorList.device_not_connected;
      int ndevs = dlst.getNumberOfDevices();
      if (ndevs == 0) return TErrorList.device_not_connected;
      if (devNumber < 0 && devNumber >= ndevs) return TErrorList.illegal_equipment_number;
      if (srData == nullreturn TErrorList.not_implemented;
      int i = index;
      int len = srData.getArrayLength();
View Full Code Here

    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++;
          }
View Full Code Here

      for( EqmCfg ec : el )
      {
        if (ec.getName().compareTo(eqmName) == 0)
        {   
          LinkedList<NameCfgList> nl = ec.getNameCfgList();
          TDeviceList dlst = getDeviceList();
          if (dlst == null) return TErrorList.device_not_connected;
          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);
View Full Code Here

      srData = dt;
      prp = property;
    }
    public int process(int index)
    {
      TDeviceList dlst = getDeviceList();
      if (dlst == null) return TErrorList.device_not_connected;
      int ndevs = prp.getSizeOfDeviceList();
      if (ndevs == 0) ndevs = dlst.getNumberOfDevices();
      int devnr = index;
      if (devName.length() > 0)
      { // device name given
        devnr = getDeviceNumber(devName, prp.getName());
        if (devnr < 0) devnr = index;
View Full Code Here

      devName = "";
      prp = property;
    }
    public int process(int index)
    {
      TDeviceList dlst = getDeviceList();
      if (dlst == null) return TErrorList.device_not_connected;
      int ndevs = dlst.getNumberOfDevices();
      if (ndevs == 0) return TErrorList.device_not_connected;
      if (devNumber < 0 && devNumber >= ndevs) return TErrorList.illegal_equipment_number;
      int i = index;
      if (devName.length() > 0)
      { // device name given
        i = getDeviceNumber(devName, prp.getName());
        if (i < 0) i = index;
        if (i > ndevs) return TErrorList.illegal_device;
      }
      TDevice[] devs = dlst.getDeviceList();
      switch (prp.getId())
      {
        case TStockProperties.ZPOSITION_ID:
          devs[i].setZposition(Float.parseFloat(prpValue));
          break;
View Full Code Here

      prp = property;
      isPrpOriented = prp == null ? false : true;
    }
    public int process(int index)
    {
      TDeviceList dlst = getDeviceList();
      if (dlst == null) return TErrorList.device_not_connected;
      int ndevs = dlst.getNumberOfDevices();
      if (ndevs == 0) return TErrorList.device_not_connected;
      if (deviceNumber < 0 && deviceNumber >= ndevs) return TErrorList.illegal_equipment_number;
      if (!isPrpOriented)
      {
        TDevice tdv = dlst.getDevice(deviceNumber);
        if (tdv == null) return TErrorList.device_not_connected;
        String oldName = tdv.getName();
        if (deviceName.compareTo(oldName) != 0)
        {
          dlst.renameDevice(oldName,deviceName);
        }
        if (deviceRedirection != null && deviceRedirection.length() > 0)
        {
          tdv.setRedirection(deviceRedirection);
          deviceRedirection = null; // reset this !
        }
        if (deviceDescription != null && deviceDescription.length() > 0)
        {
          tdv.setDescription(deviceDescription);
          deviceDescription = null; // reset this !
        }
        if (prpListFile != null && prpListFile.length() > 0)
        {
          getRegisteredPropertyListFromFile(tdv,prpListFile);
          propertyList.setDeviceOriented(true);
          prpListFile = null; // reset this !
        }
        if (deviceLocation != null && deviceLocation.length() > 0)
        {
          tdv.setLocation(deviceLocation);
        }
        if (deviceMask != 0) tdv.setMask(deviceMask);
        if (deviceOffline != 0) tdv.setOffline(true);
        if (deviceRegion == null || deviceRegion.length() == 0)
        { // take the common setting if not set per device ...
          deviceRegion = region;
        }
        tdv.setRegion(deviceRegion);
        if (deviceZPosition != 0) tdv.setZposition(deviceZPosition);
      }
      else
      {
        if (prp != null)
        {
          int prplen = prp.getOutputSize();
          ArrayList<String> lst = prp.getDeviceList();
          if (lst == null)
          {
            lst = new ArrayList<String>(prplen);
            prp.setDeviceList(lst)
          }
          if (deviceName.length() == 0)
          {
            deviceName = deviceNameAlt;
            if (deviceNumber == 0) deviceNumber = deviceNumberAlt;
          }
          if (deviceNumber < prplen) lst.add(deviceNumber,deviceName);
          dlst.setPropertyOriented(true);
        }
      }
      return 0;
    }
View Full Code Here

      prp = property;
      isPrpOriented = prp == null ? false : true;
    }
    public int process(int index)
    {
      TDeviceList dlst = getDeviceList();
      if (dlst == null) return TErrorList.device_not_connected;
      int ndevs = dlst.getNumberOfDevices();
      if (ndevs == 0) return TErrorList.device_not_connected;
      if (deviceNumber < 0 && deviceNumber >= ndevs) return TErrorList.illegal_equipment_number;
      if (!isPrpOriented)
      {
        TDevice tdv = dlst.getDevice(deviceNumber);
        if (tdv == null) return TErrorList.device_not_connected;
        String oldName = tdv.getName();
        if (deviceName.compareTo(oldName) != 0)
        {
          dlst.renameDevice(oldName,deviceName);
        }
        if (deviceRedirection != null && deviceRedirection.length() > 0)
        {
          tdv.setRedirection(deviceRedirection);
          deviceRedirection = null; // reset this !
        }
        if (deviceDescription != null && deviceDescription.length() > 0)
        {
          tdv.setDescription(deviceDescription);
          deviceDescription = null; // reset this !
        }
        if (prpListFile != null && prpListFile.length() > 0)
        {
          getRegisteredPropertyListFromFile(tdv,prpListFile);
          propertyList.setDeviceOriented(true);
          prpListFile = null; // reset this !
        }
        if (deviceLocation != null && deviceLocation.length() > 0)
        {
          tdv.setLocation(deviceLocation);
        }
        if (deviceMask != 0) tdv.setMask(deviceMask);
        if (deviceOffline != 0) tdv.setOffline(true);
        if (deviceZPosition != 0) tdv.setZposition(deviceZPosition);
      }
      else
      {
        if (prp != null)
        {
          int prplen = prp.getOutputSize();
          ArrayList<String> lst = prp.getDeviceList();
          if (lst == null)
          {
            lst = new ArrayList<String>(prplen);
            prp.setDeviceList(lst)
          }
          if (deviceName.length() == 0)
          {
            deviceName = deviceNameAlt;
            if (deviceNumber == 0) deviceNumber = deviceNumberAlt;
          }
          if (deviceNumber < prplen) lst.add(deviceNumber,deviceName);
          dlst.setPropertyOriented(true);
        }
      }
      return 0;
    }
View Full Code Here

TOP

Related Classes of de.desy.tine.server.devices.TDeviceList

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.