Class ClientRegWatcher

java.lang.Object
uk.ac.starlink.ttools.mode.ClientRegWatcher
All Implemented Interfaces:
org.astrogrid.samp.client.CallableClient

public class ClientRegWatcher extends Object implements 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 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

      public String waitForIdFromName(String name, long waitMillis)
      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 sought
      waitMillis - maximum number of milliseconds to wait
      Returns:
      client ID for client with name name, or null if timeout is exceeded
    • getIdFromName

      public String getIdFromName(String name)
      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

      public org.astrogrid.samp.Response waitForResponse(String msgTag)
      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 interface org.astrogrid.samp.client.CallableClient
      Throws:
      org.astrogrid.samp.client.SampException
    • receiveNotification

      public void receiveNotification(String senderId, org.astrogrid.samp.Message msg)
      Specified by:
      receiveNotification in interface org.astrogrid.samp.client.CallableClient
    • receiveResponse

      public void receiveResponse(String responderId, String msgTag, org.astrogrid.samp.Response response)
      Specified by:
      receiveResponse in interface org.astrogrid.samp.client.CallableClient