systemswstubs/hwrmstubplugins/src/PluginTimer.cpp
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Hardware Resource Manager stub plugins timer implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "PluginTimer.h"
       
    20 #include <hwrmpluginservice.h>
       
    21 #include <hwrmvibracommands.h>
       
    22 #include "Trace.h"
       
    23 
       
    24 CPluginTimer* CPluginTimer::NewL(const TTimeIntervalMicroSeconds32& anInterval, 
       
    25                          MHWRMPluginCallback* aService,
       
    26                           TInt aCommandId,
       
    27                           TUint8 aTransId, 
       
    28                          TInt aRetVal,
       
    29                          MPluginTimerCallback* aCallback)
       
    30     {
       
    31     CPluginTimer* self = new( ELeave ) CPluginTimer(0, aService, aCommandId, aTransId, aRetVal, aCallback);
       
    32     
       
    33     CleanupStack::PushL( self );
       
    34     self->ConstructL();
       
    35     CleanupStack::Pop( self );
       
    36 
       
    37     CActiveScheduler::Add(self);
       
    38 
       
    39     COMPONENT_TRACE((_L("HWRM Plugin - CPluginTimer::NewL - Setting timer: %d"), anInterval));
       
    40 
       
    41     self->After(anInterval);
       
    42 
       
    43     return self;
       
    44     }
       
    45 
       
    46 CPluginTimer::~CPluginTimer()    
       
    47     {
       
    48     // PCLint demands
       
    49     iCallback = NULL;
       
    50     iService = NULL; 
       
    51     }
       
    52 
       
    53 CPluginTimer::CPluginTimer(TInt aPriority, 
       
    54                    MHWRMPluginCallback* aService,
       
    55                     TInt aCommandId,
       
    56                     TUint8 aTransId,
       
    57                    TInt aRetVal,
       
    58                    MPluginTimerCallback* aCallback)
       
    59     : CTimer(aPriority),
       
    60     iService(aService),
       
    61     iCommandId(aCommandId),
       
    62     iTransId(aTransId),
       
    63     iRetVal(aRetVal),
       
    64     iCallback(aCallback)
       
    65     {
       
    66     }
       
    67 
       
    68 void CPluginTimer::ConstructL()
       
    69     {
       
    70     CTimer::ConstructL();
       
    71     }
       
    72 
       
    73     
       
    74 void CPluginTimer::RunL(  )
       
    75     {
       
    76     iCallback->GenericTimerFired(iService, iCommandId, iTransId, iRetVal );
       
    77 
       
    78     }
       
    79