devicediagnosticsfw/diagframework/src/diagengineconfig.cpp
changeset 32 5d0ec111abfc
parent 27 2c8580950a26
child 35 0deca9b72b62
equal deleted inserted replaced
27:2c8580950a26 32:5d0ec111abfc
     1 /*
       
     2 * Copyright (c) 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:  Class definition of TDiagEngineConfig
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // CLASS DECLARATION
       
    20 #include "diagengineconfig.h"       
       
    21 
       
    22 // SYSTEM INCLUDE FILES
       
    23 #include <centralrepository.h>              // CRepository
       
    24 #include <DiagFrameworkDebug.h>             // LOGSTRING
       
    25 
       
    26 // USER INCLUDE FILES
       
    27 #include "diagnosticsfwprivatecrkeys.h"     // Private CenRep Key
       
    28 
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // TDiagEngineConfig::TDiagEngineConfig()
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 TDiagEngineConfig::TDiagEngineConfig()
       
    36     :   iCenRepWatchdogTimeoutInteractive( 0 ),
       
    37         iCenRepWatchdogTimeoutAutomatic( 0 ),
       
    38         iCenRepInitDelay( 0 ),
       
    39         iDisableDependency( EFalse )
       
    40     {
       
    41     // note that this is a T class, so all member must be initialized explicitly.
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // TDiagEngineConfig::ReadCenrepKeysL
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 void TDiagEngineConfig::ReadCenrepKeysL()
       
    49     {
       
    50     CRepository* cenrep = NULL;
       
    51     cenrep = CRepository::NewLC( KCRUidDiagnosticsFw );
       
    52 
       
    53     ReadTimeIntervalFromCenrepL( *cenrep, 
       
    54                                  KDiagFwWatchdogTimeoutInteractive, 
       
    55                                  iCenRepWatchdogTimeoutInteractive );
       
    56     ReadTimeIntervalFromCenrepL( *cenrep,
       
    57                                  KDiagFwWatchdogTimeoutAutomatic, 
       
    58                                  iCenRepWatchdogTimeoutAutomatic );
       
    59     ReadTimeIntervalFromCenrepL( *cenrep,
       
    60                                  KDiagFwTestInitDelay,
       
    61                                  iCenRepInitDelay );
       
    62        
       
    63     CleanupStack::PopAndDestroy( cenrep );
       
    64     cenrep = NULL;
       
    65 
       
    66     LOGSTRING2( "TDiagEngineConfig::ReadCenrepKeysL() "
       
    67         L"KDiagFwWatchdogTimeoutInteractive: %d micro seconds", 
       
    68         iCenRepWatchdogTimeoutInteractive.Int() )
       
    69     LOGSTRING2( "TDiagEngineConfig::ReadCenrepKeysL() "
       
    70         L"KDiagFwWatchdogTimeoutAutomatic: %d sec",
       
    71         iCenRepWatchdogTimeoutAutomatic.Int() )
       
    72     LOGSTRING2( "TDiagEngineConfig::ReadCenrepKeysL(): "
       
    73         L"KDiagFwTestInitDelay: %d microsec", 
       
    74         iCenRepInitDelay.Int() )
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // TDiagEngineConfig::ReadTimeIntervalFromCenrepL
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 void TDiagEngineConfig::ReadTimeIntervalFromCenrepL( 
       
    82         CRepository& aCenrep,
       
    83         TUint32 aKey,
       
    84         TTimeIntervalMicroSeconds32& aValue )
       
    85     {
       
    86     TInt timeoutValue = 0;
       
    87     User::LeaveIfError( aCenrep.Get( aKey, timeoutValue ) );
       
    88     aValue = timeoutValue;
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // TDiagEngineConfig::WatchdogTimeoutValueInteractive
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 const TTimeIntervalMicroSeconds32& TDiagEngineConfig::WatchdogTimeoutValueInteractive() const
       
    96     {
       
    97     return iCenRepWatchdogTimeoutInteractive;
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // TDiagEngineConfig::WatchdogTimeoutValueAutomatic
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 const TTimeIntervalMicroSeconds32& TDiagEngineConfig::WatchdogTimeoutValueAutomatic() const
       
   105     {
       
   106     return iCenRepWatchdogTimeoutAutomatic;
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // TDiagEngineConfig::TestPluginInitialDelay
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 const TTimeIntervalMicroSeconds32& TDiagEngineConfig::TestPluginInitialDelay() const
       
   114     {
       
   115     return iCenRepInitDelay;
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // TDiagEngineConfig::SetDependencyDisabled
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 void TDiagEngineConfig::SetDependencyDisabled( TBool aDisableDependency )
       
   123     {
       
   124     iDisableDependency = aDisableDependency;
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // TDiagEngineConfig::IsDependencyDisabled
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 TBool TDiagEngineConfig::IsDependencyDisabled() const
       
   132     {
       
   133     return iDisableDependency;
       
   134     }
       
   135 
       
   136 // End of File
       
   137