RecognizerListener.h

00001 /*---------------------------------------------------------------------------*
00002  *  RecognizerListener.h                                                     *
00003  *                                                                           *
00004  *  Copyright 2007 Nuance Communciations, Inc.                               *
00005  *                                                                           *
00006  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
00007  *  you may not use this file except in compliance with the License.         *
00008  *                                                                           *
00009  *  You may obtain a copy of the License at                                  *
00010  *      http://www.apache.org/licenses/LICENSE-2.0                           *
00011  *                                                                           *
00012  *  Unless required by applicable law or agreed to in writing, software      *
00013  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
00014  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
00015  *  See the License for the specific language governing permissions and      *
00016  *  limitations under the License.                                           *
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        * @see android::speech::recognition::SmartProxy
00168        */
00169       DECLARE_SMARTPROXY(UAPI_EXPORT, RecognizerListenerProxy, android::speech::recognition::SmartProxy,
00170                          RecognizerListener)
00171     }
00172   }
00173 }
00174 
00175 #endif

Generated on Thu May 1 17:16:37 2008 for UAPI by  doxygen 1.5.3