Package uk.ac.starlink.ttools.mode
Class ClientRegWatcher
java.lang.Object
uk.ac.starlink.ttools.mode.ClientRegWatcher
- All Implemented Interfaces:
org.astrogrid.samp.client.CallableClient
Callable client implementation which can watch for registration of a
given named application.
- Since:
- 9 Jan 2009
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionClientRegWatcher
(org.astrogrid.samp.client.HubConnection connection) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetIdFromName
(String name) Returns the client ID of a client with a given name if one is registered.org.astrogrid.samp.Subscriptions
Returns the subscriptions object indicating the MTypes this client can handle.void
receiveCall
(String senderId, String msgId, org.astrogrid.samp.Message msg) void
receiveNotification
(String senderId, org.astrogrid.samp.Message msg) void
receiveResponse
(String responderId, String msgTag, org.astrogrid.samp.Response response) waitForIdFromName
(String name, long waitMillis) Blocks until a client with a given name is regstered, and then returns its client ID.org.astrogrid.samp.Response
waitForResponse
(String msgTag) Blocks until a response with a given tag is received, then returns that response.
-
Constructor Details
-
ClientRegWatcher
public ClientRegWatcher(org.astrogrid.samp.client.HubConnection connection) Constructor.- Parameters:
connection
- hub connection
-
-
Method Details
-
getSubscriptions
public org.astrogrid.samp.Subscriptions getSubscriptions()Returns the subscriptions object indicating the MTypes this client can handle.- Returns:
- subscriptions
-
waitForIdFromName
Blocks until a client with a given name is regstered, and then returns its client ID. If a given timeout value is exceeded, null is returned- Parameters:
name
- client name soughtwaitMillis
- maximum number of milliseconds to wait- Returns:
- client ID for client with name
name
, or null if timeout is exceeded
-
getIdFromName
Returns the client ID of a client with a given name if one is registered.- Parameters:
name
- client name- Returns:
- ID of client with name
name
, or null if none is currently registered
-
waitForResponse
Blocks until a response with a given tag is received, then returns that response.- Parameters:
msgTag
- message tag- Returns:
- response
-
receiveCall
public void receiveCall(String senderId, String msgId, org.astrogrid.samp.Message msg) throws org.astrogrid.samp.client.SampException - Specified by:
receiveCall
in interfaceorg.astrogrid.samp.client.CallableClient
- Throws:
org.astrogrid.samp.client.SampException
-
receiveNotification
- Specified by:
receiveNotification
in interfaceorg.astrogrid.samp.client.CallableClient
-
receiveResponse
public void receiveResponse(String responderId, String msgTag, org.astrogrid.samp.Response response) - Specified by:
receiveResponse
in interfaceorg.astrogrid.samp.client.CallableClient
-