kerneltest/e32test/timestamp/d_timestamp_dev.h
branchRCL_3
changeset 43 c1f20ce4abcf
equal deleted inserted replaced
42:a179b74831c9 43:c1f20ce4abcf
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // d_timestamp_dev.h
       
    15 //
       
    16 
       
    17 #ifndef __D_TIMERSTAMP_DEV_H__
       
    18 #define __D_TIMERSTAMP_DEV_H__
       
    19 
       
    20 /**
       
    21   Logical Device (factory class) for 'TimestampTest'
       
    22 */
       
    23 class DTimestampTestFactory : public DLogicalDevice
       
    24 	{
       
    25 public:
       
    26 	DTimestampTestFactory();
       
    27 	~DTimestampTestFactory();
       
    28 	//	Inherited from DLogicalDevice
       
    29 	virtual TInt Install();
       
    30 	virtual void GetCaps(TDes8& aDes) const;
       
    31 	virtual TInt Create(DLogicalChannelBase*& aChannel);
       
    32 	};
       
    33 
       
    34 class DTimestampTestPddChannel;
       
    35 
       
    36 /**
       
    37   Logical Channel class for 'TimestampTest'
       
    38 */
       
    39 class DTimestampTestChannel : public DLogicalChannel
       
    40 	{
       
    41 public:
       
    42 	DTimestampTestChannel();
       
    43 	virtual ~DTimestampTestChannel();
       
    44 	//	Inherited from DObject
       
    45 	virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType);
       
    46 	// Inherited from DLogicalChannelBase
       
    47 	virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
       
    48 	virtual void HandleMsg(TMessageBase* aMsg);
       
    49     // intercept messages on client thread
       
    50     virtual TInt SendMsg(TMessageBase* aMsg);
       
    51 private:
       
    52 	// Panic reasons
       
    53 	enum TPanic
       
    54 		{
       
    55 		ERequestAlreadyPending = 1
       
    56 		};
       
    57 	// Implementation for the differnt kinds of messages sent through RBusLogicalChannel
       
    58 	TInt DoControl(TInt aFunction, TAny* a1, TAny* a2);
       
    59 	void DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2);
       
    60     TInt SendRequest(TMessageBase* aMsg);
       
    61     TInt SendControl(TMessageBase* aMsg);
       
    62 	void DoCancel(TUint aMask);
       
    63     void DoTimerExpire();
       
    64     void DoDfcFn();
       
    65     // Accessor for the PDD
       
    66 	inline DTimestampTestPddChannel& Pdd();
       
    67 protected:
       
    68     
       
    69     
       
    70 private:
       
    71     static void timerExpire(TAny* aParam);
       
    72     static void dfcFn(TAny* aParam);
       
    73     DThread* iClient;
       
    74     TDynamicDfcQue* iQue;
       
    75     TClientDataRequest<STimestampResult> *iWaitOnTimerRequest;
       
    76     TClientRequest *iStartRequest;
       
    77     TInt iNTicks;
       
    78     NTimer iTimer;
       
    79     TDfc iDfc;
       
    80     TUint64 iLastTimestamp;
       
    81     TUint64 iTimestampDelta;
       
    82     TBool iStarted;
       
    83 	};
       
    84 
       
    85 
       
    86 inline DTimestampTestPddChannel& DTimestampTestChannel::Pdd()
       
    87 	{ return *((DTimestampTestPddChannel*)iPdd); }
       
    88 
       
    89 /*
       
    90  * DTimestampTestPddChannel
       
    91  * Interface Pdd
       
    92  */
       
    93 
       
    94 
       
    95 class DTimestampTestPddChannel : public DBase
       
    96     {
       
    97 public:
       
    98     /*
       
    99      * reset any variables requried to check entry into a low power mode
       
   100      * between time of call and time at which iTimer will next expire
       
   101      */
       
   102     virtual void StartLPMEntryCheck() = 0;
       
   103     /*
       
   104      * @return ETrue if a low power modes was entered
       
   105      */
       
   106     virtual TBool EndLPMEntryCheck() = 0;
       
   107     /*
       
   108      * Provide test parameters
       
   109      */
       
   110     virtual void TestConfig(STimestampTestConfig& aInfo) = 0;
       
   111     };
       
   112 
       
   113 
       
   114 
       
   115 #endif //__D_TIMERSTAMP_DEV_H__