org.jvoicexml.implementation.jsapi10
Class Jsapi10SpokenInput

java.lang.Object
  extended by org.jvoicexml.implementation.jsapi10.Jsapi10SpokenInput
All Implemented Interfaces:
ExternalResource, InputDevice, StreamableSpokenInput, ObservableSpokenInput, SpokenInput, RemoteConnectable

public final class Jsapi10SpokenInput
extends Object
implements SpokenInput, ObservableSpokenInput, StreamableSpokenInput

Spoken input that uses the JSAPI 1.0 to address the recognition engine.

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

Version:
$Revision: 2913 $
Author:
Dirk Schnelle-Walka

Constructor Summary
Jsapi10SpokenInput(RecognizerModeDesc defaultDescriptor)
          Constructs a new audio input.
 
Method Summary
 void activate()
          
 void activateGrammars(Collection<GrammarImplementation<? extends Object>> grammars)
           Activation of grammars means to enable the grammar in the JSAPI jargon.
 void addListener(SpokenInputListener inputListener)
          
 void close()
          
 void connect(ConnectionInformation connectionInformation)
          
 void deactivateGrammars(Collection<GrammarImplementation<? extends Object>> grammars)
           Activation of grammars means to disable the grammar in the JSAPI jargon.
 void disconnect(ConnectionInformation connectionInformation)
          
 Collection<org.jvoicexml.xml.vxml.BargeInType> getSupportedBargeInTypes()
          
 Collection<org.jvoicexml.xml.srgs.GrammarType> getSupportedGrammarTypes()
          
 String getType()
          
 URI getUriForNextSpokenInput()
          
 boolean isBusy()
          
 GrammarImplementation<?> loadGrammar(Reader reader, org.jvoicexml.xml.srgs.GrammarType type)
          
 void open()
          
 void passivate()
          
 void removeListener(SpokenInputListener inputListener)
          
 void setSpokenInputConnectionHandler(SpokenInputConnectionHandler connectionHandler)
          Sets a custom connection handler.
 void setStreamableSpokenInput(StreamableSpokenInput streamable)
          Sets the streamable input.
 void startRecognition(SpeechRecognizerProperties speech, DtmfRecognizerProperties dtmf)
          
 void stopRecognition()
          
 void writeRecognizerStream(byte[] buffer, int offset, int length)
          Writes length bytes of data from the specified byte array starting at offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jsapi10SpokenInput

public Jsapi10SpokenInput(RecognizerModeDesc defaultDescriptor)
Constructs a new audio input.

Parameters:
defaultDescriptor - the default recognizer mode descriptor.
Method Detail

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<?> loadGrammar(Reader reader,
                                            org.jvoicexml.xml.srgs.GrammarType type)
                                     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
Activation of grammars means to enable the grammar in the JSAPI jargon.

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

deactivateGrammars

public void deactivateGrammars(Collection<GrammarImplementation<? extends Object>> grammars)
                        throws BadFetchError
Activation of grammars means to disable the grammar in the JSAPI jargon.

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 connectionInformation)
             throws IOException

Specified by:
connect in interface RemoteConnectable
Throws:
IOException

disconnect

public void disconnect(ConnectionInformation connectionInformation)

Specified by:
disconnect in interface RemoteConnectable

getType

public String getType()

Specified by:
getType in interface ExternalResource

getSupportedGrammarTypes

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

Specified by:
getSupportedGrammarTypes in interface SpokenInput

setSpokenInputConnectionHandler

public void setSpokenInputConnectionHandler(SpokenInputConnectionHandler connectionHandler)
Sets a custom connection handler.

Parameters:
connectionHandler - the connection handler.

getUriForNextSpokenInput

public URI getUriForNextSpokenInput()
                             throws NoresourceError

Specified by:
getUriForNextSpokenInput in interface SpokenInput
Throws:
NoresourceError

isBusy

public boolean isBusy()

Specified by:
isBusy in interface ExternalResource

setStreamableSpokenInput

public void setStreamableSpokenInput(StreamableSpokenInput streamable)
Sets the streamable input.

Parameters:
streamable - the streamable input to set.

writeRecognizerStream

public void writeRecognizerStream(byte[] buffer,
                                  int offset,
                                  int length)
                           throws IOException
Writes length bytes of data from the specified byte array starting at offset.

Specified by:
writeRecognizerStream in interface StreamableSpokenInput
Parameters:
buffer - the buffer from which the data is read.
offset - the start offset in buffer at which the data is read.
length - the maximum number of bytes to read.
Throws:
IOException - Error reading from the stream..


Copyright © 2005-2009JVoiceXML group.