Package fr.esrf.TangoApi

Examples of fr.esrf.TangoApi.AttributeInfo


     * @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

     * @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

        // adjust axes' values to fit attributes' range
        // this only happens once, when connecting to the attribute
        try {
            DeviceProxy proxy = new DeviceProxy(getDeviceName());

            AttributeInfo xInfo = proxy.get_attribute_info(getXAttributeName());
            double max_x_value = Double.parseDouble(xInfo.max_value);
            if (max_x_value > xProp.getScaleMax()) {
                xProp.setScaleMax(max_x_value);
            }
            double min_x_value = Double.parseDouble(xInfo.min_value);
            if (min_x_value < xProp.getScaleMin()) {
                xProp.setScaleMin(min_x_value);
            }

            AttributeInfo yInfo = proxy.get_attribute_info(getYAttributeName());
            double max_y_value = Double.parseDouble(yInfo.max_value);
            if (max_y_value > y1Prop.getScaleMax()) {
                y1Prop.setScaleMax(max_y_value);
            }
            double min_y_value = Double.parseDouble(yInfo.min_value);
View Full Code Here

        // adjust axes' values to fit attributes' range
        // this only happens once, when connecting to the attribute
        try {
            DeviceProxy proxy = new DeviceProxy(getDeviceName());

            AttributeInfo xInfo = proxy.get_attribute_info(getXAttributeName());
            double max_x_value = Double.parseDouble(xInfo.max_value);
            if (max_x_value > xProp.getScaleMax()) {
                xProp.setScaleMax(max_x_value);
            }
            double min_x_value = Double.parseDouble(xInfo.min_value);
            if (min_x_value < xProp.getScaleMin()) {
                xProp.setScaleMin(min_x_value);
            }

            AttributeInfo yInfo = proxy.get_attribute_info(getYAttributeName());
            double max_y_value = Double.parseDouble(yInfo.max_value);
            if (max_y_value > y1Prop.getScaleMax()) {
                y1Prop.setScaleMax(max_y_value);
            }
            double min_y_value = Double.parseDouble(yInfo.min_value);
View Full Code Here

    final String attName = "double_scalar_rw";
    Double number = 76.11;
    initFirstDevice();

    // Prepare device attribute value and format
    final AttributeInfo attInfo = m_deviceProxy.get_attribute_info(attName);
    attInfo.format = "%6.2f";
    m_deviceProxy.set_attribute_info(new AttributeInfo[] { attInfo });
    m_deviceProxy.write_attribute(new DeviceAttribute(attName, number));

    // Component initialization
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.