83
|
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: Encapsulates hsps liw service
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef C_CHSPSWRAPPER_H
|
|
21 |
#define C_CHSPSWRAPPER_H
|
|
22 |
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <liwcommon.h> // for MLiwNotifyCallback
|
|
25 |
|
|
26 |
class CLiwServiceHandler;
|
|
27 |
class MLiwInterface;
|
|
28 |
class CLiwCriteriaItem;
|
|
29 |
class CLiwMap;
|
|
30 |
class CLiwList;
|
|
31 |
class MDesC8Array;
|
|
32 |
class CLiwDefaultMap;
|
|
33 |
class CLiwDefaultList;
|
|
34 |
class MLiwNotifyCallback;
|
|
35 |
class CLiwGenericParamList;
|
|
36 |
class CRepository;
|
|
37 |
|
|
38 |
namespace hspswrapper{
|
|
39 |
|
|
40 |
class CHspsConfiguration;
|
|
41 |
class CItemMap;
|
|
42 |
class CPluginInfo;
|
|
43 |
class CAddPluginResult;
|
|
44 |
class CPropertyMap;
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Observer class for hspswrapper
|
|
48 |
*
|
|
49 |
* @code
|
|
50 |
*
|
|
51 |
* @endcode
|
|
52 |
*
|
|
53 |
* @lib hspswrapper.lib
|
|
54 |
* @since S60 v5.0
|
|
55 |
*/
|
|
56 |
class MHspsWrapperObserver
|
|
57 |
{
|
|
58 |
public:
|
|
59 |
/**
|
|
60 |
* Handle HSPS wrappper notifications
|
|
61 |
*
|
|
62 |
* @param aEvent Event
|
|
63 |
* @param aAppConfUid App configuration uid
|
|
64 |
* @param aPluginName Plugin name
|
|
65 |
* @param aOrigUid Originator uid
|
|
66 |
* @param aPluginUid Plugin uid
|
|
67 |
* @param aPluginId Plugin id
|
|
68 |
*/
|
|
69 |
virtual TInt HandleNotifyL( const TDesC8& aEvent,
|
|
70 |
const TDesC8& aAppConfUid,
|
|
71 |
const TDesC8& aPluginName,
|
|
72 |
const TDesC8& aOrigUid,
|
|
73 |
const TDesC8& aPluginUid,
|
|
74 |
const TDesC8& aPluginId ) = 0;
|
|
75 |
protected:
|
|
76 |
/**
|
|
77 |
* Destructor. Protected to prevent deletion through this interface.
|
|
78 |
*/
|
|
79 |
~MHspsWrapperObserver() { }
|
|
80 |
};
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Return value from add plugin
|
|
84 |
*
|
|
85 |
* @code
|
|
86 |
*
|
|
87 |
* @endcode
|
|
88 |
*
|
|
89 |
* @lib hspswrapper.lib
|
|
90 |
* @since S60 v5.0
|
|
91 |
*/
|
|
92 |
class CAddPluginResult: public CBase
|
|
93 |
{
|
|
94 |
public:
|
|
95 |
IMPORT_C static CAddPluginResult* NewL();
|
|
96 |
IMPORT_C ~CAddPluginResult();
|
|
97 |
/**
|
|
98 |
* Set plugin id
|
|
99 |
*
|
|
100 |
* @param aPluginId Plugin id
|
|
101 |
*/
|
|
102 |
IMPORT_C void SetPluginIdL(const TDesC8& aPluginId);
|
|
103 |
/**
|
|
104 |
* Get plugin id
|
|
105 |
*
|
|
106 |
* @return Plugin id or KNullDesC8
|
|
107 |
*/
|
|
108 |
IMPORT_C const TDesC8& PluginId()const;
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Set operation status
|
|
112 |
*
|
|
113 |
* @param aStatus Operation status
|
|
114 |
*/
|
|
115 |
IMPORT_C void SetStatus(TInt aStatus);
|
|
116 |
/**
|
|
117 |
* Get operation status
|
|
118 |
*
|
|
119 |
* @return KErrNotFound, if operation fails
|
|
120 |
*/
|
|
121 |
IMPORT_C TInt Status()const;
|
|
122 |
private:
|
|
123 |
CAddPluginResult();
|
|
124 |
private:
|
|
125 |
/**
|
|
126 |
* Status of operation. KErrNotFound, if operation fails
|
|
127 |
*/
|
|
128 |
TInt iStatus;
|
|
129 |
/**
|
|
130 |
* Own. Id of the added plugin in the configuration
|
|
131 |
*/
|
|
132 |
HBufC8* iPluginId;
|
|
133 |
};
|
|
134 |
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Wrapper for hsps liw service
|
|
138 |
*
|
|
139 |
*
|
|
140 |
* @code
|
|
141 |
*
|
|
142 |
* @endcode
|
|
143 |
*
|
|
144 |
* @lib hspswrapper.lib
|
|
145 |
* @since S60 v5.0
|
|
146 |
*/
|
|
147 |
class CHspsWrapper : public CBase, public MLiwNotifyCallback
|
|
148 |
{
|
|
149 |
public:
|
|
150 |
/**
|
|
151 |
* Two-phased constructor.
|
|
152 |
* @param aAppUid Application uid in integer format
|
|
153 |
* @param aObserver Observer
|
|
154 |
*/
|
|
155 |
IMPORT_C static CHspsWrapper* NewL(const TDesC8& aAppUid,
|
|
156 |
MHspsWrapperObserver* aObserver = NULL);
|
|
157 |
/**
|
|
158 |
* Two-phased constructor.
|
|
159 |
* @param aAppUid Application uid in integer format
|
|
160 |
* @param aObserver Observer
|
|
161 |
*/
|
|
162 |
IMPORT_C static CHspsWrapper* NewLC(const TDesC8& aAppUid,
|
|
163 |
MHspsWrapperObserver* aObserver = NULL);
|
|
164 |
/**
|
|
165 |
* Destructor.
|
|
166 |
*/
|
|
167 |
IMPORT_C virtual ~CHspsWrapper();
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Fetch active application configuration from hsps and
|
|
171 |
* creates CHspsConfiguration out of liw message
|
|
172 |
*
|
|
173 |
* @return Configuration. Caller has ownership.
|
|
174 |
*/
|
|
175 |
IMPORT_C CHspsConfiguration* GetAppConfigurationL();
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Fetch root configurations from hsps. On return aConfs holds
|
|
179 |
* configuration info instancies. Caller takes ownership of
|
|
180 |
* configuration info instancies.
|
|
181 |
*
|
|
182 |
* @param aPlugins Array to hold configuration info instancies
|
|
183 |
*/
|
|
184 |
IMPORT_C void GetAppConfigurationsL( RPointerArray<CPluginInfo>& aPlugins );
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Sets root configuration to active.
|
|
188 |
*
|
|
189 |
* @param aConfigurationUid Configuration uid to be activated
|
|
190 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
191 |
*/
|
|
192 |
IMPORT_C TInt SetAppConfigurationL(const TDesC8& aConfigurationUid );
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Fetch plugin configuration from hsps and
|
|
196 |
* creates CHspsConfiguration out of liw message
|
|
197 |
*
|
|
198 |
* @param aPluginId Id of plugin configuration
|
|
199 |
* @return Configuration. Caller has ownership.
|
|
200 |
*/
|
|
201 |
IMPORT_C CHspsConfiguration* GetPluginConfigurationL(const TDesC8& aPluginId);
|
|
202 |
/**
|
|
203 |
* Fetch plugins from hsps. On return aPlugins holds plugin info
|
|
204 |
* instancies. Caller takes ownership of plugin info instancies.
|
|
205 |
*
|
|
206 |
* @param aPlugins Array to hold plugin info instancies
|
|
207 |
* @param aPluginInterface Plugin interface id
|
|
208 |
* @param aPluginType view, widget or template
|
|
209 |
*/
|
|
210 |
IMPORT_C void GetPluginsL( RPointerArray<CPluginInfo>& aPlugins,
|
|
211 |
const TDesC8& aPluginInterface,
|
|
212 |
const TDesC8& aPluginType);
|
|
213 |
|
|
214 |
/**
|
|
215 |
* Add plugin to hsps.
|
|
216 |
*
|
|
217 |
* @param aTargetConfiguration Id of configuration where the new plugin is attached
|
|
218 |
* @param aPluginUid Plugin uid which is added
|
|
219 |
* @param aPos Position in configuration's plugin list
|
|
220 |
*/
|
|
221 |
IMPORT_C CAddPluginResult* AddPluginL(const TDesC8& aTargetConfiguration, const TDesC8& aPluginUid);
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Remove plugin from the active configuration.
|
|
225 |
*
|
|
226 |
* @param aPluginId Plugin id to be removed
|
|
227 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
228 |
*/
|
|
229 |
IMPORT_C TInt RemovePluginL(const TDesC8& aPluginId);
|
|
230 |
|
|
231 |
/**
|
|
232 |
* Sets plugin active.
|
|
233 |
*
|
|
234 |
* @param aPluginId Plugin id to be activated
|
|
235 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
236 |
*/
|
|
237 |
IMPORT_C TInt SetActivePluginL(const TDesC8& aPluginId);
|
|
238 |
|
|
239 |
/**
|
|
240 |
* Activates another application configuration.
|
|
241 |
*
|
|
242 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
243 |
*/
|
|
244 |
IMPORT_C TInt RestoreDefaultConfL();
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Restores plug-in configurations from eMMC, UDA and ROM drives.
|
|
248 |
*
|
|
249 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
250 |
*/
|
|
251 |
IMPORT_C TInt RestoreAllConfL();
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Restores plug-in configurations from ROM only. To be used if content
|
|
255 |
* in UDA and eMMC drives is causing panics.
|
|
256 |
*
|
|
257 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
258 |
*/
|
|
259 |
IMPORT_C TInt RestoreRomConfL();
|
|
260 |
|
|
261 |
/**
|
|
262 |
* Restores active application configuration by removing all extra views,
|
|
263 |
* all plug-ins will be removed also.
|
|
264 |
*
|
|
265 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
266 |
*/
|
|
267 |
IMPORT_C TInt RestoreViewsL();
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Replace plugin in the active configuration.
|
|
271 |
*
|
|
272 |
* @param aPluginId Plugin id to be replaced
|
|
273 |
* @param aConfUid Configuration uid of the new plugin
|
|
274 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
275 |
*/
|
|
276 |
IMPORT_C TInt ReplacePluginL(
|
|
277 |
const TDesC8& aPluginId,
|
|
278 |
const TDesC8& aConfUid );
|
|
279 |
|
|
280 |
/**
|
|
281 |
* Move plugin inside configuration.
|
|
282 |
*
|
|
283 |
* @param aConfId Configuration
|
|
284 |
* @param aPluginIds List of plugins included in the configuration in new order
|
|
285 |
* @return Operation status. KErrNone (success), KErrArgument, KErrNotFound
|
|
286 |
*/
|
|
287 |
IMPORT_C TInt MovePluginsL(const TDesC8& aConfId, const MDesC8Array& aPluginIds);
|
|
288 |
|
|
289 |
/**
|
|
290 |
* Stores defined plugin’s settings.
|
|
291 |
* Plugin is identified with unique plugin ID used in application’s configuration
|
|
292 |
*
|
|
293 |
* @param aPluginId Pluging’s ID which settings are stored
|
|
294 |
* @param aSettings List of item maps
|
|
295 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
296 |
*/
|
|
297 |
IMPORT_C TInt SetPluginSettingsL(const TDesC8& aPluginId, const RPointerArray<CItemMap>& aSettings);
|
|
298 |
|
|
299 |
/**
|
|
300 |
* Add plugin to hsps.
|
|
301 |
*
|
|
302 |
* @param aTargetConfiguration Id of configuration where the new plugin is attached
|
|
303 |
* @param aPluginUid Plugin uid which is added
|
|
304 |
* @param aIndex Position to which plugin is added
|
|
305 |
*/
|
|
306 |
IMPORT_C CAddPluginResult* AddPluginL(const TDesC8& aTargetConfiguration, const TDesC8& aPluginUid, const TInt aIndex);
|
|
307 |
|
|
308 |
/**
|
|
309 |
* Set plugin configure state to hsps.
|
|
310 |
*
|
|
311 |
* @param aConfId Configuration id of a plugin that should be confirmed.
|
|
312 |
* @param aState State of the plugin
|
|
313 |
* @param aIncludePlugins ETrue if aState is set to child plugins, EFalse default.
|
|
314 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
315 |
*/
|
|
316 |
IMPORT_C TInt SetConfStateL( const TDesC8& aConfId, const TDesC8& aState, TBool aIncludePlugins = EFalse );
|
|
317 |
|
|
318 |
/**
|
|
319 |
* Returns SAPI service handler.
|
|
320 |
*/
|
|
321 |
IMPORT_C CLiwServiceHandler* ServiceHandler() const;
|
|
322 |
|
|
323 |
/**
|
|
324 |
* Returns HSPS SAPI service
|
|
325 |
*/
|
|
326 |
IMPORT_C CLiwCriteriaItem* HspsService() const;
|
|
327 |
|
|
328 |
/**
|
|
329 |
* Returns HSPS services interface
|
|
330 |
*/
|
|
331 |
IMPORT_C MLiwInterface* HspsInterface() const;
|
|
332 |
|
|
333 |
protected:
|
|
334 |
CHspsWrapper(MHspsWrapperObserver* aObserver);
|
|
335 |
void ConstructL(const TDesC8& aAppUid);
|
|
336 |
void ProcessConfigurationMapL( const CLiwMap& aSource,
|
|
337 |
CHspsConfiguration& aTarget,
|
|
338 |
const TBool aAppConf );
|
|
339 |
void ProcessConfigurationPluginsL( const CLiwList& aPluginsList,
|
|
340 |
CHspsConfiguration& aTarget,
|
|
341 |
const TBool aAppConf );
|
|
342 |
void ProcessConfigurationSettingsL(const CLiwList& aItemList, CHspsConfiguration& aTarget);
|
|
343 |
void ProcessConfigurationResourcesL(const CLiwList& aObjectList, CHspsConfiguration& aTarget);
|
|
344 |
void ProcessConfItemPropertiesL(const CLiwList& aPropertyMapList,CItemMap& aItemMap);
|
|
345 |
void ProcessPluginsL(const CLiwList& aPluginInfoMapList, RPointerArray<CPluginInfo>& aPlugins);
|
|
346 |
void FillMapFromItemL( CLiwDefaultMap& aMap, const CItemMap& aItemMap );
|
|
347 |
void FillMapFromPropertiesL( CLiwDefaultList& aInPropertyMapList, const RPointerArray<CPropertyMap>& aProperties );
|
|
348 |
TInt LoadActivePluginIdL();
|
|
349 |
const TDesC8& ActivePluginId() const;
|
|
350 |
|
|
351 |
protected: // from MLiwNotifyCallback
|
|
352 |
|
|
353 |
/**
|
|
354 |
* Handle HSPS notifications
|
|
355 |
*
|
|
356 |
* @param aCmdId Command id
|
|
357 |
* @param aEventId Event id
|
|
358 |
* @param aEventParamList Event parameters
|
|
359 |
* @param aInParamList In parameters
|
|
360 |
*/
|
|
361 |
TInt HandleNotifyL(TInt aCmdId, TInt aEventId,
|
|
362 |
CLiwGenericParamList& aEventParamList,
|
|
363 |
const CLiwGenericParamList& aInParamList);
|
|
364 |
|
|
365 |
private: // data
|
|
366 |
|
|
367 |
/**
|
|
368 |
* Owned. SAPI service handler.
|
|
369 |
*/
|
|
370 |
CLiwServiceHandler* iServiceHandler;
|
|
371 |
/**
|
|
372 |
* Owned. HSPS SAPI service.
|
|
373 |
*/
|
|
374 |
CLiwCriteriaItem* iHspsService;
|
|
375 |
/**
|
|
376 |
* Owned. Provides hsps services.
|
|
377 |
*/
|
|
378 |
MLiwInterface* iHspsInterface;
|
|
379 |
/**
|
|
380 |
* Not owned. Wrapper observer
|
|
381 |
*/
|
|
382 |
MHspsWrapperObserver* iObserver;
|
|
383 |
/*
|
|
384 |
* Asynchronous service request tarnsaction id
|
|
385 |
*/
|
|
386 |
TInt iTransactionId;
|
|
387 |
|
|
388 |
/*
|
|
389 |
* Central repository session. Owned;
|
|
390 |
*/
|
|
391 |
CRepository* iRepository;
|
|
392 |
|
|
393 |
/*
|
|
394 |
* Active plugin id. Owned.
|
|
395 |
*/
|
|
396 |
HBufC8* iActivePluginId;
|
|
397 |
};
|
|
398 |
}
|
|
399 |
|
|
400 |
#endif // C_CHSPSWRAPPER_H
|