Examples of DeviceAttribute


Examples of fr.esrf.TangoApi.DeviceAttribute

    assertTrue((upButtons.size() == 8) & (downButtons.size() == 8));

    // initialiser l'attribut
    final double value = 1111.222;
    m_deviceProxy
        .write_attribute(new DeviceAttribute(attributeName, value));
    assertTrue(waitLabelText(label, formatValue(value, format), 5000));

    final KeyListener keyListener = ((WheelSwitch) tth.findFirstComponent(
        WheelSwitch.class, widget)).getKeyListeners()[0];
View Full Code Here

Examples of fr.esrf.TangoApi.DeviceAttribute

    assertNotNull("can't find label");

    // v�rifier que la valeur courante de l'attribut est bien affich�e
    double value = 1234.567;
    m_deviceProxy
        .write_attribute(new DeviceAttribute(attributeName, value));
    final String format = "%7.3f";
    assertTrue(waitLabelText(label, formatValue(value, format), 5000));

    // stop widget and check is disconected
    widget.stop();
    Sleeper.SECONDS.sleep(2);
    assertEquals("+X.XX", label.getText());

    // restart and bean show the same value as device
    widget.start();
    Sleeper.SECONDS.sleep(2);
    assertTrue(waitLabelText(label, formatValue(value, format), 5000));

    // test write ok after restart
    value = 1234.568;
    m_deviceProxy
        .write_attribute(new DeviceAttribute(attributeName, value));
    assertTrue("write failed after restart",
        waitLabelText(label, formatValue(value, format), 5000));

    widget.stop();
    jf1.dispose();
View Full Code Here

Examples of fr.esrf.TangoApi.DeviceAttribute

                    // Trajectories.
                    // Builds the array from the list.
                    allActuatorsPositionsArray = toDoubleArray(allActuatorsPositionsList);
                    // Sends the array to Tango.
                    DeviceAttribute trajectoriesAttribute = new DeviceAttribute("trajectories");
                    if (enabledActuatorsNumber != 0) {
                        trajectoriesAttribute.insert(allActuatorsPositionsArray, totalStepsNumber,
                                enabledActuatorsNumber);
                    }
                    else {
                        trajectoriesAttribute.insert(new double[] {}, 0, 1);
                    }
                    scanServerProxy.write_attribute(trajectoriesAttribute);

                    // Speed.
                    speedArray = toDoubleArray(speedList);
                    setAttribute("scanSpeed", speedArray);

                    // Actuator delay.
                    double actuatorsDelay = config.getActuatorsDelay();
                    setAttribute("actuatorsDelay", actuatorsDelay);

                    // Zig zag.
                    boolean zigzag = config.isZigzag();
                    setAttribute("zigzag", zigzag);

                    // Enable actuator speed.
                    boolean enableScanSpeed = config.isEnableScanSpeed();
                    setAttribute("enableScanSpeed", enableScanSpeed);

                    // Post scan behaviour.
                    IPostScanBehaviour postScanBehaviour = config.getScanAddOn()
                            .getPostScanBehaviour();
                    Behaviour behaviour = postScanBehaviour.getBehaviour();
                    if (behaviour == null) {
                        behaviour = Behaviour.NOOP;
                    }
                    int behaviourType = behaviour.getType();
                    setAttribute("afterRunActionType", behaviourType);
                    if (behaviour.getArgumentCount() >= 1) {
                        int behaviourSensorIndex = postScanBehaviour.getSensor();
                        setAttribute("afterRunActionSensor", behaviourSensorIndex);
                    }
                    else if (behaviour.getArgumentCount() >= 2) {
                        int behaviourActuatorIndex = postScanBehaviour.getActuator();
                        setAttribute("afterRunActionActuator", behaviourActuatorIndex);
                    }

                    // Error strategies.
                    if (config.getScanAddOn() != null
                            && config.getScanAddOn().getErrorStrategy() != null) {

                        IErrorStrategy errorStrat = config.getScanAddOn().getErrorStrategy();
                        IErrorStrategyItem[] categoriesESI = new IErrorStrategyItem[] {
                                errorStrat.getActuatorsErrorStrategy(),
                                errorStrat.getSensorsErrorStrategy(),
                                errorStrat.getTimebasesErrorStrategy(),
                                errorStrat.getHooksErrorStrategy() };
                        String[] categoriesStr = new String[] { "actuators", "sensors",
                                "timebases", "hooks" };

                        for (int i = 0; i < categoriesStr.length; i++) {
                            String cat = categoriesStr[i];
                            IErrorStrategyItem esi = categoriesESI[i];

                            double errorStrategyTimeOut = esi.getTimeOut();
                            int errorStrategyRetryCount = esi.getRetryCount();
                            double errorStrategyRetryTimeOut = esi.getTimeBetweenRetries();
                            int errorStrategyType = esi.getStrategy().ordinal();

                            // Time out.
                            scanServerProxy.write_attribute(new DeviceAttribute(cat + "TimeOut",
                                    errorStrategyTimeOut));
                            // Retry count.
                            scanServerProxy.write_attribute(new DeviceAttribute(cat + "RetryCount",
                                    errorStrategyRetryCount));
                            // Retry time out.
                            scanServerProxy.write_attribute(new DeviceAttribute(cat
                                    + "RetryTimeOut", errorStrategyRetryTimeOut));
                            // Error strategy.
                            scanServerProxy.write_attribute(new DeviceAttribute(cat
                                    + "ErrorStrategy", errorStrategyType));
                        }
                        // Context validation error strategy.
                        scanServerProxy.write_attribute(new DeviceAttribute(
                                "contextValidationErrorStrategy", errorStrat
                                        .getContextValidationStrategy().ordinal()));

                        scanServerProxy.write_attribute(new DeviceAttribute("contextValidation",
                                errorStrat.getContextValidationDevice()));
                    }

                    /* Hooks */
                    SetHooks(config.getScanAddOn(), scanServerProxy);
