Package fr.esrf.TangoApi

Examples of fr.esrf.TangoApi.AttributeInfo


     * @return
     * @throws SalsaDeviceException
     */
    private static AttributeInfo getAttributeInfo(DeviceProxy proxy, String attributeName)
            throws SalsaDeviceException {
        AttributeInfo info;
        try {
            info = proxy.get_attribute_info(attributeName);
        }
        catch (DevFailed e) {
            e.printStackTrace();
View Full Code Here


    }

    public static IReadWriteAccess getReadWriteAccess(IDevice device) throws SalsaDeviceException {
        IReadWriteAccess rwa = new ReadWriteAccessImpl();
        if (device != null && device.getName() != null && !"".equals(device.getName().trim())) {
            AttributeInfo info = getAttributeInfo(device);
            if (info != null) {

                rwa.setReadable(true);

                if (info.writable != AttrWriteType.READ) {
View Full Code Here

     * @return
     * @throws SalsaDeviceException
     */
    public static DimensionType getDimensionType(IDevice device) throws SalsaDeviceException {
        DimensionType dimensionType;
        AttributeInfo info = getAttributeInfo(device);
        switch (info.data_format.value()) {
            case AttrDataFormat._SCALAR:
                dimensionType = DimensionType.SCALAR;
                break;
            case AttrDataFormat._SPECTRUM:
View Full Code Here

        String deviceName = name.substring(0, separatorPos);
        String attributeName = name.substring(separatorPos + 1);

        DeviceProxy proxy = getDeviceProxy(deviceName);
        TangoAttribute attribute = getTangoAttribute(proxy.get_name() + "/" + attributeName);
        AttributeInfo info = getAttributeInfo(proxy, attributeName);
        // Report.

        // Readable / writable.
        boolean readable;
        boolean writeable;
        switch (info.writable.value()) {
            case AttrWriteType._READ:
                readable = true;
                writeable = false;
                break;
            case AttrWriteType._READ_WITH_WRITE:
            case AttrWriteType._READ_WRITE:
                readable = true;
                writeable = true;
                break;
            case AttrWriteType._WRITE:
                readable = false;
                writeable = true;
                break;
            default:
                // Normally impossible.
                throw new SalsaDeviceException("Unknown write type for the device " + name + ".");
        }
        report.setReadable(readable);
        report.setWriteable(writeable);

        // Data and data format.
        try {
            TangoAttribute tangoAttribute = new TangoAttribute(name);
            String format = null;
            try {
                AttributeProxy attributeProxy = tangoAttribute.getAttributeProxy();
                if (attributeProxy != null) {
                    AttributeInfo attributeInfo = attributeProxy.get_info();
                    if (attributeInfo != null) {
                        format = attributeInfo.format;
                    }
                }
            }
View Full Code Here

        if (referenceAxis.equals(DiplayManagerTableModel.AXIS_2D)) {

          final DeviceAttribute deviceAttribute = proxy.read_attribute(SENSORS_DATA_LIST);
          final String[] sensorList = deviceAttribute.extractStringArray();

          AttributeInfo info;

          for (final String element : sensorList) {
            info = proxy.get_attribute_info(element);
            final Vector<String> row = new Vector<String>();
            row.add(info.label);
            rows.add(row);

            if (info.equals(sensorName)) {
              dataModelMap.put(element, new DataModel(element, info.label, "Z"));
              defaultValue = false;
            } else {
              dataModelMap.put(element, new DataModel(element, info.label, ""));

            }
          }

          // set the first sensor by default
          if (defaultValue) {
            info = proxy.get_attribute_info(sensorList[0]);
            dataModelMap.put(sensorList[0], new DataModel(sensorList[0], info.label, "Z"));
            sensorName = info.label;
          }

          final Vector<String> columnText = new Vector<String>();
          columnText.add("Attribute name");
          columnText.add("2D");

          tableModel.setDataVector(rows, columnText);

          if (mainTable.getColumnModel().getColumnCount() > 0) {
            mainTable.getColumnModel().getColumn(0).setCellRenderer(new TableColumnRenderer());

            final JComboBox combo = new JComboBox(new String[] { "", referenceAxis });
            final ComboBoxEditor comboBoxCell = new ComboBoxEditor(combo);
            if (mainTable.getColumnModel().getColumnCount() > 1) {
              mainTable.getColumnModel().getColumn(1).setCellEditor(comboBoxCell);
            }
          }
        } else {// 1D

          // add TimeStamps

          final Vector<String> rowTimestamps = new Vector<String>();
          rowTimestamps.add(SENSORS_TIMESTAMPS);
          rows.add(rowTimestamps);
          dataModelMap.put(SENSORS_TIMESTAMPS, new DataModel(SENSORS_TIMESTAMPS, SENSORS_TIMESTAMPS, ""));

          // add actuator
          DeviceAttribute deviceAttribute = proxy.read_attribute(ACTUATORS_DATA_LIST);
          final String[] actuatorList = deviceAttribute.extractStringArray();

          AttributeInfo info;

          for (final String element : actuatorList) {
            info = proxy.get_attribute_info(element);
            final Vector<String> row = new Vector<String>();
            row.add(info.label);
            rows.add(row);

            if (info.equals(actuatorName)) {
              dataModelMap.put(element, new DataModel(element, info.label, "X"));
              defaultValue = false;
            } else {
              dataModelMap.put(element, new DataModel(element, info.label, ""));
            }
View Full Code Here

     * @throws SalsaDeviceException
     */
    public static String getFormat(IDevice device) throws SalsaDeviceException {
        String format;
        if (device != null && device.getName() != null && !"".equals(device.getName().trim())) {
            AttributeInfo info = getAttributeInfo(device);
            if (info != null) {
                format = info.format;
            }
            else {
                format = null;
View Full Code Here

     * @throws SalsaDeviceException
     */
    public static boolean getReadOnly(IDevice device) throws SalsaDeviceException {
        boolean readOnly;
        if (device != null && device.getName() != null && !"".equals(device.getName().trim())) {
            AttributeInfo info = getAttributeInfo(device);
            if (info != null) {
                readOnly = info.writable == AttrWriteType.READ;
            }
            else {
                readOnly = false;
View Full Code Here

        String attributeName = name.substring(separatorPos + 1);
        DeviceProxy proxy = getDeviceProxy(device);
        if (proxy == null) {
            return null;
        }
        AttributeInfo info = getAttributeInfo(proxy, attributeName);
        return info;
    }
View Full Code Here

     * @return
     * @throws SalsaDeviceException
     */
    private static AttributeInfo getAttributeInfo(DeviceProxy proxy, String attributeName)
            throws SalsaDeviceException {
        AttributeInfo info;
        try {
            info = proxy.get_attribute_info(attributeName);
        }
        catch (DevFailed e) {
            e.printStackTrace();
View Full Code Here

    }

    public static IReadWriteAccess getReadWriteAccess(IDevice device) throws SalsaDeviceException {
        IReadWriteAccess rwa = new ReadWriteAccessImpl();
        if (device != null && device.getName() != null && !"".equals(device.getName().trim())) {
            AttributeInfo info = getAttributeInfo(device);
            if (info != null) {

                rwa.setReadable(true);

                if (info.writable != AttrWriteType.READ) {
View Full Code Here

TOP

Related Classes of fr.esrf.TangoApi.AttributeInfo

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.