org.jvoicexml.implementation.jsapi20
Class Jsapi20SpokenInput

java.lang.Object
  extended by org.jvoicexml.implementation.jsapi20.Jsapi20SpokenInput
All Implemented Interfaces:
javax.speech.EngineListener, javax.speech.recognition.RecognizerListener, javax.speech.SpeechEventListener, ExternalResource, InputDevice, ObservableSpokenInput, SpokenInput, RemoteConnectable

public final class Jsapi20SpokenInput
extends Object
implements SpokenInput, ObservableSpokenInput, javax.speech.recognition.RecognizerListener

Audio input that uses the JSAPI 2.0 to address the recognition engine.

Handle all JSAPI calls to the recognizer to make JSAPI transparent to the interpreter.

Since:
0.6
Version:
$Revision: 2948 $
Author:
Dirk Schnelle-Walka, Renato Cassaca, David Rodriguez

Constructor Summary
Jsapi20SpokenInput(javax.speech.recognition.RecognizerMode defaultDescriptor, InputMediaLocatorFactory mediaLocatorFactory)
          Constructs a new audio input.
 
Method Summary
 void activate()
          
 void activateGrammars(Collection<GrammarImplementation<? extends Object>> grammars)
          
 void addListener(SpokenInputListener inputListener)
          
 void close()
          
 void connect(ConnectionInformation info)
          
 void deactivateGrammars(Collection<GrammarImplementation<? extends Object>> grammars)
          
 void disconnect(ConnectionInformation info)
          
 Collection<org.jvoicexml.xml.vxml.BargeInType> getSupportedBargeInTypes()
          
 Collection<org.jvoicexml.xml.srgs.GrammarType> getSupportedGrammarTypes()
          
 String getType()
          
 URI getUriForNextSpokenInput()
          
 boolean isBusy()
          
 GrammarImplementation<javax.speech.recognition.RuleGrammar> loadGrammar(Reader reader, org.jvoicexml.xml.srgs.GrammarType grammarType)
          
 void open()
          
 void passivate()
          
 void recognizerUpdate(javax.speech.recognition.RecognizerEvent recognizerEvent)
          
 void removeListener(SpokenInputListener inputListener)
          
 void setMediaLocator(URI locator)
          Sets the media locator.
 void setType(String resourceType)
          Sets the type of this resource.
 void startRecognition(SpeechRecognizerProperties speech, DtmfRecognizerProperties dtmf)
          
 void stopRecognition()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jsapi20SpokenInput

public Jsapi20SpokenInput(javax.speech.recognition.RecognizerMode defaultDescriptor,
                          InputMediaLocatorFactory mediaLocatorFactory)
Constructs a new audio input.

Parameters:
defaultDescriptor - the default recognizer mode descriptor.
mediaLocatorFactory - the media locator factory
Method Detail

setMediaLocator

public void setMediaLocator(URI locator)
Sets the media locator.

Parameters:
locator - the media locator to use.
Since:
0.7

open

public void open()
          throws NoresourceError

Specified by:
open in interface ExternalResource
Throws:
NoresourceError

close

public void close()

Specified by:
close in interface ExternalResource

addListener

public void addListener(SpokenInputListener inputListener)

Specified by:
addListener in interface ObservableSpokenInput

removeListener

public void removeListener(SpokenInputListener inputListener)

Specified by:
removeListener in interface ObservableSpokenInput

getSupportedBargeInTypes

public Collection<org.jvoicexml.xml.vxml.BargeInType> getSupportedBargeInTypes()

Specified by:
getSupportedBargeInTypes in interface SpokenInput

loadGrammar

public GrammarImplementation<javax.speech.recognition.RuleGrammar> loadGrammar(Reader reader,
                                                                               org.jvoicexml.xml.srgs.GrammarType grammarType)
                                                                        throws NoresourceError,
                                                                               BadFetchError,
                                                                               UnsupportedFormatError

Specified by:
loadGrammar in interface SpokenInput
Throws:
NoresourceError
BadFetchError
UnsupportedFormatError

activateGrammars

public void activateGrammars(Collection<GrammarImplementation<? extends Object>> grammars)
                      throws BadFetchError,
                             UnsupportedLanguageError,
                             NoresourceError

Specified by:
activateGrammars in interface SpokenInput
Throws:
BadFetchError
UnsupportedLanguageError
NoresourceError

deactivateGrammars

public void deactivateGrammars(Collection<GrammarImplementation<? extends Object>> grammars)
                        throws BadFetchError

Specified by:
deactivateGrammars in interface SpokenInput
Throws:
BadFetchError

startRecognition

public void startRecognition(SpeechRecognizerProperties speech,
                             DtmfRecognizerProperties dtmf)
                      throws NoresourceError,
                             BadFetchError

Specified by:
startRecognition in interface InputDevice
Throws:
NoresourceError
BadFetchError

stopRecognition

public void stopRecognition()

Specified by:
stopRecognition in interface InputDevice

activate

public void activate()

Specified by:
activate in interface ExternalResource

passivate

public void passivate()

Specified by:
passivate in interface ExternalResource

connect

public void connect(ConnectionInformation info)
             throws IOException

Specified by:
connect in interface RemoteConnectable
Throws:
IOException

disconnect

public void disconnect(ConnectionInformation info)

Specified by:
disconnect in interface RemoteConnectable

getType

public String getType()

Specified by:
getType in interface ExternalResource

setType

public void setType(String resourceType)
Sets the type of this resource.

Parameters:
resourceType - type of the resource

getSupportedGrammarTypes

public Collection<org.jvoicexml.xml.srgs.GrammarType> getSupportedGrammarTypes()

Specified by:
getSupportedGrammarTypes in interface SpokenInput

getUriForNextSpokenInput

public URI getUriForNextSpokenInput()
                             throws NoresourceError,
                                    URISyntaxException

Specified by:
getUriForNextSpokenInput in interface SpokenInput
Throws:
NoresourceError
URISyntaxException

isBusy

public boolean isBusy()

Specified by:
isBusy in interface ExternalResource

recognizerUpdate

public void recognizerUpdate(javax.speech.recognition.RecognizerEvent recognizerEvent)

Specified by:
recognizerUpdate in interface javax.speech.recognition.RecognizerListener


Copyright © 2005-2009JVoiceXML group.