View Full Code Here

Examples of fr.esrf.TangoApi.DeviceAttribute

                ITrajectoryK trajectoryK = config.getDimensionX().getRangeX().getTrajectory();
                double[] trajectoriesPositionsArray = TrajectoryCalculator.calculateKTrajectoriesPosition(trajectoryK);
                double[] integrationsTimesArray = TrajectoryCalculator.calculateIntegrationTimesK(trajectoryK);
                int pointNumber = trajectoriesPositionsArray.length;
                setAttribute("pointNumber", pointNumber);
                DeviceAttribute trajectoriesAttribute = new DeviceAttribute("trajectories");
                trajectoriesAttribute.insert(trajectoriesPositionsArray, pointNumber, 1);
                scanServerProxy.write_attribute(trajectoriesAttribute);
                setAttribute("integrationTimes", integrationsTimesArray);
               
                // Actuator delay.
                double actuatorsDelay = config.getActuatorsDelay();
                setAttribute("actuatorsDelay", actuatorsDelay);
               
                // Zig zag.
                boolean zigzag = config.isZigzag();
                setAttribute("zigzag", zigzag);
               
                // Enable actuator speed.
                boolean enableScanSpeed = config.isEnableScanSpeed();
                setAttribute("enableScanSpeed", enableScanSpeed);
               
                // Post scan behaviour.
                IPostScanBehaviour postScanBehaviour = config.getScanAddOn().getPostScanBehaviour();
                Behaviour behaviour = postScanBehaviour.getBehaviour();
                if(behaviour == null) {
                    behaviour = Behaviour.NOOP;
                }
                int behaviourType = behaviour.getType();
                setAttribute("afterRunActionType", behaviourType);
                if(behaviour.getArgumentCount() >= 1) {
                    int behaviourSensorIndex = postScanBehaviour.getSensor();
                    setAttribute("afterRunActionSensor", behaviourSensorIndex);
                }
                else if(behaviour.getArgumentCount() >= 2) {
                    int behaviourActuatorIndex = postScanBehaviour.getActuator();
                    setAttribute("afterRunActionActuator", behaviourActuatorIndex);
                }
               
                // Error strategies.
                if(config.getScanAddOn() != null
                        && config.getScanAddOn().getErrorStrategy() != null) {
                   
                    IErrorStrategy errorStrat = config.getScanAddOn().getErrorStrategy();
                    IErrorStrategyItem[] categoriesESI = new IErrorStrategyItem[] {
                            errorStrat.getActuatorsErrorStrategy()
                            , errorStrat.getSensorsErrorStrategy()
                            , errorStrat.getTimebasesErrorStrategy()
                            , errorStrat.getHooksErrorStrategy()
                    };
                String [] categoriesStr = new String[] {
                        "actuators"
                        , "sensors"
                        , "timebases"
                        , "hooks" };
               
                for(int i=0; i<categoriesStr.length; i++) {
                    String cat = categoriesStr[i];
                    IErrorStrategyItem esi = categoriesESI[i];
                   
                    double errorStrategyTimeOut = esi.getTimeOut();
                    int errorStrategyRetryCount = esi.getRetryCount();
                    double errorStrategyRetryTimeOut = esi.getTimeBetweenRetries();
                    int errorStrategyType = esi.getStrategy().ordinal();
                   
                    // Time out.
                    scanServerProxy.write_attribute(new DeviceAttribute(cat + "TimeOut", errorStrategyTimeOut));
                    // Retry count.
                    scanServerProxy.write_attribute(new DeviceAttribute(cat + "RetryCount", errorStrategyRetryCount));
                    // Retry time out.
                    scanServerProxy.write_attribute(new DeviceAttribute(cat + "RetryTimeOut", errorStrategyRetryTimeOut));
                    // Error strategy.
                    scanServerProxy.write_attribute(new DeviceAttribute(cat + "ErrorStrategy", errorStrategyType));
                }
                // Context validation error strategy.
                scanServerProxy.write_attribute(
                        new DeviceAttribute("contextValidationErrorStrategy", errorStrat.getContextValidationStrategy().ordinal()));
               
                scanServerProxy.write_attribute(
                        new DeviceAttribute("contextValidation", errorStrat.getContextValidationDevice()));
                }
               
                /* Hooks */
                SetHooks(config.getScanAddOn(), scanServerProxy);
               
