voiceui/voiceuivoicerecognition/inc/vuicvoicerecogdialogimpl.h
branchRCL_3
changeset 23 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
22:cad71a31b7fc 23:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Definition of the dialog displayed when a recognition is in progress     :
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef VUICVOICERECOGDIALOGIMPL_H
       
    20 #define VUICVOICERECOGDIALOGIMPL_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <nssvasapi.h>
       
    24 #include <nssttsutility.h> 
       
    25 
       
    26 #include "vuimkeycallback.h"
       
    27 
       
    28 #include "voiceuibldvariant.hrh"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CState;
       
    32 class CDataStorage;
       
    33 class CUiModel;
       
    34 class MVoiceRecognitionDialogCallback;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 /**
       
    38 * The voice recognition dialog
       
    39 * @lib VoiceUiRecognition.lib
       
    40 */
       
    41 NONSHARABLE_CLASS( CVoiceRecognitionDialogImpl ) : public CActive,
       
    42                                                    public MKeyCallback,
       
    43                                                    public MNssRecognizeInitCompleteHandler,
       
    44                                                    public MNssRecognizeEventHandler,
       
    45                                                    public MNssAdaptationEventHandler,
       
    46                                                    public MTtsClientUtilityObserver,
       
    47                                                    public MNssGetContextClient,
       
    48                                                    public MNssGetTagClient,
       
    49                                                    public MNssSaveContextClient,
       
    50                                                    public MNssTrainTextEventHandler,
       
    51                                                    public MNssSaveTagClient,
       
    52                                                    public MNssDeleteContextClient
       
    53     {
       
    54 
       
    55     public:  // Constructors and Destructors
       
    56 
       
    57         /**
       
    58         * Symbian two-phased constructor.
       
    59         */
       
    60         static CVoiceRecognitionDialogImpl* NewL( MVoiceRecognitionDialogCallback* aObserver );
       
    61 
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         virtual ~CVoiceRecognitionDialogImpl();
       
    66 
       
    67     public:  // New functions
       
    68     
       
    69         /**
       
    70         * Executes the dialog
       
    71         */
       
    72         void ExecuteL();
       
    73 
       
    74         /**
       
    75         * Only calls will be allowed if device is locked
       
    76         */
       
    77         void SetOnlyCallsAllowed();
       
    78         
       
    79         /**
       
    80         * Handles property value change event.
       
    81         * @param aValue New property value
       
    82         */
       
    83         void HandlePropertyValueChange( TInt aValue );
       
    84         
       
    85         /**
       
    86         * Sets the next state
       
    87         * @param aNextState State which will be activated. Has no effect if value is NULL
       
    88         */
       
    89         void ChangeState( CState* aNextState );
       
    90         
       
    91         /**
       
    92         * Stops voice recognition
       
    93         */
       
    94         void Exit();
       
    95 
       
    96     protected:  // Functions from base classes
       
    97       
       
    98         /**
       
    99         * From MNssRecognizeInitCompleteHandler Called when recognition initialization is complete
       
   100         * @see MNssRecognizeInitCompleteHandler
       
   101         */
       
   102         void HandleRecognizeInitComplete( TNssRecognizeInitError aErrorCode );
       
   103 
       
   104 #ifndef __WINS__          
       
   105 #ifdef __FULLDUPLEX_CHANGE
       
   106         /**
       
   107         * From MNssRecognizeInitCompleteHandler Called when presampling startup is complete
       
   108         * @see MNssRecognizeInitCompleteHandler
       
   109         */
       
   110         void HandlePreSamplingStarted( TInt aErrorCode );
       
   111 #endif // __FULLDUPLEX_CHANGE
       
   112 #endif // __WINS__  
       
   113 
       
   114         /**
       
   115         * From MNssRecognizeEventHandler Called when recording has started
       
   116         * @see MNssRecognizeEventHandler
       
   117         */
       
   118         void HandleRecordStarted();
       
   119 
       
   120         /**
       
   121         * From MNssRecognizeEventHandler Called when end-of-utterance is detected
       
   122         * @see MNssRecognizeEventHandler
       
   123         */
       
   124         void HandleEouDetected();
       
   125 
       
   126         /**
       
   127         * From MNssRecognizeEventHandler Called when recognition is completed
       
   128         * @see MNssRecognizeEventHandler
       
   129         */
       
   130         void HandleRecognizeComplete( CArrayPtrFlat<MNssTag>* aTagList,
       
   131                                       TNssRecognizeError aErrorCode  );
       
   132 
       
   133         /**
       
   134         * From MKeyCallback Called when a softkey is pressed
       
   135         * @see MKeyCallback
       
   136         */
       
   137         void HandleKeypressL( TInt aSoftkey );
       
   138 
       
   139         /**
       
   140         * From MNssAdaptationEventHandler Called when
       
   141         * Adaptation is successful
       
   142         * @see MNssAdaptationEventHandler for more information
       
   143         */
       
   144         void HandleAdaptComplete( TInt aErrorCode );
       
   145         
       
   146         /**
       
   147         * From MMdaAudioPlayerCallback.
       
   148         * @see MMdaAudioPlayerCallback for more information.
       
   149         */
       
   150         void MapcInitComplete( TInt aError, 
       
   151                                const TTimeIntervalMicroSeconds& aDuration );
       
   152 
       
   153         /**
       
   154         * From MMdaAudioPlayerCallback
       
   155         * @see MMdaAudioPlayerCallback for more information.
       
   156         */
       
   157         void MapcPlayComplete( TInt aError );
       
   158 
       
   159         /**
       
   160         * From MTtsClientUtilityObserver
       
   161         * @see MTtsClientUtilityObserver for more information.
       
   162         */
       
   163         void MapcCustomCommandEvent( TInt aEvent, TInt aError );
       
   164 
       
   165         /**
       
   166         * From MGetContextClient
       
   167         * @see MGetContextClient for more information
       
   168         */        
       
   169         void GetContextCompleted( MNssContext* aContext, TInt aErrorCode );
       
   170 
       
   171         /**
       
   172         * From MGetContextClient
       
   173         * @see MGetContextClient for more information
       
   174         */        
       
   175         void GetContextListCompleted( MNssContextListArray *aContextList, TInt aErrorCode  );
       
   176         
       
   177         /**
       
   178         * From MNssGetTagClient
       
   179         * @see MNssGetTagClient for more information
       
   180         */  
       
   181         void GetTagListCompleted( MNssTagListArray* aTagList, TInt aErrorCode );
       
   182         
       
   183         /**
       
   184         * From MNssSaveContextClient
       
   185         * @see MNssSaveContextClient for more information
       
   186         */
       
   187         void SaveContextCompleted( TInt aErrorCode );
       
   188 
       
   189         /**
       
   190         * From MNssTrainTextEventHandler
       
   191         * @see MNssTrainTextEventHandler for more information
       
   192         */       
       
   193         void HandleTrainComplete( TInt aErrorCode );
       
   194         
       
   195         /**
       
   196         * From MNssSaveTagClient
       
   197         * @see MNssSaveTagClient for more information
       
   198         */  
       
   199         void SaveTagCompleted( TInt aErrorCode );
       
   200         
       
   201         /**
       
   202         * From MNssDeleteContextClient
       
   203         * @see MNssDeleteContextClient for more information
       
   204         */ 
       
   205         void DeleteContextCompleted( TInt aErrorCode );
       
   206 
       
   207     private: // Functions from base classes
       
   208 
       
   209         /**
       
   210         * From CActive.
       
   211         * Handle a change event.
       
   212         */
       
   213         void RunL();
       
   214 
       
   215         /**
       
   216         * From CActive.
       
   217         * Cancel the request to receive events.
       
   218         */
       
   219         void DoCancel();
       
   220 
       
   221     private:  // New functions
       
   222     
       
   223         /**
       
   224         * C++ default constructor.
       
   225         */
       
   226         CVoiceRecognitionDialogImpl( MVoiceRecognitionDialogCallback* aObserver );
       
   227         
       
   228         /**
       
   229         * Symbian OS 2nd phase constructor.
       
   230         */
       
   231         void ConstructL();
       
   232         
       
   233         /**
       
   234         * Checks if the state can be changed and waits until possible.
       
   235         */
       
   236         void CheckState();
       
   237 
       
   238     private:    // Data
       
   239 
       
   240         // For storing various things needed in different states
       
   241         CDataStorage*                       iDataStorage;
       
   242         
       
   243         // For storing global UI things
       
   244         CUiModel*                           iUiModel;
       
   245         
       
   246         // Current state
       
   247         CState*                             iState;
       
   248         
       
   249         // Next active state
       
   250         CState*                             iNextState;
       
   251         
       
   252         // Mutex
       
   253         RMutex                              iMutex;
       
   254         
       
   255         // Dialog observer
       
   256         MVoiceRecognitionDialogCallback*    iObserver;
       
   257    };
       
   258 
       
   259 #endif    // VUICVOICERECOGDIALOGIMPL_H
       
   260 
       
   261 // End of File
       
   262