srsf/sisrscontrollerplugin/src/sicontrollerplugininterface.cpp
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:  This is the main interface of the SI Controller Plugin.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "srsfbldvariant.hrh"
       
    21 #include <mmfcontrollerframeworkbase.h>
       
    22 #include <nsssispeechrecognitioncustomcommandparser.h>
       
    23 #include <implementationproxy.h>
       
    24 #include "sicontrollerplugininterface.h"
       
    25 #include "sicontrollerplugin.h"
       
    26 #include "sipluginimplementationuids.hrh"
       
    27 #include "rubydebug.h"
       
    28 
       
    29 // ============================= LOCAL FUNCTIONS ===============================
       
    30 
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CSIControllerPluginInterface::CSIControllerPluginInterface
       
    36 // C++ default constructor can NOT contain any code, that might leave.
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CSIControllerPluginInterface::CSIControllerPluginInterface()
       
    40     {
       
    41     RUBY_DEBUG0( "CSIControllerPluginInterface::CSIControllerPluginInterface" );
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CSIControllerPluginInterface::ConstructL
       
    46 // Symbian 2nd phase constructor can leave.
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 #ifndef __CONSOLETEST__
       
    50 
       
    51 void CSIControllerPluginInterface::ConstructL()
       
    52     {
       
    53     RUBY_DEBUG_BLOCK( "CSIControllerPluginInterface::ConstructL" );
       
    54     
       
    55     iController = CSIControllerPlugin::NewL(*this);
       
    56     
       
    57     CSISpeechRecognitionCustomCommandParser* speechRecognitionParser =
       
    58         CSISpeechRecognitionCustomCommandParser::NewL(*this);
       
    59     CleanupStack::PushL(speechRecognitionParser);
       
    60     AddCustomCommandParserL(*speechRecognitionParser);
       
    61     // The parser is owned by the controller framework
       
    62     CleanupStack::Pop(speechRecognitionParser);
       
    63     }
       
    64 
       
    65 #else	// __CONSOLETEST__ defined
       
    66 
       
    67 // Unit Test
       
    68 void CSIControllerPluginInterface::ConstructL( MSrsObserver* aObserver )
       
    69     {
       
    70     iController = CSIControllerPlugin::NewL(*this);
       
    71     iObserver = aObserver;
       
    72     }
       
    73 
       
    74 // Unit Test
       
    75 void CSIControllerPluginInterface::ConstructL()
       
    76     {
       
    77     iController = CSIControllerPlugin::NewL(*this);
       
    78     iObserver = NULL;
       
    79     }
       
    80 
       
    81 #endif	// __CONSOLETEST__
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CSIControllerPluginInterface::NewL
       
    85 // Two-phased constructor.
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 CSIControllerPluginInterface* CSIControllerPluginInterface::NewL()
       
    89     {
       
    90     RUBY_DEBUG_BLOCK( "CSIControllerPluginInterface::NewL" );
       
    91     
       
    92     CSIControllerPluginInterface* self = new( ELeave ) CSIControllerPluginInterface;
       
    93     CleanupStack::PushL( self );
       
    94     self->ConstructL();
       
    95     CleanupStack::Pop();
       
    96     return self;
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CSIControllerPluginInterface::~CSIControllerPluginInterface
       
   101 // Destructor.
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 CSIControllerPluginInterface::~CSIControllerPluginInterface()
       
   105     {
       
   106     RUBY_DEBUG0( "CSIControllerPluginInterface::~CSIControllerPluginInterface" );
       
   107     delete iController;
       
   108     }
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CSIControllerPluginInterface::AddDataSourceL
       
   112 // This function is not supported.
       
   113 // -----------------------------------------------------------------------------
       
   114 //
       
   115 void CSIControllerPluginInterface::AddDataSourceL( MDataSource& /*aDataSource*/ )
       
   116     {
       
   117     User::Leave( KErrNotSupported );
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // CSIControllerPluginInterface::AddDataSinkL
       
   122 // This function is not supported.
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 void CSIControllerPluginInterface::AddDataSinkL( MDataSink& /*aDataSink*/ )
       
   126     {
       
   127     User::Leave( KErrNotSupported );
       
   128     }
       
   129 
       
   130 // -----------------------------------------------------------------------------
       
   131 // CSIControllerPluginInterface::RemoveDataSourceL
       
   132 // This function is not supported.
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 void CSIControllerPluginInterface::RemoveDataSourceL( MDataSource& /*aDataSource*/ )
       
   136     {
       
   137     User::Leave( KErrNotSupported );
       
   138     }
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CSIControllerPluginInterface::RemoveDataSinkL
       
   142 // This function is not supported.
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 void CSIControllerPluginInterface::RemoveDataSinkL( MDataSink& /*aDataSink*/ )
       
   146     {
       
   147     User::Leave( KErrNotSupported );
       
   148     }
       
   149 
       
   150 // -----------------------------------------------------------------------------
       
   151 // CSIControllerPluginInterface::ResetL
       
   152 // This function is not supported.
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 void CSIControllerPluginInterface::ResetL()
       
   156     {
       
   157     User::Leave( KErrNotSupported );
       
   158     }
       
   159 
       
   160 // -----------------------------------------------------------------------------
       
   161 // CSIControllerPluginInterface::PrimeL
       
   162 // This function is not supported.
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 void CSIControllerPluginInterface::PrimeL()
       
   166     {
       
   167     User::Leave( KErrNotSupported );
       
   168     }
       
   169 
       
   170 // -----------------------------------------------------------------------------
       
   171 // CSIControllerPluginInterface::PlayL
       
   172 // This function is not supported.
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 void CSIControllerPluginInterface::PlayL()
       
   176     {
       
   177     User::Leave( KErrNotSupported );
       
   178     }
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // CSIControllerPluginInterface::PauseL
       
   182 // This function is not supported.
       
   183 // -----------------------------------------------------------------------------
       
   184 //
       
   185 void CSIControllerPluginInterface::PauseL()
       
   186     {
       
   187     User::Leave( KErrNotSupported );
       
   188     }
       
   189 
       
   190 // -----------------------------------------------------------------------------
       
   191 // CSIControllerPluginInterface::StopL
       
   192 // This function is not supported.
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 void CSIControllerPluginInterface::StopL()
       
   196     {
       
   197     User::Leave( KErrNotSupported );
       
   198     }
       
   199 
       
   200 // -----------------------------------------------------------------------------
       
   201 // CSIControllerPluginInterface::PositionL
       
   202 // This function is not supported.
       
   203 // -----------------------------------------------------------------------------
       
   204 //
       
   205 TTimeIntervalMicroSeconds CSIControllerPluginInterface::PositionL() const
       
   206     {
       
   207     User::Leave( KErrNotSupported );
       
   208     return TTimeIntervalMicroSeconds( 0 ); // Just to make the compiler happy
       
   209     }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CSIControllerPluginInterface::SetPositionL
       
   213 // This function is not supported.
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 void CSIControllerPluginInterface::SetPositionL( const TTimeIntervalMicroSeconds& /*aPosition*/ )
       
   217     {
       
   218     User::Leave( KErrNotSupported );
       
   219     }
       
   220 
       
   221 // -----------------------------------------------------------------------------
       
   222 // CSIControllerPluginInterface::DurationL
       
   223 // This function is not supported.
       
   224 // -----------------------------------------------------------------------------
       
   225 //
       
   226 TTimeIntervalMicroSeconds CSIControllerPluginInterface::DurationL() const
       
   227     {
       
   228     User::Leave( KErrNotSupported );
       
   229     return TTimeIntervalMicroSeconds( 0 ); // Just to make the compiler happy
       
   230     }
       
   231 
       
   232 // -----------------------------------------------------------------------------
       
   233 // CSIControllerPluginInterface::SetPrioritySettings
       
   234 // Set the priority settings for this controller.  This is used during recording
       
   235 // and playback.
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 void CSIControllerPluginInterface::SetPrioritySettings( const TMMFPrioritySettings& aPrioritySettings )
       
   239     {
       
   240     iController->SetPrioritySettings( aPrioritySettings );
       
   241     }
       
   242 
       
   243 // -----------------------------------------------------------------------------
       
   244 // CSIControllerPluginInterface::GetNumberOfMetaDataEntriesL
       
   245 // This function is not supported.
       
   246 // -----------------------------------------------------------------------------
       
   247 //
       
   248 void CSIControllerPluginInterface::GetNumberOfMetaDataEntriesL( TInt& /*aNumberOfEntries*/ )
       
   249     {
       
   250     User::Leave( KErrNotSupported );
       
   251     }
       
   252 
       
   253 // -----------------------------------------------------------------------------
       
   254 // CSIControllerPluginInterface::GetMetaDataEntryL
       
   255 // This function is not supported.
       
   256 // -----------------------------------------------------------------------------
       
   257 //
       
   258 CMMFMetaDataEntry* CSIControllerPluginInterface::GetMetaDataEntryL( TInt /*aIndex*/ )
       
   259     {
       
   260     User::Leave( KErrNotSupported );
       
   261     return NULL; // Just to make the compiler happy
       
   262     }
       
   263 
       
   264 // -----------------------------------------------------------------------------
       
   265 // CSIControllerPluginInterface::MSrAddPronunciationL
       
   266 // Adds a new pronunciation into the lexicon.
       
   267 // -----------------------------------------------------------------------------
       
   268 //
       
   269 void CSIControllerPluginInterface::MSrAddPronunciationL( TSILexiconID aLexiconID,
       
   270                                                          TSIModelBankID aModelBankID,
       
   271                                                          TSIModelID aModelID,
       
   272                                                          TSIPronunciationID& aPronunciationID )
       
   273     {
       
   274     iController->AddPronunciationL(aLexiconID, aModelBankID, aModelID, aPronunciationID);
       
   275     }
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // CSIControllerPluginInterface::MSrAddRuleL
       
   279 // Adds a new rule into the grammar.
       
   280 // -----------------------------------------------------------------------------
       
   281 //
       
   282 void CSIControllerPluginInterface::MSrAddRuleL( TSIGrammarID /*aGrammarID*/,
       
   283                                                 TSILexiconID /*aLexiconID*/,
       
   284                                                 TSIPronunciationID /*aPronunciationID*/,
       
   285                                                 TSIRuleID& /*aRuleID*/ )
       
   286     {
       
   287     User::Leave( KErrNotSupported );	
       
   288     }
       
   289 
       
   290 // -----------------------------------------------------------------------------
       
   291 // CSIControllerPluginInterface::MSrCancel
       
   292 // Cancels the current activity and returns the plugin to Idle state.
       
   293 // -----------------------------------------------------------------------------
       
   294 //
       
   295 void CSIControllerPluginInterface::MSrCancel()
       
   296     {
       
   297     iController->Cancel();
       
   298     }
       
   299 
       
   300 // -----------------------------------------------------------------------------
       
   301 // CSIControllerPluginInterface::MSrCommitTrainL
       
   302 // Training is complete.  Call model database handler to save the model into the
       
   303 // -----------------------------------------------------------------------------
       
   304 //
       
   305 void CSIControllerPluginInterface::MSrCommitChangesL()
       
   306     {
       
   307     iController->CommitChangesL( ETrue );
       
   308     }
       
   309 
       
   310 // -----------------------------------------------------------------------------
       
   311 // CSIControllerPluginInterface::MSrCreateGrammarL
       
   312 // Creates a new grammar.
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 void CSIControllerPluginInterface::MSrCreateGrammarL( TSIGrammarID& aGrammarID )
       
   316     {
       
   317     iController->CreateGrammarL( aGrammarID );
       
   318     }
       
   319 
       
   320 // -----------------------------------------------------------------------------
       
   321 // CSIControllerPluginInterface::MSrCreateLexiconL
       
   322 // Creates a new lexicon.
       
   323 // -----------------------------------------------------------------------------
       
   324 //
       
   325 void CSIControllerPluginInterface::MSrCreateLexiconL( TSILexiconID& aLexiconID )
       
   326     {
       
   327     iController->CreateLexiconL( aLexiconID );
       
   328     }
       
   329 
       
   330 // -----------------------------------------------------------------------------
       
   331 // CSIControllerPluginInterface::MSrCreateModelBankL
       
   332 // Creates a new model bank.
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 void CSIControllerPluginInterface::MSrCreateModelBankL( TSIModelBankID& aModelBankID )
       
   336     {
       
   337     iController->CreateModelBankL( aModelBankID );
       
   338     }
       
   339 
       
   340 // -----------------------------------------------------------------------------
       
   341 // CSIControllerPluginInterface::MSrEndRecSessionL
       
   342 // Ends recognition session and releases resources.
       
   343 // -----------------------------------------------------------------------------
       
   344 //
       
   345 void CSIControllerPluginInterface::MSrEndRecSessionL()
       
   346     {
       
   347     iController->EndRecSessionL();
       
   348     }
       
   349 
       
   350 // -----------------------------------------------------------------------------
       
   351 // CSIControllerPluginInterface::MSrGetAllClientGrammarIDsL
       
   352 // Returns all grammar Ids that belong to the current client.
       
   353 // -----------------------------------------------------------------------------
       
   354 //
       
   355 void CSIControllerPluginInterface::MSrGetAllClientGrammarIDsL( RArray<TSIGrammarID>& aGrammarIDs )
       
   356     {
       
   357     iController->GetAllClientGrammarIDsL( aGrammarIDs );
       
   358     }
       
   359 
       
   360 // -----------------------------------------------------------------------------
       
   361 // CSIControllerPluginInterface::MSrGetAllClientLexiconIDsL
       
   362 // Returns all lexicon Ids that belong to the current client.
       
   363 // -----------------------------------------------------------------------------
       
   364 //
       
   365 void CSIControllerPluginInterface::MSrGetAllClientLexiconIDsL( RArray<TSILexiconID>& aLexiconIDs )
       
   366     {
       
   367     iController->GetAllClientLexiconIDsL( aLexiconIDs );
       
   368     }
       
   369 
       
   370 // -----------------------------------------------------------------------------
       
   371 // CSIControllerPluginInterface::MSrGetAllClientModelBankIDsL
       
   372 // Returns all model bank Ids that belong to the current client.
       
   373 // -----------------------------------------------------------------------------
       
   374 //
       
   375 void CSIControllerPluginInterface::MSrGetAllClientModelBankIDsL( RArray<TSIModelBankID>& aModelBankIDs )
       
   376     {
       
   377     iController->GetAllClientModelBankIDsL( aModelBankIDs );
       
   378     }
       
   379 
       
   380 // -----------------------------------------------------------------------------
       
   381 // CSIControllerPluginInterface::MSrGetAllGrammarIDsL
       
   382 // Returns all grammar Ids that exist (for all clients).
       
   383 // -----------------------------------------------------------------------------
       
   384 //
       
   385 void CSIControllerPluginInterface::MSrGetAllGrammarIDsL( RArray<TSIGrammarID>& aGrammarIDs )
       
   386     {
       
   387     iController->GetAllGrammarIDsL( aGrammarIDs );
       
   388     }
       
   389 
       
   390 // -----------------------------------------------------------------------------
       
   391 // CSIControllerPluginInterface::MSrGetAllLexiconIDsL
       
   392 // Returns all lexicon Ids that exist (for all clients).
       
   393 // -----------------------------------------------------------------------------
       
   394 //
       
   395 void CSIControllerPluginInterface::MSrGetAllLexiconIDsL( RArray<TSILexiconID>& aLexiconIDs )
       
   396     {
       
   397     iController->GetAllLexiconIDsL( aLexiconIDs );
       
   398     }
       
   399 
       
   400 // -----------------------------------------------------------------------------
       
   401 // CSIControllerPluginInterface::MSrGetAllModelBankIDsL
       
   402 // Returns all model bank Ids that exist (for all clients).
       
   403 // -----------------------------------------------------------------------------
       
   404 //
       
   405 void CSIControllerPluginInterface::MSrGetAllModelBankIDsL( RArray<TSIModelBankID>& aModelBankIDs )
       
   406     {
       
   407     iController->GetAllModelBankIDsL( aModelBankIDs );
       
   408     }
       
   409 
       
   410 // -----------------------------------------------------------------------------
       
   411 // CSIControllerPluginInterface::MSrGetAllModelIDsL
       
   412 // Gets all model IDs in the model bank.
       
   413 // -----------------------------------------------------------------------------
       
   414 //
       
   415 void CSIControllerPluginInterface::MSrGetAllModelIDsL( TSIModelBankID aModelBankID,
       
   416                                                        RArray<TSIModelID>& aModelIDs )
       
   417     {
       
   418     iController->GetAllModelIDsL( aModelBankID, aModelIDs );
       
   419     }
       
   420 
       
   421 // -----------------------------------------------------------------------------
       
   422 // CSIControllerPluginInterface::MSrGetAllPronunciationIDsL
       
   423 // Gets all pronunciation IDs in the lexicon.
       
   424 // -----------------------------------------------------------------------------
       
   425 //
       
   426 void CSIControllerPluginInterface::MSrGetAllPronunciationIDsL( TSILexiconID aLexiconID,
       
   427                                                                RArray<TSIPronunciationID>& aPronunciationIDs )
       
   428     {
       
   429     iController->GetAllPronunciationIDsL( aLexiconID, aPronunciationIDs );
       
   430     }
       
   431 
       
   432 // -----------------------------------------------------------------------------
       
   433 // CSIControllerPluginInterface::MSrGetAllRuleIDsL
       
   434 // Gets all rule IDs in the grammar.
       
   435 // -----------------------------------------------------------------------------
       
   436 //
       
   437 void CSIControllerPluginInterface::MSrGetAllRuleIDsL( TSIGrammarID aGrammarID,
       
   438                                                       RArray<TSIRuleID>& aRuleIDs )
       
   439     {
       
   440     iController->GetAllRuleIDsL( aGrammarID, aRuleIDs );
       
   441     }
       
   442 
       
   443 // -----------------------------------------------------------------------------
       
   444 // CSIControllerPluginInterface::MSrGetAvailableStorageL
       
   445 // Calculates the available number of models that can be trained by subtracting
       
   446 // the current total from the system defined max.
       
   447 // -----------------------------------------------------------------------------
       
   448 //
       
   449 void CSIControllerPluginInterface::MSrGetAvailableStorageL( TInt& /*aCount*/ )
       
   450     {
       
   451     User::Leave( KErrNotSupported );
       
   452     }
       
   453 
       
   454 // -----------------------------------------------------------------------------
       
   455 // CSIControllerPluginInterface::MSrGetEnginePropertiesL
       
   456 // Returns the current recognition engine properties.
       
   457 // -----------------------------------------------------------------------------
       
   458 //
       
   459 void CSIControllerPluginInterface::MSrGetEnginePropertiesL( const RArray<TInt>& aPropertyId,
       
   460                                                             RArray<TInt>& aPropertyValue )
       
   461     {
       
   462     iController->GetEnginePropertiesL( aPropertyId, aPropertyValue );
       
   463     }
       
   464 
       
   465 // -----------------------------------------------------------------------------
       
   466 // CSIControllerPluginInterface::MSrGetModelCountL
       
   467 // Gets the number of models in a model bank.
       
   468 // -----------------------------------------------------------------------------
       
   469 //
       
   470 void CSIControllerPluginInterface::MSrGetModelCountL( TSIModelBankID aModelBankID,
       
   471 													  TInt& aCount )
       
   472     {
       
   473     iController->GetModelCountL( aModelBankID, aCount );
       
   474     }
       
   475 
       
   476 // -----------------------------------------------------------------------------
       
   477 // CSIControllerPluginInterface::MSrGetPronunciationCountL
       
   478 //  
       
   479 // -----------------------------------------------------------------------------
       
   480 //
       
   481 void CSIControllerPluginInterface::MSrGetPronunciationCountL( TSILexiconID aLexiconID, 
       
   482                                                               TInt& aCount )
       
   483     {
       
   484     iController->GetPronunciationCountL( aLexiconID, aCount );
       
   485     }
       
   486 
       
   487 // -----------------------------------------------------------------------------
       
   488 // CSIControllerPluginInterface::MSrGetRuleCountL
       
   489 //  
       
   490 // -----------------------------------------------------------------------------
       
   491 //	
       
   492 void CSIControllerPluginInterface::MSrGetRuleCountL( TSIGrammarID aGrammarID, TInt& aCount )
       
   493     {
       
   494     iController->GetRuleCountL(aGrammarID, aCount);
       
   495     }
       
   496 
       
   497 // -----------------------------------------------------------------------------
       
   498 // CSIControllerPluginInterface::MSrGetRuleValidityL
       
   499 // Checks to see if a rule exists in the specified grammar or not.
       
   500 // -----------------------------------------------------------------------------
       
   501 //
       
   502 void CSIControllerPluginInterface::MSrGetRuleValidityL( TSIGrammarID aGrammarID,
       
   503                                                         TSIRuleID aRuleID,
       
   504                                                         TBool& aValid )
       
   505     {
       
   506     iController->GetRuleValidityL(aGrammarID, aRuleID, aValid);
       
   507     }
       
   508 
       
   509 // -----------------------------------------------------------------------------
       
   510 // CSIControllerPluginInterface::MSrGetUtteranceDurationL
       
   511 // Gets the duration of an utterance.
       
   512 // -----------------------------------------------------------------------------
       
   513 //
       
   514 void CSIControllerPluginInterface::MSrGetUtteranceDurationL( TSIModelBankID /*aModelBankID*/,
       
   515                                                              TSIModelID /*aModelID*/,
       
   516                                                              TTimeIntervalMicroSeconds32& /*aDuration*/ )
       
   517     {
       
   518     User::Leave(KErrNotSupported);	
       
   519     }
       
   520 
       
   521 // -----------------------------------------------------------------------------
       
   522 // CSIControllerPluginInterface::MSrLoadEngineParametersL
       
   523 // Loads the specified recognizer parameter(s).  These parameters are used to
       
   524 // alter the recognizer's default parameters.  The parameters are specified as
       
   525 // attribute and value pairs.
       
   526 // -----------------------------------------------------------------------------
       
   527 //
       
   528 void CSIControllerPluginInterface::MSrLoadEngineParametersL( const RArray<TInt>& aParameterId,
       
   529                                                              const RArray<TInt>& aParameterValue )
       
   530     {
       
   531     iController->LoadEngineParametersL(aParameterId, aParameterValue);
       
   532     }
       
   533 
       
   534 // -----------------------------------------------------------------------------
       
   535 // CSIControllerPluginInterface::MSrLoadGrammarL
       
   536 // Loads the specified grammar into the recognizer.
       
   537 // -----------------------------------------------------------------------------
       
   538 //
       
   539 void CSIControllerPluginInterface::MSrLoadGrammarL( TSIGrammarID aGrammarID )
       
   540     {
       
   541     iController->LoadGrammarL(aGrammarID);
       
   542     }
       
   543 
       
   544 // -----------------------------------------------------------------------------
       
   545 // CSIControllerPluginInterface::MSrLoadLexiconL
       
   546 // Loads the specified lexicon into the recognizer.
       
   547 // -----------------------------------------------------------------------------
       
   548 //
       
   549 void CSIControllerPluginInterface::MSrLoadLexiconL( TSILexiconID /*aLexiconID*/ )
       
   550     {
       
   551     User::Leave(KErrNotSupported);	
       
   552     }
       
   553 
       
   554 // -----------------------------------------------------------------------------
       
   555 // CSIControllerPluginInterface::MSrLoadModelsL
       
   556 // Loads the specified model bank into the recognizer.
       
   557 // -----------------------------------------------------------------------------
       
   558 //
       
   559 void CSIControllerPluginInterface::MSrLoadModelsL( TSIModelBankID aModelBankID)
       
   560     {
       
   561     iController->LoadModelsL(aModelBankID);
       
   562     }
       
   563 
       
   564 // -----------------------------------------------------------------------------
       
   565 // CSIControllerPluginInterface::MSrActivateGrammarL
       
   566 //  
       
   567 // -----------------------------------------------------------------------------
       
   568 //
       
   569 void CSIControllerPluginInterface::MSrActivateGrammarL( TSIGrammarID aGrammarID )
       
   570     {
       
   571     iController->ActivateGrammarL(aGrammarID );
       
   572     } 
       
   573 // -----------------------------------------------------------------------------
       
   574 // CSIControllerPluginInterface::MSrDeactivateGrammarL
       
   575 //  
       
   576 // -----------------------------------------------------------------------------
       
   577 //
       
   578 void CSIControllerPluginInterface::MSrDeactivateGrammarL( TSIGrammarID aGrammarID )
       
   579     {
       
   580     iController->DeactivateGrammarL(aGrammarID);
       
   581     } 
       
   582 
       
   583 // -----------------------------------------------------------------------------
       
   584 // CSIControllerPluginInterface::MSrPlayUtteranceL
       
   585 // Plays the user utterance.
       
   586 // -----------------------------------------------------------------------------
       
   587 //
       
   588 void CSIControllerPluginInterface::MSrPlayUtteranceL( TSIModelBankID /*aModelBankID*/,
       
   589                                                       TSIModelID /*aModelID*/ )
       
   590     {
       
   591     // Not supported in SI 
       
   592     User::Leave(KErrNotSupported);	
       
   593     }
       
   594 
       
   595 // -----------------------------------------------------------------------------
       
   596 // CSIControllerPluginInterface::MSrRecognizeL
       
   597 // Initiates recognition towards the recognizer.
       
   598 // -----------------------------------------------------------------------------
       
   599 //
       
   600 void CSIControllerPluginInterface::MSrRecognizeL( CSDClientResultSet& /*aResultSet*/ )
       
   601     {
       
   602     // Not supported in SI 
       
   603     User::Leave(KErrNotSupported);	
       
   604     //	iController->RecognizeL(aResultSet);
       
   605     }
       
   606 
       
   607 // -----------------------------------------------------------------------------
       
   608 // CSIControllerPluginInterface::MSrRecordL
       
   609 // Initiates recording of user utterance.
       
   610 // -----------------------------------------------------------------------------
       
   611 //
       
   612 void CSIControllerPluginInterface::MSrRecordL( TTimeIntervalMicroSeconds32 aRecordTime )
       
   613     {
       
   614     iController->RecordL(aRecordTime);
       
   615     }
       
   616     
       
   617 // -----------------------------------------------------------------------------
       
   618 // CSIControllerPluginInterface::MSrPreStartSamplingL
       
   619 // Starts sampling
       
   620 // -----------------------------------------------------------------------------
       
   621 //
       
   622 void CSIControllerPluginInterface::MSrPreStartSamplingL()
       
   623     {
       
   624     iController->PreStartSamplingL();
       
   625     }
       
   626 
       
   627 // -----------------------------------------------------------------------------
       
   628 // CSIControllerPluginInterface::MSrRemoveGrammarL
       
   629 // Removes the specified grammar from the permanent storage.
       
   630 // -----------------------------------------------------------------------------
       
   631 //
       
   632 void CSIControllerPluginInterface::MSrRemoveGrammarL( TSIGrammarID aGrammarID )
       
   633     {
       
   634     iController->RemoveGrammarL(aGrammarID);
       
   635     }
       
   636 
       
   637 // -----------------------------------------------------------------------------
       
   638 // CSIControllerPluginInterface::MSrRemoveLexiconL
       
   639 // Removes the specified lexicon from the permanent storage.
       
   640 // -----------------------------------------------------------------------------
       
   641 //
       
   642 void CSIControllerPluginInterface::MSrRemoveLexiconL( TSILexiconID aLexiconID )
       
   643     {
       
   644     iController->RemoveLexiconL(aLexiconID);
       
   645     }
       
   646 
       
   647 // -----------------------------------------------------------------------------
       
   648 // CSIControllerPluginInterface::MSrRemoveModelBankL
       
   649 // Removes the specified model bank from the permanent storage.
       
   650 // -----------------------------------------------------------------------------
       
   651 //
       
   652 void CSIControllerPluginInterface::MSrRemoveModelBankL( TSIModelBankID aModelBankID )
       
   653     {
       
   654     iController->RemoveModelBankL(aModelBankID);
       
   655     }
       
   656 
       
   657 
       
   658 // -----------------------------------------------------------------------------
       
   659 // CSIControllerPluginInterface::MSrRemoveModelL
       
   660 // Removes the specified model from the specified model bank.
       
   661 // -----------------------------------------------------------------------------
       
   662 //
       
   663 void CSIControllerPluginInterface::MSrRemoveModelL( TSIModelBankID /*aModelBankID*/,
       
   664                                                     TSIModelID /*aModelID*/ )
       
   665     {
       
   666     User::Leave(KErrNotSupported);	
       
   667     }
       
   668 
       
   669 // -----------------------------------------------------------------------------
       
   670 // CSIControllerPluginInterface::MSrRemovePronunciationL
       
   671 // Removes the specified pronunciation from the specified lexicon.
       
   672 // -----------------------------------------------------------------------------
       
   673 //
       
   674 void CSIControllerPluginInterface::MSrRemovePronunciationL( TSILexiconID aLexiconID,
       
   675                                                             TSIPronunciationID aPronunciationID )
       
   676     {
       
   677     iController->RemovePronunciationL(aLexiconID, aPronunciationID);
       
   678     }
       
   679 
       
   680 // -----------------------------------------------------------------------------
       
   681 // CSIControllerPluginInterface::MSrRemoveRuleL
       
   682 // Removes the specified rule from the specified grammar.
       
   683 // -----------------------------------------------------------------------------
       
   684 //
       
   685 void CSIControllerPluginInterface::MSrRemoveRuleL( TSIGrammarID aGrammarID,
       
   686                                                    TSIRuleID aRuleID )
       
   687     {
       
   688     iController->RemoveRuleL(aGrammarID, aRuleID);
       
   689     }
       
   690 
       
   691 // -----------------------------------------------------------------------------
       
   692 // CSIControllerPluginInterface::MSrRemoveRulesL
       
   693 // Removes the specified rules from the specified grammar.
       
   694 // -----------------------------------------------------------------------------
       
   695 //
       
   696 void CSIControllerPluginInterface::MSrRemoveRulesL( TSIGrammarID aGrammarID,
       
   697                                                     RArray<TSIRuleID>& aRuleIDs )
       
   698     {
       
   699     //   User::Leave( KErrNotSupported );
       
   700     iController->RemoveRulesL(aGrammarID, aRuleIDs);
       
   701     }
       
   702 
       
   703 // -----------------------------------------------------------------------------
       
   704 // CSIControllerPluginInterface::MSrSetClientUid
       
   705 // Sets the client's UID for data ownership identification.
       
   706 // -----------------------------------------------------------------------------
       
   707 //
       
   708 void CSIControllerPluginInterface::MSrSetClientUid( TUid aClientUid )
       
   709     {
       
   710     iController->SetClientUid(aClientUid);
       
   711     }
       
   712 
       
   713 // -----------------------------------------------------------------------------
       
   714 // CSIControllerPluginInterface::MSrStartRecSessionL
       
   715 // Starts a new recognition session.
       
   716 // -----------------------------------------------------------------------------
       
   717 //
       
   718 void CSIControllerPluginInterface::MSrStartRecSessionL( TNSSRecognitionMode aMode )
       
   719     { 
       
   720     if ( aMode == ENSSSiMode)
       
   721         {
       
   722         iController->StartRecSessionL();
       
   723         }
       
   724     else
       
   725         {
       
   726         User::Leave(KErrNotSupported);
       
   727         }
       
   728     }
       
   729 
       
   730 // -----------------------------------------------------------------------------
       
   731 // CSIControllerPluginInterface::MSrTrainL
       
   732 // Trains a new model into the specified model bank.
       
   733 // -----------------------------------------------------------------------------
       
   734 //
       
   735 void CSIControllerPluginInterface::MSrTrainL( TSIModelBankID aModelBankID,
       
   736                                               TSIModelID& aModelID )
       
   737     {
       
   738     iController->TrainL(aModelBankID, aModelID);
       
   739     }
       
   740 
       
   741 // -----------------------------------------------------------------------------
       
   742 // CSIControllerPluginInterface::MSrUnloadRuleL
       
   743 // Unloads a rule from the recognizer for this recognition session.
       
   744 // -----------------------------------------------------------------------------
       
   745 //
       
   746 void CSIControllerPluginInterface::MSrUnloadRuleL( TSIGrammarID aGrammarID,
       
   747                                                    TSIRuleID aRuleID )
       
   748     {
       
   749     iController->UnloadRuleL(aGrammarID, aRuleID);
       
   750     }
       
   751 
       
   752 
       
   753 ///SI only functionalities
       
   754 // -----------------------------------------------------------------------------
       
   755 // CSIControllerPluginInterface::MSrAdaptL
       
   756 // Does speaker adapation to speaker independent models
       
   757 // -----------------------------------------------------------------------------
       
   758 //
       
   759 void CSIControllerPluginInterface::MSrAdaptL( CSIClientResultSet& aResultSet,
       
   760                                               TInt aCorrect)
       
   761     {
       
   762     iController->AdaptL( aResultSet, aCorrect );
       
   763     }
       
   764 
       
   765 // -----------------------------------------------------------------------------
       
   766 // CSIControllerPluginInterface::MSrAddPronunciationL
       
   767 // AAdds a new pronunciation for the given model into the specified lexicon.
       
   768 // -----------------------------------------------------------------------------
       
   769 //
       
   770 void CSIControllerPluginInterface::MSrAddPronunciationL( TSILexiconID aLexiconID, 
       
   771                                                          const TDesC& aTrainText,
       
   772                                                          TLanguage aLanguage, 
       
   773                                                          TSIPronunciationID& aPronunciationID )
       
   774     {
       
   775     iController->AddPronunciationL( aLexiconID, aTrainText,aLanguage,aPronunciationID );
       
   776     }
       
   777 
       
   778 // -----------------------------------------------------------------------------
       
   779 // CSIControllerPluginInterface::MSrAddRuleVariantL
       
   780 // Adds a new rule variant for the given pronunciation into the specified grammar.
       
   781 // -----------------------------------------------------------------------------
       
   782 //
       
   783 void CSIControllerPluginInterface::MSrAddRuleVariantL( TSIGrammarID aGrammarID, 
       
   784                                                        TSILexiconID aLexiconID,
       
   785                                                        RArray<TSIPronunciationID>& aPronunciationIDs,
       
   786                                                        TSIRuleID aRuleID,
       
   787                                                        TSIRuleVariantID& aRuleVariantID ) 
       
   788     {
       
   789     iController->AddRuleVariantL( aGrammarID, aLexiconID, aPronunciationIDs,
       
   790                                   aRuleID, aRuleVariantID ) ;
       
   791     }
       
   792 
       
   793 // -----------------------------------------------------------------------------
       
   794 // CSIControllerPluginInterface::MSrAddVoiceTagsL
       
   795 // Trains a new voice tag. The recognition phrase is the concatenation of words in the aTrainArray. 
       
   796 // Pronunciations are created with all given languages, which are supported.
       
   797 // -----------------------------------------------------------------------------
       
   798 //
       
   799 void CSIControllerPluginInterface::MSrAddVoiceTagsL( RPointerArray<MDesCArray>* aTrainArray,
       
   800                                                      RArray<TLanguage>& aLanguageArray, 
       
   801                                                      TSILexiconID aLexiconID,
       
   802                                                      TSIGrammarID aGrammarID,
       
   803                                                      RArray<TSIRuleID>& aRuleID ) 
       
   804     {
       
   805     iController->AddVoiceTagsL( *aTrainArray, aLanguageArray,   aLexiconID,
       
   806                                  aGrammarID, aRuleID );
       
   807     }
       
   808 
       
   809 
       
   810 // -----------------------------------------------------------------------------
       
   811 // CSIControllerPluginInterface::MSrAddVoiceTagL
       
   812 // Trains a new voice tag.
       
   813 // -----------------------------------------------------------------------------
       
   814 //
       
   815 void CSIControllerPluginInterface::MSrAddVoiceTagL( MDesCArray& aTrainArray, 
       
   816                                                     RArray<TLanguage>& aLanguageArray, 
       
   817                                                     TSILexiconID aLexiconID,
       
   818                                                     TSIGrammarID aGrammarID, 
       
   819                                                     TSIRuleID& aRuleID) 
       
   820     {
       
   821     iController->AddVoiceTagL( aTrainArray, aLanguageArray,   aLexiconID,
       
   822                                aGrammarID,  aRuleID );
       
   823     }
       
   824 
       
   825 #ifdef __SINDE_TRAINING
       
   826 // -----------------------------------------------------------------------------
       
   827 // CSIControllerPluginInterface::MSrAddSindeVoiceTagL
       
   828 // Trains a new SINDE voice tag.
       
   829 // -----------------------------------------------------------------------------
       
   830 //
       
   831 void CSIControllerPluginInterface::MSrAddSindeVoiceTagL( MDesCArray& aTrainArray,
       
   832                                                          RArray<RLanguageArray>& aLanguageArray,
       
   833                                                          TSILexiconID aLexiconID,
       
   834                                                          TSIGrammarID aGrammarID,
       
   835                                                          TSIRuleID& aRuleID )
       
   836     {
       
   837     iController->AddSindeVoiceTagL( aTrainArray, aLanguageArray,
       
   838                                     aLexiconID, aGrammarID, aRuleID );
       
   839     }
       
   840 
       
   841 // -----------------------------------------------------------------------------
       
   842 // CSIControllerPluginInterface::MSrAddSindeVoiceTagL
       
   843 // Trains a new SINDE voice tag.
       
   844 // -----------------------------------------------------------------------------
       
   845 //    
       
   846 void CSIControllerPluginInterface::CSIControllerPluginInterface::MSrAddSindeVoiceTagsL( RPointerArray<MDesCArray>* aTrainArray,
       
   847                                                                                         RArray<RLanguageArray>& aLanguageArray,
       
   848                                                                                         TSILexiconID aLexiconID,
       
   849                                                                                         TSIGrammarID aGrammarID,
       
   850                                                                                         RArray<TSIRuleID>& aRuleID )
       
   851     {
       
   852     iController->AddSindeVoiceTagsL( *aTrainArray, aLanguageArray,
       
   853                                      aLexiconID, aGrammarID, aRuleID );
       
   854     }
       
   855 
       
   856 #else // __SINDE_TRAINING
       
   857 
       
   858 // -----------------------------------------------------------------------------
       
   859 // CSIControllerPluginInterface::MSrAddSindeVoiceTagL
       
   860 // Trains a new SINDE voice tag.
       
   861 // -----------------------------------------------------------------------------
       
   862 //
       
   863 void CSIControllerPluginInterface::MSrAddSindeVoiceTagL( MDesCArray& /*aTrainArray*/,
       
   864                                                          RArray<RLanguageArray>& /*aLanguageArray*/,
       
   865                                                          TSILexiconID /*aLexiconID*/,
       
   866                                                          TSIGrammarID /*aGrammarID*/,
       
   867                                                          TSIRuleID& /*aRuleID*/ )
       
   868     {
       
   869     User::Leave( KErrNotSupported );
       
   870     }
       
   871 
       
   872 // -----------------------------------------------------------------------------
       
   873 // CSIControllerPluginInterface::MSrAddSindeVoiceTagL
       
   874 // Trains a new SINDE voice tag.
       
   875 // -----------------------------------------------------------------------------
       
   876 //    
       
   877 void CSIControllerPluginInterface::CSIControllerPluginInterface::MSrAddSindeVoiceTagsL( RPointerArray<MDesCArray>* /*aTrainArray*/,
       
   878                                                                                         RArray<RLanguageArray>& /*aLanguageArray*/,
       
   879                                                                                         TSILexiconID /*aLexiconID*/,
       
   880                                                                                         TSIGrammarID /*aGrammarID*/,
       
   881                                                                                         RArray<TSIRuleID>& /*aRuleID*/ )
       
   882     {
       
   883     User::Leave( KErrNotSupported );
       
   884     }
       
   885 
       
   886 #endif // __SINDE_TRAINING
       
   887     
       
   888 
       
   889 
       
   890 // -----------------------------------------------------------------------------
       
   891 // CSIControllerPluginInterface::MSrCreateRuleL
       
   892 // Creates a new empty rule.
       
   893 // -----------------------------------------------------------------------------
       
   894 //
       
   895 void CSIControllerPluginInterface::MSrCreateRuleL( TSIGrammarID aGrammarID, 
       
   896                                                    TSIRuleID& aRuleID )  
       
   897     {
       
   898     iController->CreateRuleL( aGrammarID, aRuleID );
       
   899     }
       
   900 
       
   901 // -----------------------------------------------------------------------------
       
   902 // CSIControllerPluginInterface::MSrRecognizeL
       
   903 // Initiates recognition; performed following loading of model bank, lexicon, and grammar
       
   904 // -----------------------------------------------------------------------------
       
   905 //
       
   906 void CSIControllerPluginInterface::MSrRecognizeL( CSIClientResultSet& aResultSet ) 
       
   907     {
       
   908     iController->RecognizeL( aResultSet );
       
   909     }
       
   910 
       
   911 // -----------------------------------------------------------------------------
       
   912 // CSIControllerPluginInterface::MSrEndRecordL
       
   913 // Ends recording. Unlike Cancel(), this function may return a recognition
       
   914 // result if adequate number of samples was already recorded. 
       
   915 // -----------------------------------------------------------------------------
       
   916 //
       
   917 void CSIControllerPluginInterface::MSrEndRecordL() 
       
   918     {
       
   919     iController->EndRecordL();
       
   920     }
       
   921 
       
   922 // -----------------------------------------------------------------------------
       
   923 // CSIControllerPluginInterface::MSrUnloadGrammarL
       
   924 // Unloads the specified grammar from the temporary memory, 
       
   925 // previously loaded with MSrLoadGrammarL. The grammar in the permanent storage remains intact. 
       
   926 // result if adequate number of samples was already recorded.		        
       
   927 // -----------------------------------------------------------------------------
       
   928 //
       
   929 void CSIControllerPluginInterface::MSrUnloadGrammarL( TSIGrammarID aGrammarID ) 
       
   930     {
       
   931     iController->UnloadGrammarL( aGrammarID ) ;
       
   932     }
       
   933 
       
   934 // -----------------------------------------------------------------------------
       
   935 // CSIControllerPluginInterface::SendSrsEvent
       
   936 // Sends an event to the client.
       
   937 // -----------------------------------------------------------------------------
       
   938 //
       
   939 #ifndef __CONSOLETEST__
       
   940 
       
   941 void CSIControllerPluginInterface::SendSrsEvent( TUid aEvent,
       
   942                                                  TInt aResult )
       
   943     {
       
   944     RUBY_DEBUG2( "CSIControllerPluginInterface::SendSrsEvent: %d, result [%d]", aEvent, aResult );
       
   945     TMMFEvent event( aEvent, aResult );
       
   946     DoSendEventToClient( event );
       
   947     }
       
   948 
       
   949 #else
       
   950 
       
   951 // Unit Test
       
   952 void CSIControllerPluginInterface::SendSrsEvent(
       
   953                                                 TUid aEvent,
       
   954                                                 TInt aResult )
       
   955     {
       
   956     iObserver->SrsEvent(aEvent, aResult);
       
   957     }
       
   958 
       
   959 #endif
       
   960 
       
   961 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   962 
       
   963 
       
   964 #ifdef __CONSOLETEST__
       
   965 // Unit Test
       
   966 
       
   967 // Two-phased constructor
       
   968 CSIControllerPluginInterface* CSIControllerPluginInterface::NewL(
       
   969                                                                  MSrsObserver* aObserver )
       
   970     {
       
   971     CSIControllerPluginInterface* self = new( ELeave ) CSIControllerPluginInterface();
       
   972     
       
   973     CleanupStack::PushL( self );
       
   974     self->ConstructL(aObserver);
       
   975     CleanupStack::Pop();
       
   976     
       
   977     return self;
       
   978     }
       
   979 
       
   980 // Returns reference to a database
       
   981 RDbNamedDatabase& CSIControllerPluginInterface::GetDb()
       
   982     {
       
   983     return iController->GetDb();
       
   984     }
       
   985 
       
   986 
       
   987 // Returns reference to model bank array
       
   988 RPointerArray<CSIModelBank>& CSIControllerPluginInterface::ModelBankArray()
       
   989     {
       
   990     return iController->ModelBankArray();
       
   991     }
       
   992 
       
   993 // Returns current plugin state
       
   994 TInt CSIControllerPluginInterface::PluginState()
       
   995     {
       
   996     return iController->PluginState();
       
   997     }
       
   998 
       
   999 #endif
       
  1000 
       
  1001 
       
  1002 // __________________________________________________________________________
       
  1003 // Exported proxy for instantiation method resolution
       
  1004 // Define the interface UIDs
       
  1005 
       
  1006 #ifndef __CONSOLETEST__
       
  1007 /**
       
  1008 *
       
  1009 * ImplementationTable
       
  1010 *
       
  1011 */
       
  1012 const TImplementationProxy ImplementationTable[] =
       
  1013     {
       
  1014         {{KSIUidController}, ( TProxyNewLPtr ) CSIControllerPluginInterface::NewL}		// defined in SIPluginImplementationUIDs.hrh
       
  1015     };
       
  1016 
       
  1017 /**
       
  1018 * ImplementationGroupProxy
       
  1019 * @param aTableCount
       
  1020 * @returns "TImplementationProxy*"
       
  1021 */
       
  1022 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
  1023     {
       
  1024     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
  1025     
       
  1026     return ImplementationTable;
       
  1027     }
       
  1028 
       
  1029 #endif // __CONSOLETEST__
       
  1030 
       
  1031 //  End of File