Package fr.soleil.salsa.entity

Examples of fr.soleil.salsa.entity.IScanResult


     * @throws SalsaScanConfigurationException If the Scan Server Scan Type is not supported
     * @throws ScanDeviceException If a problem occurred while reading scan result
     */
    public static IScanResult readScanResult(String scanServerName) throws SalsaDeviceException,
    SalsaScanConfigurationException {
        IScanResult result = ScanApi.readScanResult(scanServerName);
        LOGGER.info("{}.readScanResult({})={}", SalsaAPI.class.getSimpleName(), scanServerName, result);
        return result;
    }
View Full Code Here


     * @throws SalsaScanConfigurationException If the Scan Server Scan Type is not supported
     * @throws ScanDeviceException If a problem occurred while reading scan result
     */
    public static IScanResult readScanResultWithTrajectories(String scanServerName) throws SalsaDeviceException,
    SalsaScanConfigurationException {
        IScanResult result = ScanApi.readScanResult(scanServerName, true);
        LOGGER.info("{}.readScanResultWithTrajectories({})={}", SalsaAPI.class.getSimpleName(), scanServerName, result);
        return result;
    }
View Full Code Here

        return actuatorTrajectoriesList;
    }

    public IScanResult retrieveCommonScanResult() throws SalsaDeviceException {
        // System.out.println(this.getClass().getName() + ".retrieveCommonScanResult");
        IScanResult scanResult = null;
        DeviceProxy scanServerProxy = TangoDeviceHelper.getDeviceProxy(scanServerName);
        if (scanServerProxy != null) {
            if (isScanResultReady()) {
                try {
                    // Type
                    actionName = "read_attribute(\"" + CurrentScanDataModel.SCAN_TYPE + "\")";
                    DeviceAttribute scanTypeAttribute = scanServerProxy
                            .read_attribute(CurrentScanDataModel.SCAN_TYPE);
                    int scanType = scanTypeAttribute.extractLong();
                    // 0 -> time scan
                    // 1 -> scan 1d
                    // 2 -> scan 2d
                    switch (scanType) {
                        case 0:
                            scanResult = new ScanResultImpl();
                            scanResult.setResultType(IScanResult.ResultType.RESULT_TIMESCAN);
                            break;
                        case 1:
                            scanResult = new ScanResult1DImpl();
                            scanResult.setResultType(IScanResult.ResultType.RESULT_1D);
                            break;
                        case 2:
                            scanResult = new ScanResult2DImpl();
                            scanResult.setResultType(IScanResult.ResultType.RESULT_2D);
                            break;
                    }

                    if (scanResult != null) {
                        scanResult.setScanServer(scanServerName);

                        // Name.
                        actionName = "read_attribute(\"" + CurrentScanDataModel.RUN_NAME + "\")";
                        scanResult.setRunName(CurrentScanDataModel.readRunName(scanServerName));

                        CurrentScanDataModel.updateAttributeInfo(scanServerName);

                        // Sensors
                        actionName = "read_attribute(\"" + CurrentScanDataModel.SENSORS_DATA_LIST
                                + "\")";
                        String[] sensorsValueKeysArray = CurrentScanDataModel
                                .getSensors(scanServerName);

                        ISensor sensor = null;
                        String sensorName = null;
                        String entityName = null;

                        if (sensorsValueKeysArray != null) {
                            for (String sensorValueKey : sensorsValueKeysArray) {
                                entityName = TangoDeviceHelper.getEntityName(sensorValueKey);
                                sensorName = TangoAttributeHelper.getLabel(scanServerName,
                                        entityName);
                                sensor = new SensorImpl();
                                sensor.setName(sensorName);
                                sensor.setEnabled(true);
                                scanResult.getSensorsList().add(sensor);
                                sensor.setScanServerAttributeName(sensorValueKey);
                            }
                        }

                        // Actuators dimension X
                        actionName = "read_attribute(\"" + CurrentScanDataModel.ACTUATORS_DATA_LIST
                                + " " + CurrentScanDataModel.YACTUATORS_DATA_LIST + "\")";
                        String[] actuatorsValueKeysArray = CurrentScanDataModel
                                .getActuators(scanServerName);

                        IActuator actuator = null;
                        String actuatorName = null;
                        List<IActuator> actuatorList = null;

                        if (actuatorsValueKeysArray != null) {
                            for (String actuatorValueKey : actuatorsValueKeysArray) {
                                entityName = TangoDeviceHelper.getEntityName(actuatorValueKey);
                                actuatorName = TangoAttributeHelper.getLabel(scanServerName,
                                        entityName);
                                actuator = new ActuatorImpl();
                                actuator.setName(actuatorName);
                                actuator.setEnabled(true);
                                // X Actuator
                                if (entityName.startsWith("actuator_1")) {
                                    actuatorList = scanResult.getActuatorsXList();
                                }
                                else if (entityName.startsWith("actuator_2")
                                        && scanResult instanceof IScanResult2D) {
                                    actuatorList = ((IScanResult2D) scanResult).getActuatorsYList();
                                }
View Full Code Here

            button.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        IScanResult result = connector.retrieveCommonScanResult();
                        StringBuilder builder = new StringBuilder();
                        if (result != null) {
                            builder.append("ScanServer=" + result.getScanServer() + "\n");
                            builder.append("Class=" + result.getClass().getName() + "\n");
                            builder.append("ScanType=" + result.getResultType() + "\n");
                            builder.append("RunName=" + result.getRunName() + "\n");
                            builder.append("SensorTimeStamps="
                                    + result.getSensorsTimeStampsCompleteName() + "\n");
                            builder.append("ActuatorTimeStamps="
                                    + result.getActuatorsTimeStampsCompleteName() + "\n");

                            List<ISensor> sensorList = result.getSensorsList();
                            builder.append("---Sensor size=" + sensorList.size() + "---\n");
                            for (ISensor sensor : sensorList) {
                                builder.append("Sensor name=" + sensor.getName() + "\n");
                                builder.append("Sensor attribute name="
                                        + sensor.getScanServerAttributeName() + "\n");
                            }

                            List<IActuator> actuatorXList = result.getActuatorsXList();
                            builder.append("---Actuator X size=" + actuatorXList.size() + "---\n");
                            for (IActuator actuator : actuatorXList) {
                                builder.append("Actuator X name=" + actuator.getName() + "\n");
                                builder.append("Actuator attribute name="
                                        + actuator.getScanServerAttributeName() + "\n");
                            }
                            if (result.getResultType() == IScanResult.ResultType.RESULT_2D) {
                                List<IActuator> actuatorYList = ((IScanResult2D) result)
                                        .getActuatorsYList();
                                builder.append("---Actuator Y size=" + actuatorYList.size()
                                        + "---\n");
                                for (IActuator actuator : actuatorYList) {
View Full Code Here

        noReadCycles = 0;
        if (!autoRefresh && !inError) {
            setAutoRefresh(true);
        }
        List<DataArray> data;
        IScanResult scanResult = getScanResult();
        if (scanResult != null && scanResult instanceof IScanResult1D) {
            data = convertScanResultToDataArraysList((IScanResult1D) scanResult);
        }
        else {
            data = null;
View Full Code Here

    /**
     * Returns the scan result.
     */
    public IScanResult getScanResult() {
        IScanResult scanResult;
        if (!inError) {
            String scanServerName = ModelPreferences.getInstance().getScanServer();
            try {
                if (scanServerName != null && !scanServerName.isEmpty()) {
                    if (ScanApi.isScanResultReady(scanServerName)) {
View Full Code Here

     *             buffered exception)
     */
    public static IScanResult getBufferedScanResult(String scanServerName)
            throws SalsaDeviceException, SalsaScanConfigurationException {
        Exception scanException = null;
        IScanResult result = null;
        synchronized (SCAN_RESULT_MAP) {
            // get buffered scan result
            result = SCAN_RESULT_MAP.get(scanServerName);
            // no buffered scan result ? check for exceptions
            if (result == null) {
View Full Code Here

     * @throws SalsaDeviceException If a problem occurred while accessing the Scan Server
     * @throws SalsaScanConfigurationException If the Scan Server Scan Type is not supported
     */
    public IScanResult readScanResult(String scanServerName) throws SalsaDeviceException,
            SalsaScanConfigurationException {
        IScanResult scanResult;
        if (isScanResultReady(scanServerName)) {
            // Type
            IConfig.ScanType scanType = getScanType(scanServerName);
            switch (scanType) {
                case SCAN_1D:
View Full Code Here

        @Override
        public void refresh() {
            try {
                String scanServerName = getScanServer();
                if (scanServerName != null && !scanServerName.trim().equals("")) {
                    IScanResult scanResult = ScanApi.getBufferedScanResult(scanServerName);
                    if (scanResult == null) {
                        scanResultName = null;
                    }
                    else {
                        scanResultName = scanResult.getRunName();
                    }
                }
            }
            catch (SalsaDeviceException e) {
                scanResultName = null;
View Full Code Here

        @Override
        public void refresh() {
            try {
                String scanServerName = getScanServer();
                if (scanServerName != null && !scanServerName.trim().equals("")) {
                    IScanResult scanResult = ScanApi.getBufferedScanResult(scanServerName);
                    if (scanResult == null) {
                        scanResultName = null;
                    }
                    else {
                        scanResultName = scanResult.getRunName();
                    }
                }
            }
            catch (SalsaDeviceException e) {
                scanResultName = null;
View Full Code Here

TOP

Related Classes of fr.soleil.salsa.entity.IScanResult

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.