srsf/devasr/src/devasrcenrep.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:  CenRep handling for DevASR
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "devasrcenrep.h"
       
    21 #include "rubydebug.h"
       
    22 #include "srsfinternalcrkeys.h"
       
    23 
       
    24 // CONSTANTS
       
    25 
       
    26 // Maximum value of the rejection setting in Central Repository
       
    27 const TInt KMaxRepositoryRejection = 10;
       
    28 
       
    29 // Maximum value of the rejection setting in the engine
       
    30 const TInt KMaxEngineRejection = 1024;
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CDevAsrCenRep::CDevAsrCenRep
       
    36 // C++ default constructor can NOT contain any code, that
       
    37 // might leave.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CDevAsrCenRep::CDevAsrCenRep() 
       
    41     {
       
    42     // Nothing
       
    43     }
       
    44 
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CDevAsrCenRep::ConstructL
       
    48 // Symbian 2nd phase constructor can leave.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 void CDevAsrCenRep::ConstructL()
       
    52     {
       
    53     RUBY_DEBUG_BLOCK( "" );
       
    54 	iRepository = CRepository::NewL( KCRUidSRSFSettings );
       
    55     }
       
    56 
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CDevAsrCenRep::NewL
       
    60 // Two-phased constructor.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CDevAsrCenRep* CDevAsrCenRep::NewL()
       
    64     {
       
    65     CDevAsrCenRep* self = new( ELeave ) CDevAsrCenRep();
       
    66  
       
    67     CleanupStack::PushL( self );
       
    68     self->ConstructL();
       
    69     CleanupStack::Pop( self );
       
    70     
       
    71     return self;
       
    72     }
       
    73 
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CDevAsrCenRep::~CDevAsrCenRep
       
    77 // Destructor
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CDevAsrCenRep::~CDevAsrCenRep()
       
    81     {
       
    82     delete iRepository;
       
    83     }
       
    84 
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CDevAsrCenRep::RejectionValue
       
    88 // Returns the rejection setting from CenRep
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 TInt CDevAsrCenRep::RejectionValue() 
       
    92     {
       
    93     RUBY_DEBUG0( "" );
       
    94     TInt rejection( KMaxEngineRejection );
       
    95     // Get from CenRep
       
    96     TInt error = iRepository->Get( KSRSFRejection, rejection );
       
    97     if ( error == KErrNone )
       
    98         {
       
    99         RUBY_DEBUG1( "Rejection repository value:[%d]", rejection );
       
   100         // Scale value
       
   101         rejection = ( rejection * KMaxEngineRejection ) / KMaxRepositoryRejection;
       
   102         RUBY_DEBUG1( "Scaled rejection value:[%d]", rejection );
       
   103         }
       
   104     return rejection;
       
   105     }
       
   106 
       
   107 // End of File