voiceui/voiceuivoicerecognition/src/vuicexecutestate.cpp
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2006 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include "vuicstate.h"
       
    22 #include "vuicexecutestate.h"
       
    23 #include "vuicexitstate.h"
       
    24 #include "vuicabortstate.h"
       
    25 
       
    26 #include "vuicdatastorage.h"
       
    27 #include "vuicuimodel.h"
       
    28 
       
    29 #include "vuicvoicerecogdialogimpl.h"
       
    30 #include "vuicglobalnote.h"
       
    31 
       
    32 #include "rubydebug.h"
       
    33     
       
    34 // -----------------------------------------------------------------------------
       
    35 // CExecuteState::NewL
       
    36 // Two-phased constructor.
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CExecuteState* CExecuteState::NewL( CDataStorage& aDataStorage, CUiModel& aUiModel )
       
    40     {
       
    41     CExecuteState* self = new (ELeave) CExecuteState( aDataStorage, aUiModel );
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL();
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     }       
       
    47     
       
    48 // Destructor       
       
    49 CExecuteState::~CExecuteState()
       
    50     {
       
    51     RUBY_DEBUG0( "CExecuteState::~CExecuteState START" );
       
    52     
       
    53     RUBY_DEBUG0( "CExecuteState::~CExecuteState EXIT" );
       
    54     }
       
    55     
       
    56 // ---------------------------------------------------------
       
    57 // CExecuteState::HandleEventL
       
    58 // ---------------------------------------------------------
       
    59 //       
       
    60 void CExecuteState::HandleEventL( TInt aEvent )
       
    61     {
       
    62     RUBY_DEBUG_BLOCK( "CExecuteState::HandleEventL" );
       
    63 
       
    64     CState* nextState = NULL;
       
    65 
       
    66     switch( aEvent )
       
    67         {
       
    68         case EShortKeypress:
       
    69         case ELongKeypress:
       
    70         case EEndCallKeypress:
       
    71         
       
    72             // Do nothing
       
    73             break;
       
    74             
       
    75         default:
       
    76         
       
    77             nextState = CExitState::NewL( DataStorage(), UiModel() );
       
    78             break;
       
    79         }
       
    80 
       
    81     DataStorage().VoiceRecognitionImpl()->ChangeState( nextState );
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // CExecuteState::ExecuteL
       
    86 // ---------------------------------------------------------
       
    87 //       
       
    88 void CExecuteState::ExecuteL()
       
    89     {
       
    90     RUBY_DEBUG_BLOCK( "CExecuteState::ExecuteL" );
       
    91             
       
    92     // Activate the selected voice tag
       
    93     MNssRecognitionHandler::TNssRecognitionResult result =
       
    94         DataStorage().RecognitionHandler()->SelectTagL( DataStorage().Tag() );
       
    95 
       
    96     if ( result != MNssRecognitionHandler::EVasErrorNone )
       
    97         {
       
    98         if ( !DataStorage().DeviceLockMode() )
       
    99             {
       
   100             UiModel().Note().DisplayGlobalNoteL( CGlobalNote::ESystemError );
       
   101             }
       
   102         }
       
   103 
       
   104     HandleEventL( KErrNone );
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------
       
   108 // CExecuteState::CExecuteState
       
   109 // ---------------------------------------------------------
       
   110 //              
       
   111 CExecuteState::CExecuteState( CDataStorage& aDataStorage, CUiModel& aUiModel )
       
   112  : CState( aDataStorage, aUiModel )
       
   113     {
       
   114     }
       
   115     
       
   116 // End of File
       
   117