org.robokind.api.speech.messaging
Class RemoteSpeechServiceClient<Conf>

java.lang.Object
  extended by org.robokind.api.common.playable.AbstractPlayable
      extended by org.robokind.api.messaging.services.DefaultServiceClient<Conf>
          extended by org.robokind.api.speech.messaging.RemoteSpeechServiceClient<Conf>
All Implemented Interfaces:
org.robokind.api.common.playable.Playable, org.robokind.api.messaging.services.RemoteServiceClient<Conf>, SpeechService

public class RemoteSpeechServiceClient<Conf>
extends org.robokind.api.messaging.services.DefaultServiceClient<Conf>
implements SpeechService

Author:
Matthew Stevenson

Field Summary
 
Fields inherited from class org.robokind.api.common.playable.AbstractPlayable
myElapsedPauseTime, myPauseTime, myPlayableListeners, myPlayState, myResumeTime, myStartTime, myStopTime
 
Fields inherited from interface org.robokind.api.speech.SpeechService
PROP_ID
 
Constructor Summary
RemoteSpeechServiceClient(Class<Conf> configClass, String speechServiceId, String remoteId, org.robokind.api.messaging.MessageSender<org.robokind.api.messaging.services.ServiceCommand> commandSender, org.robokind.api.messaging.MessageSender<Conf> configSender, org.robokind.api.messaging.MessageAsyncReceiver<org.robokind.api.messaging.services.ServiceError> errorReceiver, org.robokind.api.messaging.services.ServiceCommandFactory commandFactory, org.robokind.api.messaging.MessageSender<SpeechRequest> requestSender, org.robokind.api.messaging.MessageAsyncReceiver<SpeechEventList<SpeechEvent>> eventReceiver, SpeechRequestFactory requestFactory)
          Connects to a remote SpeechService through Messaging components
 
Method Summary
 void addRequestListener(org.jflux.api.core.Listener<SpeechRequest> listener)
          Adds a Listener to be notified when a speech request is made.
 void addSpeechEventListener(org.jflux.api.core.Listener<SpeechEventList<SpeechEvent>> listener)
          Adds a Listener to be notified when a speech event occurs.
 void cancelSpeech()
           
 String getSpeechServiceId()
          Returns the SpeechService Id.
 void removeRequestListener(org.jflux.api.core.Listener<SpeechRequest> listener)
          Removes a Listener from being notified when a speech request is made.
 void removeSpeechEventListener(org.jflux.api.core.Listener<SpeechEventList<SpeechEvent>> listener)
          Removes a Listener from being notified when a speech event occurs.
 void setSpeechEventsReceiver(org.robokind.api.messaging.MessageAsyncReceiver<SpeechEventList<SpeechEvent>> receiver)
           
 void setSpeechRequestFactory(SpeechRequestFactory factory)
           
 void setSpeechRequestSender(org.robokind.api.messaging.MessageSender<SpeechRequest> sender)
           
 SpeechJob speak(String text)
          Sends the SpeechService text to speak.
 void start()
          Starts the SpeechService, making it ready to speak.
 void stop()
          Closes a SpeechService, leaving it unable to speak.
 
Methods inherited from class org.robokind.api.messaging.services.DefaultServiceClient
getClientId, getHostId, initialize, onComplete, onPause, onResume, onStart, onStop, send, setCommandFactory, setCommandSender, setConfigSender, setErrorReceiver
 
Methods inherited from class org.robokind.api.common.playable.AbstractPlayable
addPlayableListener, afterComplete, complete, firePlayStateChanged, getElapsedPauseTime, getElapsedPlayTime, getPauseTime, getPlayState, getResumeTime, getStartTime, getStopTime, pause, removePlayableListener, resume, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.robokind.api.common.playable.Playable
addPlayableListener, complete, getElapsedPauseTime, getElapsedPlayTime, getPauseTime, getPlayState, getResumeTime, getStartTime, getStopTime, pause, removePlayableListener, resume, start, stop
 

Constructor Detail

RemoteSpeechServiceClient

public RemoteSpeechServiceClient(Class<Conf> configClass,
                                 String speechServiceId,
                                 String remoteId,
                                 org.robokind.api.messaging.MessageSender<org.robokind.api.messaging.services.ServiceCommand> commandSender,
                                 org.robokind.api.messaging.MessageSender<Conf> configSender,
                                 org.robokind.api.messaging.MessageAsyncReceiver<org.robokind.api.messaging.services.ServiceError> errorReceiver,
                                 org.robokind.api.messaging.services.ServiceCommandFactory commandFactory,
                                 org.robokind.api.messaging.MessageSender<SpeechRequest> requestSender,
                                 org.robokind.api.messaging.MessageAsyncReceiver<SpeechEventList<SpeechEvent>> eventReceiver,
                                 SpeechRequestFactory requestFactory)
Connects to a remote SpeechService through Messaging components

Method Detail

getSpeechServiceId

public String getSpeechServiceId()
Description copied from interface: SpeechService
Returns the SpeechService Id.

Specified by:
getSpeechServiceId in interface SpeechService
Returns:
SpeechService Id

start

public void start()
           throws Exception
Description copied from interface: SpeechService
Starts the SpeechService, making it ready to speak.

Specified by:
start in interface SpeechService
Throws:
Exception

speak

public SpeechJob speak(String text)
Description copied from interface: SpeechService
Sends the SpeechService text to speak.

Specified by:
speak in interface SpeechService
Parameters:
text - the text to speak

cancelSpeech

public void cancelSpeech()
Specified by:
cancelSpeech in interface SpeechService

stop

public void stop()
Description copied from interface: SpeechService
Closes a SpeechService, leaving it unable to speak.

Specified by:
stop in interface SpeechService

setSpeechRequestSender

public void setSpeechRequestSender(org.robokind.api.messaging.MessageSender<SpeechRequest> sender)

setSpeechEventsReceiver

public void setSpeechEventsReceiver(org.robokind.api.messaging.MessageAsyncReceiver<SpeechEventList<SpeechEvent>> receiver)

setSpeechRequestFactory

public void setSpeechRequestFactory(SpeechRequestFactory factory)

addRequestListener

public void addRequestListener(org.jflux.api.core.Listener<SpeechRequest> listener)
Description copied from interface: SpeechService
Adds a Listener to be notified when a speech request is made.

Specified by:
addRequestListener in interface SpeechService
Parameters:
listener - the Listener to be notified

removeRequestListener

public void removeRequestListener(org.jflux.api.core.Listener<SpeechRequest> listener)
Description copied from interface: SpeechService
Removes a Listener from being notified when a speech request is made.

Specified by:
removeRequestListener in interface SpeechService
Parameters:
listener - the Listener to remove

addSpeechEventListener

public void addSpeechEventListener(org.jflux.api.core.Listener<SpeechEventList<SpeechEvent>> listener)
Description copied from interface: SpeechService
Adds a Listener to be notified when a speech event occurs.

Specified by:
addSpeechEventListener in interface SpeechService
Parameters:
listener - the Listener to be notified

removeSpeechEventListener

public void removeSpeechEventListener(org.jflux.api.core.Listener<SpeechEventList<SpeechEvent>> listener)
Description copied from interface: SpeechService
Removes a Listener from being notified when a speech event occurs.

Specified by:
removeSpeechEventListener in interface SpeechService
Parameters:
listener - the Listener to remove


Copyright © 2011-2013. All Rights Reserved.