|
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 |
|
19 #ifndef __D_TIMERSTAMP_DEV_H__ |
|
20 #define __D_TIMERSTAMP_DEV_H__ |
|
21 |
|
22 /** |
|
23 Logical Device (factory class) for 'TimestampTest' |
|
24 */ |
|
25 class DTimestampTestFactory : public DLogicalDevice |
|
26 { |
|
27 public: |
|
28 DTimestampTestFactory(); |
|
29 ~DTimestampTestFactory(); |
|
30 // Inherited from DLogicalDevice |
|
31 virtual TInt Install(); |
|
32 virtual void GetCaps(TDes8& aDes) const; |
|
33 virtual TInt Create(DLogicalChannelBase*& aChannel); |
|
34 }; |
|
35 |
|
36 class DTimestampTestPddChannel; |
|
37 |
|
38 /** |
|
39 Logical Channel class for 'TimestampTest' |
|
40 */ |
|
41 class DTimestampTestChannel : public DLogicalChannel |
|
42 { |
|
43 public: |
|
44 DTimestampTestChannel(); |
|
45 virtual ~DTimestampTestChannel(); |
|
46 // Inherited from DObject |
|
47 virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType); |
|
48 // Inherited from DLogicalChannelBase |
|
49 virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); |
|
50 virtual void HandleMsg(TMessageBase* aMsg); |
|
51 // intercept messages on client thread |
|
52 virtual TInt SendMsg(TMessageBase* aMsg); |
|
53 private: |
|
54 // Panic reasons |
|
55 enum TPanic |
|
56 { |
|
57 ERequestAlreadyPending = 1 |
|
58 }; |
|
59 // Implementation for the differnt kinds of messages sent through RBusLogicalChannel |
|
60 TInt DoControl(TInt aFunction, TAny* a1, TAny* a2); |
|
61 void DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2); |
|
62 TInt SendRequest(TMessageBase* aMsg); |
|
63 TInt SendControl(TMessageBase* aMsg); |
|
64 void DoCancel(TUint aMask); |
|
65 void DoTimerExpire(); |
|
66 void DoDfcFn(); |
|
67 // Accessor for the PDD |
|
68 inline DTimestampTestPddChannel& Pdd(); |
|
69 protected: |
|
70 |
|
71 |
|
72 private: |
|
73 static void timerExpire(TAny* aParam); |
|
74 static void dfcFn(TAny* aParam); |
|
75 DThread* iClient; |
|
76 TDynamicDfcQue* iQue; |
|
77 TClientDataRequest<STimestampResult> *iWaitOnTimerRequest; |
|
78 TClientRequest *iStartRequest; |
|
79 TInt iNTicks; |
|
80 NTimer iTimer; |
|
81 TDfc iDfc; |
|
82 TUint64 iLastTimestamp; |
|
83 TUint64 iTimestampDelta; |
|
84 TBool iStarted; |
|
85 }; |
|
86 |
|
87 |
|
88 inline DTimestampTestPddChannel& DTimestampTestChannel::Pdd() |
|
89 { return *((DTimestampTestPddChannel*)iPdd); } |
|
90 |
|
91 /* |
|
92 * DTimestampTestPddChannel |
|
93 * Interface Pdd |
|
94 */ |
|
95 |
|
96 |
|
97 class DTimestampTestPddChannel : public DBase |
|
98 { |
|
99 public: |
|
100 /* |
|
101 * reset any variables requried to check entry into a low power mode |
|
102 * between time of call and time at which iTimer will next expire |
|
103 */ |
|
104 virtual void StartLPMEntryCheck() = 0; |
|
105 /* |
|
106 * @return ETrue if a low power modes was entered |
|
107 */ |
|
108 virtual TBool EndLPMEntryCheck() = 0; |
|
109 /* |
|
110 * Provide test parameters |
|
111 */ |
|
112 virtual void TestConfig(STimestampTestConfig& aInfo) = 0; |
|
113 }; |
|
114 |
|
115 |
|
116 |
|
117 #endif //__D_TIMERSTAMP_DEV_H__ |