00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __UAPI__RECOGNIZERLISTENER
00021 #define __UAPI__RECOGNIZERLISTENER
00022
00023 #include "exports.h"
00024 #include "ReturnCode.h"
00025 #include "ParametersListener.h"
00026 #include "SmartProxy.h"
00027 #include "RecognitionResult.h"
00028
00029 namespace android
00030 {
00031 namespace speech
00032 {
00033 namespace recognition
00034 {
00035 class Recognizer;
00036 }
00037 }
00038 }
00039
00040
00041 namespace android
00042 {
00043 namespace speech
00044 {
00045 namespace recognition
00046 {
00052 class RecognizerListener : public ParametersListener
00053 {
00054 public:
00055 enum FailureReason
00056 {
00060 NO_MATCH,
00064 SPOKE_TOO_SOON,
00068 BEGINNING_OF_SPEECH_TIMEOUT,
00072 RECOGNITION_TIMEOUT,
00076 TOO_MUCH_SPEECH,
00080 RECOGNITION_3RD_PARTY_ERROR,
00084 SPEECH_SERVER_UNAVAILABLE,
00088 UNKNOWN
00089 };
00090
00096 UAPI_EXPORT const char* toString(FailureReason reason);
00097
00101 virtual void onStarted() = 0;
00102
00106 virtual void onBeginningOfSpeech() = 0;
00107
00111 virtual void onEndOfSpeech() = 0;
00112
00118 virtual void onAcousticStateReset() = 0;
00119
00131 virtual void onRecognitionSuccess(RecognitionResultProxy& result) = 0;
00132
00139 virtual void onRecognitionFailure(FailureReason reason) = 0;
00140
00147 virtual void onError(ReturnCode::Type returnCode) = 0;
00148
00152 virtual void onStopped() = 0;
00153 protected:
00157 UAPI_EXPORT RecognizerListener();
00161 UAPI_EXPORT virtual ~RecognizerListener();
00162
00163 friend class RecognizerListenerProxy;
00164 };
00165
00166
00167
00168
00169 DECLARE_SMARTPROXY(UAPI_EXPORT, RecognizerListenerProxy, android::speech::recognition::SmartProxy,
00170 RecognizerListener)
00171 }
00172 }
00173 }
00174
00175 #endif