perfmon/ui/hb/app/src/enginewrapper.cpp
branchRCL_3
changeset 22 fad26422216a
parent 21 b3cee849fa46
child 23 f8280f3bfeb7
equal deleted inserted replaced
21:b3cee849fa46 22:fad26422216a
     1 /*
       
     2 * Copyright (c) 2010 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 #include <e32def.h>
       
    19 #include <e32cmn.h>
       
    20 
       
    21 #include "enginewrapper.h"
       
    22 
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 
       
    26 EngineWrapper::EngineWrapper() : mSettings(iSettings)
       
    27 {
       
    28 }
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 
       
    32 EngineWrapper::~EngineWrapper()
       
    33 {
       
    34     finalize();
       
    35 }
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 
       
    39 bool EngineWrapper::initialize()
       
    40 {
       
    41     TInt err = KErrNone;
       
    42 
       
    43     TRAP(err, ConstructL());
       
    44     if (err != KErrNone)
       
    45         return false;
       
    46 
       
    47     TRAP(err, ActivateEngineL());
       
    48     if (err != KErrNone)
       
    49         return false;
       
    50 
       
    51     createSampleEntriesArray();
       
    52 
       
    53     return true;
       
    54 }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 
       
    58 void EngineWrapper::createSampleEntriesArray()
       
    59 {
       
    60     for (TInt i=0; i < iSampleEntryArray->Count(); i++)
       
    61     {
       
    62         mEntries.append(iSampleEntryArray->At(i));
       
    63     }
       
    64 }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 
       
    68 void EngineWrapper::finalize()
       
    69 {
       
    70     TRAP_IGNORE(DeActivateEngineL());
       
    71 }
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 
       
    75 bool EngineWrapper::updateSettings()
       
    76 {
       
    77     TInt err = KErrNone;
       
    78 
       
    79     TRAP(err, SaveSettingsL());
       
    80     if (err != KErrNone)
       
    81         return false;
       
    82 
       
    83     TRAP(err, HandleSettingsChangeL());
       
    84     if (err != KErrNone)
       
    85         return false;
       
    86 
       
    87     emit settingsUpdated();
       
    88     return true;
       
    89 }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 
       
    93 void EngineWrapper::setLoggingEnabled(bool enabled)
       
    94 {
       
    95     EnableLogging(enabled);    
       
    96 }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 
       
   100 void EngineWrapper::SendDrawEventToContainersL()
       
   101 {
       
   102     emit samplesUpdated();
       
   103 }
       
   104 
       
   105 // ---------------------------------------------------------------------------