Package fr.soleil.tango.clientapi

Examples of fr.soleil.tango.clientapi.TangoAttribute


     * Sets an attribute.
     *
     * @param attr
     */
    protected void setAttribute(String attributeName, double[] attributeValue) throws DevFailed {
        new TangoAttribute(scanServerName + "/" + attributeName).write(attributeValue);
    }
View Full Code Here


     *
     * @param attr
     */
    protected void setAttribute(String attributeName, String[] attributeValue) throws DevFailed {

        new TangoAttribute(scanServerName + "/" + attributeName)
                .writeSpectrum((Object[]) attributeValue);
    }
View Full Code Here

    throws SalsaDeviceException {
        if (TangoDeviceHelper.isDeviceRunning(scanServerName)) {
            try {
                DeviceProxy scanServerProxy = TangoDeviceHelper.getDeviceProxy(scanServerName);

                TangoAttribute afterRunActionType = new TangoAttribute(scanServerName + "/afterRunActionType");
                afterRunActionType.write(behaviour.getType());
                // System.out.println("behaviour.getType()=" +
                // behaviour.getType());

                if (sensor != null) {
                    // We need the sensor position.
                    String sensorName = sensor.getName();
                    if ((sensorName != null) && !sensorName.trim().equals("")) {
                        String[] sensorsNamesArray = scanServerProxy.read_attribute("sensors").extractStringArray();
                        int sensorPosition;
                        for (sensorPosition = 0; sensorPosition < sensorsNamesArray.length; ++sensorPosition) {
                            if (sensorName.equals(sensorsNamesArray[sensorPosition])) {
                                break;
                            }
                        }
                        if (sensorPosition < sensorsNamesArray.length) {
                            TangoAttribute afterRunActionSensor = new TangoAttribute(scanServerName
                                    + "/afterRunActionSensor");
                            afterRunActionSensor.write(sensorPosition);
                        } else {
                            throw new SalsaDeviceException("Error : sensor " + sensor.getName()
                                    + " is unknow on the scan server " + scanServerName + ".");
                        }
                    }
                }

                if (actuator != null) {
                    // We need the actuator position.
                    String actuatorName = actuator.getName();
                    if ((actuatorName != null) && !actuatorName.trim().equals("")) {
                        String[] actuatorsNamesArray = scanServerProxy.read_attribute("actuators").extractStringArray();
                        int actuatorPosition;
                        for (actuatorPosition = 0; actuatorPosition < actuatorsNamesArray.length; ++actuatorPosition) {
                            if (actuatorName.equals(actuatorsNamesArray[actuatorPosition])) {
                                break;
                            }
                        }
                        if (actuatorPosition < actuatorsNamesArray.length) {
                            TangoAttribute afterRunActionActuator = new TangoAttribute(scanServerName
                                    + "/afterRunActionActuator");
                            afterRunActionActuator.write(actuatorPosition);
                        } else {
                            throw new SalsaDeviceException("Error : actuator " + actuator.getName()
                                    + " is unknow on the scan server " + scanServerName + ".");
                        }
                    }
View Full Code Here

     */
    public void setDataRecorderPartialMode(String scanServerName, boolean mode) throws SalsaDeviceException {
        dataRecorderPartialMode = mode;
        if (TangoDeviceHelper.isDeviceRunning(scanServerName)) {
            try {
                TangoAttribute tangoAttribute = new TangoAttribute(scanServerName + "/dataRecorderPartialMode");
                tangoAttribute.insert(mode);
                tangoAttribute.write();
            } catch (DevFailed e) {
                // scanServerManager.invalidateScanServerProxy(scanServerName);
                throw new SalsaDeviceException("Error : cannot write " + scanServerName
                        + "/dataRecorderPartialMode to " + mode + DevFailedUtils.toString(e), e);
            }
View Full Code Here

     * @throws SalsaDeviceException
     */
    public static Double getData(IDevice device) throws SalsaDeviceException {
        Double result = Double.NaN;
        try {
            TangoAttribute tangoAttribute = getTangoAttribute(device);
            if (tangoAttribute != null) {
                result = tangoAttribute.extract(Double.class);
            }
        }
        catch (Exception e) {
            // e.printStackTrace();
            SalsaDeviceException salsaDeviceException = new SalsaDeviceException(
View Full Code Here

     * @return The desired {@link TangoAttribute}, or <code>null</code> if device was
     *         <code>null</code> or if its name was <code>null</code> or empty
     * @throws SalsaDeviceException If a problem occurred while accessing the attribute
     */
    private static TangoAttribute getTangoAttribute(IDevice device) throws SalsaDeviceException {
        TangoAttribute result = null;
        if (device != null) {
            result = getTangoAttribute(device.getName());
        }
        return result;
    }
View Full Code Here

     *         <code>null</code> or empty
     * @throws SalsaDeviceException If a problem occurred while accessing the attribute
     */
    private static TangoAttribute getTangoAttribute(String completeName)
    throws SalsaDeviceException {
        TangoAttribute result = null;
        if ((completeName != null) && !completeName.isEmpty()) {
            try {
                result = new TangoAttribute(completeName);
            }
            catch (DevFailed e) {
                SalsaDeviceException salsaDeviceException = new SalsaDeviceException(
                        "Error while creating a TangORB attribute proxy for attribute " + completeName, e);
                throw salsaDeviceException;
View Full Code Here

     *
     * @param attr
     */
    protected void setAttribute(String attributeName, boolean attributeValue, boolean testIfIsRunning) throws DevFailed {
        if (!testIfIsRunning || TangoAttributeHelper.isAttributeRunning(scanServerName, attributeName)) {
            new TangoAttribute(scanServerName + "/" + attributeName).write(attributeValue);
        }
    }
View Full Code Here

     *
     * @param attr
     */
    protected void setAttribute(String attributeName, int attributeValue, boolean testIfIsRunning) throws DevFailed {
        if (!testIfIsRunning || TangoAttributeHelper.isAttributeRunning(scanServerName, attributeName)) {
            new TangoAttribute(scanServerName + "/" + attributeName).write(attributeValue);
        }
    }
View Full Code Here

     *
     * @param attr
     */
    protected void setAttribute(String attributeName, double attributeValue, boolean testIfIsRunning) throws DevFailed {
        if (!testIfIsRunning || TangoAttributeHelper.isAttributeRunning(scanServerName, attributeName)) {
            new TangoAttribute(scanServerName + "/" + attributeName).write(attributeValue);
        }
    }
View Full Code Here

TOP

Related Classes of fr.soleil.tango.clientapi.TangoAttribute

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.