keepalive/flextimer/test/testflextimer/src/inheritedcflextimer2.cpp
changeset 32 5c4486441ae6
equal deleted inserted replaced
31:c16e04725da3 32:5c4486441ae6
       
     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:  Implementation of CFlexPeriodic class
       
    15  *
       
    16  */
       
    17 /*
       
    18  * %version: 1 %
       
    19  */
       
    20 // System include files
       
    21 // User include files go here:
       
    22 #include "inheritedcflextimer2.h"
       
    23 //For exteded test result
       
    24 #include "testcflextimer.h"
       
    25 #include <e32debug.h>
       
    26 // External function prototypes
       
    27 // Local constants go here
       
    28 // Panic category
       
    29 
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 // ---------------------------------------------------------------------------
       
    32 // Constructs the object.
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CInheritedCFlexTimer2* CInheritedCFlexTimer2::NewL( TInt aPriority,
       
    36         TCallBack aCallBack, TInt aId )
       
    37     {
       
    38     RDebug::Printf("CInheritedCFlexTimer2::NewL");
       
    39     CInheritedCFlexTimer2* self = new (ELeave) CInheritedCFlexTimer2(
       
    40             aPriority, aCallBack, aId);
       
    41     CleanupStack::PushL(self);
       
    42     self->ConstructL();
       
    43     CleanupStack::Pop(self);
       
    44     return self;
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // Destructs the object.
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CInheritedCFlexTimer2::~CInheritedCFlexTimer2()
       
    52     {
       
    53 
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // Desc
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void CInheritedCFlexTimer2::SetCB( TCallBack aCallBack )
       
    61     {
       
    62     iCallBack = aCallBack;
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // Desc
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 TInt CInheritedCFlexTimer2::MyOwnConfigure(
       
    70         TTimeIntervalMicroSeconds32 aDelayWindow )
       
    71     {
       
    72     TInt ret = CFlexTimer::Configure(aDelayWindow);
       
    73     if (ret == KErrNone)
       
    74         {
       
    75         //
       
    76         }
       
    77     return ret;
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // Handles the active objects request completion event.
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 void CInheritedCFlexTimer2::RunL()
       
    85     {
       
    86     RDebug::Printf("CInheritedCFlexTimer2::RunL");
       
    87     //Give code to test case
       
    88     RArray<TTimerStruct> *list =
       
    89             reinterpret_cast<RArray<TTimerStruct>*> (iCallBack.iPtr);
       
    90     (*list)[0].iCurrentlyActive = iId;
       
    91     (*list)[iId].iEResult->iStatusCode = iStatus.Int();
       
    92     iCallBack.CallBack();
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // Second part of the two-phase construction.
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 void CInheritedCFlexTimer2::ConstructL()
       
   100     {
       
   101     CActiveScheduler::Add(this);
       
   102     CFlexTimer::ConstructL();
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // Private constructor with priority.
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 CInheritedCFlexTimer2::CInheritedCFlexTimer2( TInt aPriority,
       
   110         TCallBack aCallBack, TInt aId ) :
       
   111     CFlexTimer(aPriority), iCallBack(aCallBack), iId(aId)
       
   112     {
       
   113     RDebug::Printf("CInheritedCFlexTimer2::CInheritedCFlexTimer2");
       
   114     }