Class ChatAdapter

java.lang.Object
edu.tufts.hrilab.gui.GuiAdapter
edu.tufts.hrilab.simspeech.gui.ChatAdapter

public class ChatAdapter extends GuiAdapter
A WebSocket adapter for communication between DIARC and the frontend Chat Viewer GUI.
See Also:
  • Constructor Details

  • Method Details

    • populateDiarcAgents

      public void populateDiarcAgents(ai.thinkingrobots.trade.TRADEServiceInfo service)
      Callback to send names to the frontend when the DIARC agents join. This is a helper method in case we need to register for notifications.
      Parameters:
      service - the getDiarcAgents() TRADE service, provided by the notifier.
    • registerDialogue

      public void registerDialogue(ai.thinkingrobots.trade.TRADEServiceInfo service) throws ai.thinkingrobots.trade.TRADEException
      Callback to register for dialogue history notifications when Dialogue is up. This is a helper method in case we need to register for notifications for the Dialogue notifications.
      Parameters:
      service - requested service
      Throws:
      ai.thinkingrobots.trade.TRADEException - if the TRADE service call fails.
    • sendUtterance

      public void sendUtterance(Utterance utterance)
      Sends a message to the chat window.
      Parameters:
      utterance - what the robot is saying.
    • init

      protected void init()
      Initialization after construction and after TRADE services are registered.
      Overrides:
      init in class GuiAdapter
    • providesTradeServices

      protected boolean providesTradeServices()
      Force implementing classes to declare whether they provide TRADE services. This is to decide whether or not to register any new instances of that class with TRADE.
      Specified by:
      providesTradeServices in class GuiAdapter
      Returns:
      true iff the adapter provides TRADE services.
    • getPathRoot

      public String getPathRoot()
      Enforce implementation of path root getter for getPath(). This is usually based on the component's/adapter's name; e.g., the belief GUI's path root is belief.
      Specified by:
      getPathRoot in class GuiAdapter
      Returns:
      the path root as a String.
    • handleMessage

      protected void handleMessage(com.google.gson.JsonObject message)
      Handle a message from the client.
      Overrides:
      handleMessage in class GuiAdapter
      Parameters:
      message - a JsonObject representing the message.