|
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 "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: Haptics server plugin handler header file. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_HWRMHAPTICSPLUGINMANAGER_H |
|
20 #define C_HWRMHAPTICSPLUGINMANAGER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <hwrmlogicalactuators.h> |
|
24 #include <hwrmhapticspluginservice.h> |
|
25 #include "hwrmhapticscommondata.h" |
|
26 #include "hwrmhapticsgenerictimer.h" |
|
27 |
|
28 class CHWRMHapticsService; |
|
29 class CHWRMHapticsPluginTransactionList; |
|
30 class CHWRMHapticsUid; |
|
31 class CRepository; |
|
32 |
|
33 /** |
|
34 * Haptics server side plugin handler implementation. |
|
35 */ |
|
36 class CHWRMHapticsPluginManager : public CBase, |
|
37 public MHWRMHapticsPluginCallback, |
|
38 public MHWRMHapticsGenericTimerCallback |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Symbian two-phased constructor. |
|
44 * |
|
45 * @param Server common data object. |
|
46 * @param aRequestTimeout Timeout in microseconds for requests |
|
47 */ |
|
48 IMPORT_C static CHWRMHapticsPluginManager* NewL( |
|
49 CHWRMHapticsCommonData& aHapticsCommonData, |
|
50 TInt aRequestTimeout ); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 virtual ~CHWRMHapticsPluginManager(); |
|
56 |
|
57 public: |
|
58 |
|
59 /** |
|
60 * Method to invoke a particular command in the plugin. |
|
61 * Only one concurrent request is supported, will leave |
|
62 * with KErrNotSupported if request is attempted while |
|
63 * another is executing |
|
64 * |
|
65 * @param aCommandId Command ID |
|
66 * @param aData Data associated with command |
|
67 * @param aCompletionCallback Callback for completion. |
|
68 * If NULL, no callback is attempted. |
|
69 * @return Transaction ID (can be used later to cancel) |
|
70 * Returns zero if transaction was already completed. |
|
71 */ |
|
72 TUint8 ProcessCommandL( TInt aCommandId, TDesC8& aData, |
|
73 CHWRMHapticsService* aCompletionCallback ); |
|
74 |
|
75 /** |
|
76 * Method to cancel currently executing command |
|
77 * |
|
78 * @param aTransID Transaction ID. |
|
79 */ |
|
80 void CancelCommandL( TUint8 aTransId ); |
|
81 |
|
82 public: |
|
83 |
|
84 /** |
|
85 * From MHWRMHapticsPluginCallback. |
|
86 * @see MHWRMHapticsPluginCallback |
|
87 */ |
|
88 void PluginEnabled( THWRMLogicalActuators aActuator, TBool aEnabled ); |
|
89 |
|
90 /** |
|
91 * From MHWRMHapticsPluginCallback. |
|
92 * @see MHWRMHapticsPluginCallback |
|
93 */ |
|
94 void ProcessResponseL( TInt aCommandId, TUint8 aTransId, const TDesC8& aData ); |
|
95 |
|
96 public: |
|
97 |
|
98 /** |
|
99 * From MHWRMHapticsGenericTimerCallback. |
|
100 * @see MHWRMHapticsGenericTimerCallback |
|
101 */ |
|
102 virtual void GenericTimerFired( TInt aTimerId, TBool aCutOff ); |
|
103 |
|
104 public: |
|
105 |
|
106 /** |
|
107 * Returns the supported actuator information from plugins. |
|
108 * |
|
109 * @return A mask value containing the supported actuators. |
|
110 */ |
|
111 TUint32 GetSupportedActuatorInfo(); |
|
112 |
|
113 /** |
|
114 * Opens the plugin appropriate for the actuator to be opened. |
|
115 * |
|
116 * @param aActuator Logical actuator type to be opened. |
|
117 * @return Whether or not the plugin was created (ETrue = created). |
|
118 * If plugin was |
|
119 * not created and the method did not leave, the plugin is |
|
120 * already created and therefore not created again. Basically this |
|
121 * return value indicates also whether or not the plugin already |
|
122 * exists (EFalse = already exists, not created). |
|
123 */ |
|
124 TBool OpenPluginToActuatorL( THWRMLogicalActuators aActuator ); |
|
125 |
|
126 /** |
|
127 * Checks if automatic license setting is allowed for the sender of |
|
128 * the RMessage2. |
|
129 * |
|
130 * @param aMessage The message from which VendorId and SID of the |
|
131 * sender is read (in order to determine whether |
|
132 * automatic license setting is allowed or not). |
|
133 * |
|
134 * @return Whether or not automatic license setting is allowed. |
|
135 */ |
|
136 TBool LicenseAutoSettingAllowed( const RMessage2& aMessage ); |
|
137 |
|
138 private: |
|
139 |
|
140 /** |
|
141 * C++ constructor. |
|
142 * |
|
143 * @param aRequestTimeout Timeout in microseconds for requests |
|
144 * @param Server common data object. |
|
145 */ |
|
146 CHWRMHapticsPluginManager( CHWRMHapticsCommonData& aHapticsCommonData, |
|
147 TInt aRequestTimeout ); |
|
148 |
|
149 /** |
|
150 * 2nd phase constructor. |
|
151 */ |
|
152 void ConstructL(); |
|
153 |
|
154 /** |
|
155 * Finds the supported actuator information from plugins. |
|
156 * |
|
157 * @return A mask value containing the supported actuators. |
|
158 */ |
|
159 TUint32 FindSupportedActuatorInfoL(); |
|
160 |
|
161 /** |
|
162 * Adds actuator type to given actuator mask, if it is |
|
163 * supported in the system. |
|
164 * |
|
165 * @param aMatch Actuator type CR key. |
|
166 * @param aMask A mask value to be added to aActuators. |
|
167 * @param aActuators A value, where to add the mask value. |
|
168 */ |
|
169 void AddInfoIfSupportedL( TInt aMatch, |
|
170 THWRMLogicalActuators aMask, |
|
171 TUint32& aActuators ); |
|
172 |
|
173 private: |
|
174 |
|
175 /** |
|
176 * Pointer to plugin instance. |
|
177 */ |
|
178 CHWRMHapticsPluginService* iPlugin; |
|
179 |
|
180 /** |
|
181 * Pointer to haptics data object common to all sessions. Not owned. |
|
182 */ |
|
183 CHWRMHapticsCommonData& iHapticsCommonData; |
|
184 |
|
185 /** |
|
186 * Counter to create aTransIds |
|
187 */ |
|
188 TUint8 iTransIdCounter; |
|
189 |
|
190 /** |
|
191 * List of open transactions |
|
192 */ |
|
193 CHWRMHapticsPluginTransactionList* iTransactionList; |
|
194 |
|
195 /** |
|
196 * Plugin call timeout timer. |
|
197 */ |
|
198 CHWRMHapticsGenericTimer* iPluginTimer; |
|
199 |
|
200 /** |
|
201 * Maximum time request can be open. |
|
202 */ |
|
203 TTimeIntervalMicroSeconds32 iRequestTimeout; |
|
204 |
|
205 /** |
|
206 * Supported actuator information. |
|
207 */ |
|
208 TUint32 iSupActuators; |
|
209 |
|
210 /** |
|
211 * Reference to uid handler, owned. |
|
212 */ |
|
213 CHWRMHapticsUid* iHapticsUid; |
|
214 |
|
215 /** |
|
216 * Access to settings. |
|
217 * Own. |
|
218 */ |
|
219 CRepository* iRepository; |
|
220 }; |
|
221 |
|
222 #endif // C_HWRMHAPTICSPLUGINMANAGER_H |
|
223 |
|
224 // End of File |