Interface IMalcolmConnection
- All Known Implementing Classes:
MalcolmEpicsV4Connection
public interface IMalcolmConnection
An instance of this interface represent a connection to a malcolm service and this
interface provides methods to communicate with malcolm devices. Note that a single
instance of this service is used to communicate with all malcolm devices on a particular
machine.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA listener to malcolm events from the actual malcolm device.static interfaceA listener to the state of the connection to the actual malcolm device, i.e. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the connection.Returns the message generator.send(IMalcolmDevice device, MalcolmMessage message) Send the message and get one back, blocking, same as send(device, MalcolmMessage, true)voidsubscribe(IMalcolmDevice device, MalcolmMessage message, IMalcolmConnection.IMalcolmConnectionEventListener listener) Subscribe to a message, adding the listener to the list of listeners for this messagevoidsubscribeToConnectionStateChange(IMalcolmDevice device, IMalcolmConnection.IMalcolmConnectionStateListener listener) Listens to connection state changes on the device, notifying the specified listener of any change.unsubscribe(IMalcolmDevice device, MalcolmMessage message, IMalcolmConnection.IMalcolmConnectionEventListener... listeners) Unsubscribe to a message, if listeners is null all listeners will be unsubscribed, otherwise just those specified.
-
Field Details
-
ERROR_MESSAGE_PREFIX_FAILED_TO_CONNECT
Prefix for connection error messages.- See Also:
-
-
Method Details
-
getMessageGenerator
IMalcolmMessageGenerator getMessageGenerator()Returns the message generator.- Returns:
-
disconnect
Closes the connection.- Throws:
MalcolmDeviceException
-
send
Send the message and get one back, blocking, same as send(device, MalcolmMessage, true)- Parameters:
message-- Returns:
- Throws:
MalcolmDeviceException
-
subscribe
void subscribe(IMalcolmDevice device, MalcolmMessage message, IMalcolmConnection.IMalcolmConnectionEventListener listener) throws MalcolmDeviceException Subscribe to a message, adding the listener to the list of listeners for this message- Parameters:
message-- Throws:
MalcolmDeviceException
-
unsubscribe
MalcolmMessage unsubscribe(IMalcolmDevice device, MalcolmMessage message, IMalcolmConnection.IMalcolmConnectionEventListener... listeners) throws MalcolmDeviceException Unsubscribe to a message, if listeners is null all listeners will be unsubscribed, otherwise just those specified.- Parameters:
message-- Returns:
- Throws:
MalcolmDeviceException
-
subscribeToConnectionStateChange
void subscribeToConnectionStateChange(IMalcolmDevice device, IMalcolmConnection.IMalcolmConnectionStateListener listener) throws MalcolmDeviceException Listens to connection state changes on the device, notifying the specified listener of any change. This method blocks with no timeout until the connection is made, therefore this method should be called in a different thread.- Parameters:
device- the device to listen tolistener- the listener to be notified of changes- Throws:
MalcolmDeviceException
-