View Full Code Here

Examples of fr.esrf.TangoApi.DeviceAttribute

                // Trajectories.
                // Builds the array from the list.
                allActuatorsPositionsArray = toDoubleArray(allActuatorsPositionsList);
                // Sends the array to Tango.
                DeviceAttribute trajectoriesAttribute = new DeviceAttribute("trajectories");
                if (enabledActuatorsNumber != 0) {
                    trajectoriesAttribute.insert(allActuatorsPositionsArray, totalStepsNumber,
                            enabledActuatorsNumber);
                }
                else {
                    trajectoriesAttribute.insert(new double[] {}, 0, 1);
                }
                scanServerProxy.write_attribute(trajectoriesAttribute);

                // Speed.
                speedArray = toDoubleArray(speedList);
                setAttribute("scanSpeed", speedArray);

                // Actuator delay.
                double actuatorsDelay = config.getActuatorsDelay();
                setAttribute("actuatorsDelay", actuatorsDelay);

                // Zig zag.
                boolean zigzag = config.isZigzag();
                setAttribute("zigzag", zigzag);

                // Enable actuator speed.
                boolean enableScanSpeed = config.isEnableScanSpeed();
                setAttribute("enableScanSpeed", enableScanSpeed);

                // Post scan behaviour.
                IPostScanBehaviour postScanBehaviour = config.getScanAddOn().getPostScanBehaviour();
                Behaviour behaviour = postScanBehaviour.getBehaviour();
                if (behaviour == null) {
                    behaviour = Behaviour.NOOP;
                }
                int behaviourType = behaviour.getType();
                setAttribute("afterRunActionType", behaviourType);
                if (behaviour.getArgumentCount() >= 1) {
                    int behaviourSensorIndex = postScanBehaviour.getSensor();
                    setAttribute("afterRunActionSensor", behaviourSensorIndex);
                }
                else if (behaviour.getArgumentCount() >= 2) {
                    int behaviourActuatorIndex = postScanBehaviour.getActuator();
                    setAttribute("afterRunActionActuator", behaviourActuatorIndex);
                }

                // Error strategies.
                if (config.getScanAddOn() != null
                        && config.getScanAddOn().getErrorStrategy() != null) {

                    IErrorStrategy errorStrat = config.getScanAddOn().getErrorStrategy();
                    IErrorStrategyItem[] categoriesESI = new IErrorStrategyItem[] {
                            errorStrat.getActuatorsErrorStrategy(),
                            errorStrat.getSensorsErrorStrategy(),
                            errorStrat.getTimebasesErrorStrategy(),
                            errorStrat.getHooksErrorStrategy() };
                    String[] categoriesStr = new String[] { "actuators", "sensors", "timebases",
                            "hooks" };

                    for (int i = 0; i < categoriesStr.length; i++) {
                        String cat = categoriesStr[i];
                        IErrorStrategyItem esi = categoriesESI[i];

                        double errorStrategyTimeOut = esi.getTimeOut();
                        int errorStrategyRetryCount = esi.getRetryCount();
                        double errorStrategyRetryTimeOut = esi.getTimeBetweenRetries();
                        int errorStrategyType = esi.getStrategy().ordinal();

                        // Time out.
                        scanServerProxy.write_attribute(new DeviceAttribute(cat + "TimeOut",
                                errorStrategyTimeOut));
                        // Retry count.
                        scanServerProxy.write_attribute(new DeviceAttribute(cat + "RetryCount",
                                errorStrategyRetryCount));
                        // Retry time out.
                        scanServerProxy.write_attribute(new DeviceAttribute(cat + "RetryTimeOut",
                                errorStrategyRetryTimeOut));
                        // Error strategy.
                        scanServerProxy.write_attribute(new DeviceAttribute(cat + "ErrorStrategy",
                                errorStrategyType));
                    }
                    // Context validation error strategy.
                    scanServerProxy.write_attribute(new DeviceAttribute(
                            "contextValidationErrorStrategy", errorStrat
                                    .getContextValidationStrategy().ordinal()));

                    scanServerProxy.write_attribute(new DeviceAttribute("contextValidation",
                            errorStrat.getContextValidationDevice()));
                }

                /* Hooks */
                SetHooks(config.getScanAddOn(), scanServerProxy);
