public interface

VoiceEventListener

com.nuwarobotics.service.agent.VoiceEventListener

Class Overview

register the VoiceEventListener into RobotAPI instance and get callback return after listen event trigger Suggest to move the action into handler (or thread) avoid blocing the codeflow. Example :

     mRobot.registerVoiceEventListener(new VoiceEventListener() {
             @Override
             public void onWakeup(boolean isError, String score, float direction) {
                 // TODO Auto-generated method stub
                 Log.d(TAG, "onWakeup:" + !isError + ", score:" + score);
             }

             @Override
             public void onTTSComplete(boolean isError) {
                 // TODO Auto-generated method stub
                 Log.d(TAG, "onTTSComplete" + !isError);
             }

             @Override
             public void onSpeechRecognizeComplete(boolean isError, ResultType iFlyResult, String result) {
                 // TODO Auto-generated method stub
                 Log.d(TAG, "onSpeechRecognizeComplete:" + !isError + ", result:" + result);
             }

             @Override
             public void onSpeech2TextComplete(boolean isError, String result) {
                 // TODO Auto-generated method stub
                 Log.d(TAG, "onSpeech2TextComplete:" + !isError + ", result:" + result);
             }

             @Override
             public void onSpeechState(ListenType type, SpeechState state) {
                 // TODO Auto-generated method stub
                 Log.d(TAG, "onSpeechState:" + type + ", state:" + state);
             }

             @Override
             public void onMixUnderstandComplete(boolean isError, ResultType iFlyResult, String result) {
                 // TODO Auto-generated method stub
                 Log.d(TAG, "onMixUnderstandComplete:" + !isError + ", result:" + result);
             }

             @Override
             public void onGrammarState(final boolean isError, String info) {
                 // TODO Auto-generated method stub
                 Log.d(TAG, "onGrammarState:" + !isError + ", info:" + info);
             }

             @Override
             public void onListenVolumeChanged(ListenType listenType, int volume) {
                 // TODO Auto-generated method stub
                 // ASR - user speak volume which is given by IFly engine directly
             }

             @Override
             public void onSpeakState(SpeakType type, SpeakState state) {
                 // TODO Auto-generated method stub
                 Log.d(TAG, "onSpeakState:" + type + ", state:" + state);
             }

             @Override
             public void onHotwordChange(HotwordState state, HotwordType type, String result) {
                 // TODO Auto-generated method stub
                 Log.d(TAG, "[Alan] onHotwordChange:" + state + ", type:" + type + ", result:" + result);
             }

         });
 

Summary

Nested Classes
enum VoiceEventListener.HotwordState The running state for Always-wakeup  
enum VoiceEventListener.HotwordType The result type for Always-wakeup  
enum VoiceEventListener.ListenType Listen trigger by which mode  
enum VoiceEventListener.ResultType voice type of result  
enum VoiceEventListener.SpeakState The state of speak  
enum VoiceEventListener.SpeakType The type of speak  
enum VoiceEventListener.SpeechState List the speech state  
Public Methods
abstract void onGrammarState(boolean isError, String info)
Set grammar result
abstract void onHotwordChange(VoiceEventListener.HotwordState state, VoiceEventListener.HotwordType type, String result)
get the infomation from always-wakeup
abstract void onListenVolumeChanged(VoiceEventListener.ListenType curType, int volume)
get the volume in listen state.
abstract void onMixUnderstandComplete(boolean isError, VoiceEventListener.ResultType type, String result)
Callback of Callback of startMixUnderstand() or startLocalCommand() complete
abstract void onSpeakState(VoiceEventListener.SpeakType type, VoiceEventListener.SpeakState state)
Speech synthesis state
abstract void onSpeech2TextComplete(boolean isError, String result)
Callback of Callback of startSpeech2Text(boolean) complete
abstract void onSpeechRecognizeComplete(boolean isError, VoiceEventListener.ResultType type, String result)
Callback of startRecognize(boolean) complete
abstract void onSpeechState(VoiceEventListener.ListenType type, VoiceEventListener.SpeechState state)
Speech recognize state
abstract void onTTSComplete(boolean isError)
Callback of speech synthesis complete
abstract void onWakeup(boolean isError, String score, float direction)
Callback of startWakeUp(boolean) for wake up happen

Public Methods

public abstract void onGrammarState (boolean isError, String info)

Set grammar result

Parameters
isError true is mean error happened

public abstract void onHotwordChange (VoiceEventListener.HotwordState state, VoiceEventListener.HotwordType type, String result)

get the infomation from always-wakeup

Parameters
state for which state in always-wakeup
type for which type about the result
result for what hear from always-wakeup, json format, parsed by VoiceResultJsonParser

public abstract void onListenVolumeChanged (VoiceEventListener.ListenType curType, int volume)

get the volume in listen state.

Parameters
curType listen type

public abstract void onMixUnderstandComplete (boolean isError, VoiceEventListener.ResultType type, String result)

Callback of Callback of startMixUnderstand() or startLocalCommand() complete

Parameters
isError true is mean error happened
type Recognized type
result Recognize result

public abstract void onSpeakState (VoiceEventListener.SpeakType type, VoiceEventListener.SpeakState state)

Speech synthesis state

Parameters
type speak type
state speech synthesis state

public abstract void onSpeech2TextComplete (boolean isError, String result)

Callback of Callback of startSpeech2Text(boolean) complete

Parameters
isError true is mean error happened
result Recognize result

public abstract void onSpeechRecognizeComplete (boolean isError, VoiceEventListener.ResultType type, String result)

Callback of startRecognize(boolean) complete

Parameters
isError true is mean error happened
type which type of recognization
result recognized data (JSON type)

public abstract void onSpeechState (VoiceEventListener.ListenType type, VoiceEventListener.SpeechState state)

Speech recognize state

Parameters
type listen type
state speech recognize state

public abstract void onTTSComplete (boolean isError)

Callback of speech synthesis complete

Parameters
isError is error happen

public abstract void onWakeup (boolean isError, String score, float direction)

Callback of startWakeUp(boolean) for wake up happen

Parameters
isError true is mean error happened
score confidence score of wakeup voice
direction direction of wakeup voice source