srsf/vcommandhandler/src/vcommandrecogmanager.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:  Constructs / destroyes the recognition selection handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <nssvascvasdbmgr.h>
       
    20 #include <nssvasmcontextmgr.h>
       
    21 #include <nssvascselectnotificationbuilder.h>
       
    22 #include <nssvasmtagselectnotification.h>
       
    23 #include "vcommandinternalapi.h"
       
    24 #include "rubydebug.h"
       
    25 #include "vcommandrecogmanager.h"
       
    26 #include "vcommandrecoghandler.h"
       
    27 
       
    28 /**
       
    29 * Factory function
       
    30 */
       
    31 EXPORT_C CVCRecognitionManager* CVCRecognitionManager::NewL()
       
    32 	{
       
    33 	CVCRecognitionManager* self = new (ELeave) CVCRecognitionManager;
       
    34 	CleanupStack::PushL( self );
       
    35 	self->ConstructL();
       
    36 	CleanupStack::Pop( self );
       
    37 	return self;
       
    38 	}
       
    39 	
       
    40 /**
       
    41 * Destructor
       
    42 */	
       
    43 EXPORT_C CVCRecognitionManager::~CVCRecognitionManager()
       
    44 	{
       
    45 	RUBY_DEBUG0( "CVCRecognitionManager::~CVCRecognitionManager start" );
       
    46 	delete iRecognitionHandler;
       
    47 	delete iSelectNotificationBuilder;
       
    48 	RUBY_DEBUG0( "CVCRecognitionManager::~CVCRecognitionManager end" );
       
    49 	}
       
    50 
       
    51 /**
       
    52 * Second-phase constructor
       
    53 */
       
    54 void CVCRecognitionManager::ConstructL()
       
    55 	{
       
    56 	RUBY_DEBUG_BLOCK( "CVCRecognitionManager::ConstructL" );
       
    57 	CNssVASDBMgr* vasDbManager = CNssVASDBMgr::NewL();
       
    58 	CleanupStack::PushL( vasDbManager );
       
    59 	
       
    60     vasDbManager->InitializeL();
       
    61     MNssContextMgr* contextManager = vasDbManager->GetContextMgr();
       
    62       
       
    63     iSelectNotificationBuilder = CNssSelectNotificationBuilder::NewL();
       
    64     iSelectNotificationBuilder->InitializeL();
       
    65     MNssTagSelectNotification* tagSelectNotification = 
       
    66     				iSelectNotificationBuilder->GetTagSelectNotification();
       
    67 
       
    68     iRecognitionHandler = CVCRecognitionHandler::NewL();
       
    69     
       
    70     MNssContext* context = contextManager->CreateContextL();
       
    71     CleanupDeletePushL( context );
       
    72     context->SetNameL( KVoiceCommandContext );
       
    73     context->SetGlobal( ETrue );
       
    74     tagSelectNotification->RegisterL( context, iRecognitionHandler );
       
    75     // Context is copied inside RegisterL - no need to keep it anymore
       
    76     CleanupStack::PopAndDestroy( context );
       
    77 	CleanupStack::PopAndDestroy( vasDbManager );
       
    78 	}
       
    79 	
       
    80 //End of file