View Full Code Here

Examples of fr.esrf.TangoApi.DeviceAttribute

            // Add Actuator list
            if (TangoAttributeHelper.isAttributeRunning(deviceName, ACTUATORS_ATTRIBUTE)) {
                DeviceProxy proxy = TangoDeviceHelper.getDeviceProxy(deviceName);
                try {
                    DeviceAttribute deviceAttribute = proxy.read_attribute(ACTUATORS_ATTRIBUTE);
                    String[] attributeList = deviceAttribute.extractStringArray();
                    IDimension dimension = config.getDimensionX();
                    if (dimension != null) {
                        List<IActuator> actuatorList = dimension.getActuatorsList();
                        // Check if the actuators are not already defined
                        // Then add
                        for (String actuatorName : attributeList) {
                            if (!isDeviceBelongToList(actuatorName, actuatorList)) {
                                config.addActuator(actuatorName, false);
                            }
                        }
                    }
                }
                catch (Exception e) {
                }
            }

            // Add Sensor list
            if (TangoAttributeHelper.isAttributeRunning(deviceName, SENSORS_ATTRIBUTE)) {
                DeviceProxy proxy = TangoDeviceHelper.getDeviceProxy(deviceName);
                try {
                    DeviceAttribute deviceAttribute = proxy.read_attribute(SENSORS_ATTRIBUTE);
                    String[] attributeList = deviceAttribute.extractStringArray();
                    List<ISensor> sensorList = config.getSensorsList();
                    String completeSensorName = null;
                    for (String sensorName : attributeList) {
                        completeSensorName = deviceName + "/" + sensorName;
                        if (!isDeviceBelongToList(completeSensorName, sensorList)) {
View Full Code Here

Examples of fr.esrf.TangoApi.DeviceAttribute

     * @throws SalsaDeviceException
     */
    public static Double getData(IDevice device) throws SalsaDeviceException {
        Double data;
        if (device != null && device.getName() != null && !"".equals(device.getName().trim())) {
            DeviceAttribute attribute = getDeviceAttribute(device);
            if (attribute != null) {
                try {
                    data = AttributeHelper.extractToDouble(attribute);

                }
View Full Code Here

Examples of fr.esrf.TangoApi.DeviceAttribute

     * @return
     * @throws SalsaDeviceException
     */
    public static void setData(IDevice device, Double data) throws SalsaDeviceException {
        if (device != null && device.getName() != null && !"".equals(device.getName().trim())) {
            DeviceAttribute attribute = getDeviceAttribute(device);
            if (attribute != null) {
                try {
                    AttributeHelper.insertFromDouble(data, attribute);
                    writeAttribute(device, attribute);
                }
View Full Code Here

Examples of fr.esrf.TangoApi.DeviceAttribute

     * @return
     * @throws SalsaDeviceException
     */
    public static void setData(IDevice device, Double[] dataArray) throws SalsaDeviceException {
        if (device != null && device.getName() != null && !"".equals(device.getName().trim())) {
            DeviceAttribute attribute = getDeviceAttribute(device);
            if (attribute != null) {
                int length = dataArray.length;
                double[] doubleArray = new double[length];
                for (int index = 0; index < length; ++index) {
                    doubleArray[index] = dataArray[index].doubleValue();
View Full Code Here

Examples of fr.esrf.TangoApi.DeviceAttribute

     * @return
     * @throws SalsaDeviceException
     */
    public static void setData(IDevice device, Double[][] dataMatrix) throws SalsaDeviceException {
        if (device != null && device.getName() != null && !"".equals(device.getName().trim())) {
            DeviceAttribute attribute = getDeviceAttribute(device);
            if (attribute != null) {
                int dimY = dataMatrix.length;
                if (dimY != 0) {
                    int dimX = dataMatrix[0].length;
                    int length = dimY * dimX;
 
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.