|
1 /* |
|
2 * Copyright (c) 2008 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 the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Haptics test adaptation plugin timer implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "plugintimer.h" |
|
20 #include <hwrmpluginservice.h> |
|
21 #include <hwrmvibracommands.h> |
|
22 #include "hwrmhapticstrace.h" |
|
23 |
|
24 // ----------------------------------------------------------------------------- |
|
25 // CPluginTimer::NewL |
|
26 // Instantiates a CPluginTimer object. |
|
27 // Also adds the newly constructed object to active scheduler and starts the |
|
28 // embedded CTimer through After() method call. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CPluginTimer* CPluginTimer::NewL( |
|
32 const TTimeIntervalMicroSeconds32& aInterval, |
|
33 MHWRMHapticsPluginCallback* aService, |
|
34 TInt aCommandId, |
|
35 TUint8 aTransId, |
|
36 TInt aRetVal, |
|
37 MPluginTimerCallback* aCallback ) |
|
38 { |
|
39 CPluginTimer* self = new( ELeave ) CPluginTimer( 0, aService, aCommandId, aTransId, aRetVal, aCallback ); |
|
40 |
|
41 CleanupStack::PushL( self ); |
|
42 self->ConstructL(); |
|
43 CleanupStack::Pop( self ); |
|
44 |
|
45 CActiveScheduler::Add( self ); |
|
46 |
|
47 COMPONENT_TRACE( (_L("HWRM Plugin - CPluginTimer::NewL - Setting timer: %d"), aInterval) ); |
|
48 |
|
49 self->After( aInterval ); |
|
50 |
|
51 return self; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CPluginTimer::~CPluginTimer |
|
56 // Destructor |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CPluginTimer::~CPluginTimer() |
|
60 { |
|
61 // PCLint demands |
|
62 iCallback = NULL; |
|
63 iService = NULL; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CPluginTimer::CPluginTimer |
|
68 // Constructor |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CPluginTimer::CPluginTimer( TInt aPriority, |
|
72 MHWRMHapticsPluginCallback* aService, |
|
73 TInt aCommandId, |
|
74 TUint8 aTransId, |
|
75 TInt aRetVal, |
|
76 MPluginTimerCallback* aCallback ) |
|
77 : CTimer( aPriority ), |
|
78 iService( aService ), |
|
79 iCommandId( aCommandId ), |
|
80 iTransId( aTransId ), |
|
81 iRetVal( aRetVal ), |
|
82 iCallback( aCallback ) |
|
83 { |
|
84 // empty |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CPluginTimer::ConstructL |
|
89 // Two-phase (leavable) construction method. Calls the parent class ConstructL. |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CPluginTimer::ConstructL() |
|
93 { |
|
94 CTimer::ConstructL(); |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CPluginTimer::RunL |
|
99 // Active scheduler calls RunL when timer expires. This in turn dispatches the |
|
100 // further handling to the test stub object through MPluginTimerCallback interface. |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CPluginTimer::RunL() |
|
104 { |
|
105 iCallback->GenericTimerFired( iService, iCommandId, iTransId, iRetVal ); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CPluginTimer::TransId |
|
110 // Getter method for transaction Id. |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 TUint8 CPluginTimer::TransId() const |
|
114 { |
|
115 return iTransId; |
|
116 } |
|
117 |
|
118 // End of files |