Search in sources :

Example 1 with IRunnableDeviceService

use of org.eclipse.scanning.api.device.IRunnableDeviceService in project gda-core by openGDA.

the class EditMappingStageDialog method findMappingStageOptions.

private void findMappingStageOptions() {
    // may be null if not configured for this beamline
    options = getService(MappingStageOptions.class);
    if (malcolmDeviceName.isPresent()) {
        try {
            final URI jmsURI = new URI(LocalProperties.getActiveMQBrokerURI());
            final IEventService eventService = getService(IEventService.class);
            IRunnableDeviceService runnableDeviceService = eventService.createRemoteService(jmsURI, IRunnableDeviceService.class);
            IMalcolmDevice malcolmDevice = (IMalcolmDevice) (IRunnableDevice<?>) runnableDeviceService.getRunnableDevice(malcolmDeviceName.get());
            List<String> availableAxes = new ArrayList<>(malcolmDevice.getAvailableAxes());
            List<String> associatedAxes = null;
            if (options != null) {
                // Currently these are not Malcolm related
                associatedAxes = options.getAssociatedAxes();
            }
            options = new MappingStageOptions();
            options.setFastAxes(availableAxes);
            options.setSlowAxes(availableAxes);
            if (associatedAxes != null)
                options.setAssociatedAxes(associatedAxes);
        } catch (Exception e) {
            MessageDialog.openError(getShell(), "", "Could not get available axes for malcolm device ''" + malcolmDeviceName.get() + "''");
        }
    }
}
Also used : IRunnableDeviceService(org.eclipse.scanning.api.device.IRunnableDeviceService) ArrayList(java.util.ArrayList) MappingStageOptions(uk.ac.diamond.daq.mapping.impl.MappingStageOptions) IMalcolmDevice(org.eclipse.scanning.api.malcolm.IMalcolmDevice) IEventService(org.eclipse.scanning.api.event.IEventService) URI(java.net.URI)

Example 2 with IRunnableDeviceService

use of org.eclipse.scanning.api.device.IRunnableDeviceService in project gda-core by openGDA.

the class ProcessingSelectionWizardPage method getRunnableDeviceService.

private IRunnableDeviceService getRunnableDeviceService() throws EventException, URISyntaxException {
    if (runnableDeviceService == null) {
        IEventService eventService = context.get(IEventService.class);
        URI jmsURI = new URI(LocalProperties.getActiveMQBrokerURI());
        runnableDeviceService = eventService.createRemoteService(jmsURI, IRunnableDeviceService.class);
    }
    return runnableDeviceService;
}
Also used : IRunnableDeviceService(org.eclipse.scanning.api.device.IRunnableDeviceService) IEventService(org.eclipse.scanning.api.event.IEventService) URI(java.net.URI)

Aggregations

URI (java.net.URI)2 IRunnableDeviceService (org.eclipse.scanning.api.device.IRunnableDeviceService)2 IEventService (org.eclipse.scanning.api.event.IEventService)2 ArrayList (java.util.ArrayList)1 IMalcolmDevice (org.eclipse.scanning.api.malcolm.IMalcolmDevice)1 MappingStageOptions (uk.ac.diamond.daq.mapping.impl.MappingStageOptions)1