34
|
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 |
#include <liwservicehandler.h>
|
|
20 |
#include <liwvariant.h>
|
|
21 |
#include <bamdesca.h>
|
|
22 |
#include <centralrepository.h>
|
|
23 |
#include <activeidle2domaincrkeys.h>
|
|
24 |
|
|
25 |
#include "hspswrapper.h"
|
|
26 |
#include "hspsconfiguration.h"
|
|
27 |
#include "pluginmap.h"
|
|
28 |
#include "itemmap.h"
|
|
29 |
#include "propertymap.h"
|
|
30 |
#include "objectmap.h"
|
|
31 |
#include "plugininfo.h"
|
|
32 |
|
|
33 |
_LIT8( KHSPS, "Service.HSPS" );
|
|
34 |
_LIT8( KHSPSConfigurationIf, "IConfiguration" );
|
|
35 |
|
|
36 |
_LIT8( KHSPSCommandGetActiveAppConf, "GetActiveAppConf" );
|
|
37 |
_LIT8( KHSPSCommandGetPluginConf, "GetPluginConf" );
|
|
38 |
_LIT8( KHSPSCommandGetPlugins, "GetPlugins" );
|
|
39 |
_LIT8( KHSPSCommandAddPlugin, "AddPlugin" );
|
|
40 |
_LIT8( KHSPSCommandRemovePlugin, "RemovePlugin" );
|
|
41 |
_LIT8( KHSPSCommandReplacePlugin, "ReplacePlugin" );
|
|
42 |
_LIT8( KHSPSCommandSetConfState, "SetConfState" );
|
|
43 |
_LIT8( KHSPSCommandGetAppConfs, "GetAppConfs" );
|
|
44 |
_LIT8( KHSPSCommandSetAppConf, "SetActiveAppConf" );
|
|
45 |
_LIT8( KHSPSMovePlugins, "MovePlugins");
|
|
46 |
_LIT8( KHSPSSetPluginSettings, "SetPluginSettings" );
|
|
47 |
_LIT8( KAppConfKey, "appConf" );
|
|
48 |
_LIT8( KAppConfsKey, "appConfs" );
|
|
49 |
_LIT8( KPluginConfKey, "pluginConf" );
|
|
50 |
_LIT8( KPluginsKey, "plugins" );
|
|
51 |
_LIT8( KConfId, "confId" );
|
|
52 |
_LIT8( KPluginUid, "pluginUid" );
|
|
53 |
_LIT8( KOutKeyStatus ,"status");
|
|
54 |
_LIT8( KHspsAppUid, "appUid" );
|
|
55 |
_LIT8( KKeyPluginId, "pluginId" );
|
|
56 |
_LIT8( KKeyConfUid, "confUid" );
|
|
57 |
_LIT8( KInterface, "interface" );
|
|
58 |
_LIT8( KType, "type" );
|
|
59 |
_LIT8( KCopyLogos, "copylogos" );
|
|
60 |
_LIT8( KKeyPlugins, "plugins" );
|
|
61 |
_LIT8( KKeyItemId, "itemId" );
|
|
62 |
_LIT8( KKeyName, "name" );
|
|
63 |
_LIT8( KKeyValue, "value" );
|
|
64 |
_LIT8( KKeyProperties, "properties" );
|
|
65 |
_LIT8( KKeySettings, "settings" );
|
|
66 |
_LIT8( KIndex, "position" );
|
|
67 |
_LIT8( KConfState, "state" );
|
|
68 |
_LIT8( KRequestNotification, "RequestNotification" );
|
|
69 |
_LIT8( KHSPSCommandRestoreConfigurations, "RestoreConfigurations" );
|
|
70 |
_LIT8( KRestore, "restore" );
|
|
71 |
_LIT8( KRestoreDefault, "default" );
|
|
72 |
_LIT8( KRestoreAll, "all" );
|
|
73 |
_LIT8( KRestoreRom, "rom" );
|
|
74 |
_LIT8( KRestoreViews, "views" );
|
|
75 |
_LIT8( K0, "0" );
|
|
76 |
_LIT8( K1, "1" );
|
|
77 |
_LIT8( KPluginIdNotSet, "-1" );
|
|
78 |
const TInt KMaxPluginIdLen = 32;
|
|
79 |
|
|
80 |
namespace hspswrapper{
|
|
81 |
|
|
82 |
// ---------------------------------------------------------------------------
|
|
83 |
// ---------------------------------------------------------------------------
|
|
84 |
//
|
|
85 |
EXPORT_C CAddPluginResult::CAddPluginResult():iStatus(KErrNotFound)
|
|
86 |
{}
|
|
87 |
|
|
88 |
// ---------------------------------------------------------------------------
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
EXPORT_C CAddPluginResult::~CAddPluginResult()
|
|
92 |
{
|
|
93 |
delete iPluginId;
|
|
94 |
}
|
|
95 |
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
EXPORT_C CAddPluginResult* CAddPluginResult::NewL()
|
|
100 |
{
|
|
101 |
CAddPluginResult* self = new( ELeave ) CAddPluginResult;
|
|
102 |
return self;
|
|
103 |
}
|
|
104 |
|
|
105 |
// ---------------------------------------------------------------------------
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
//
|
|
108 |
EXPORT_C void CAddPluginResult::SetPluginIdL(
|
|
109 |
const TDesC8& aPluginId )
|
|
110 |
{
|
|
111 |
delete iPluginId;
|
|
112 |
iPluginId = NULL;
|
|
113 |
iPluginId = aPluginId.AllocL();
|
|
114 |
}
|
|
115 |
|
|
116 |
// ---------------------------------------------------------------------------
|
|
117 |
// ---------------------------------------------------------------------------
|
|
118 |
//
|
|
119 |
EXPORT_C const TDesC8& CAddPluginResult::PluginId()const
|
|
120 |
{
|
|
121 |
if(iPluginId)
|
|
122 |
{
|
|
123 |
return *iPluginId;
|
|
124 |
}
|
|
125 |
else
|
|
126 |
{
|
|
127 |
return KNullDesC8;
|
|
128 |
}
|
|
129 |
}
|
|
130 |
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
// ---------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
EXPORT_C void CAddPluginResult::SetStatus(TInt aStatus )
|
|
135 |
{
|
|
136 |
iStatus = aStatus;
|
|
137 |
}
|
|
138 |
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
// ---------------------------------------------------------------------------
|
|
141 |
//
|
|
142 |
EXPORT_C TInt CAddPluginResult::Status()const
|
|
143 |
{
|
|
144 |
return iStatus;
|
|
145 |
}
|
|
146 |
|
|
147 |
// ---------------------------------------------------------------------------
|
|
148 |
// ---------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
CHspsWrapper::CHspsWrapper(MHspsWrapperObserver* aObserver)
|
|
151 |
: iObserver( aObserver )
|
|
152 |
{
|
|
153 |
}
|
|
154 |
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
// ---------------------------------------------------------------------------
|
|
157 |
//
|
|
158 |
void CHspsWrapper::ConstructL(const TDesC8& aAppUid)
|
|
159 |
{
|
|
160 |
// Read active view.
|
|
161 |
iRepository = CRepository::NewL( TUid::Uid( KCRUidActiveIdleLV ) );
|
|
162 |
LoadActivePluginIdL();
|
|
163 |
|
|
164 |
// Attach to HSPS:
|
|
165 |
iServiceHandler = CLiwServiceHandler::NewL();
|
|
166 |
|
|
167 |
iHspsService = CLiwCriteriaItem::NewL( 1, KHSPSConfigurationIf, KHSPS );
|
|
168 |
iHspsService->SetServiceClass( TUid::Uid( KLiwClassBase ) );
|
|
169 |
|
|
170 |
RCriteriaArray interestList;
|
|
171 |
interestList.AppendL( iHspsService );
|
|
172 |
iServiceHandler->AttachL( interestList );
|
|
173 |
interestList.Reset();
|
|
174 |
|
|
175 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
176 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
177 |
|
|
178 |
TLiwGenericParam appUid;
|
|
179 |
TLiwVariant uidVar;
|
|
180 |
uidVar.Set( aAppUid );
|
|
181 |
appUid.SetNameAndValueL( KHspsAppUid, uidVar );
|
|
182 |
appUid.PushL();
|
|
183 |
inParamList.AppendL( appUid );
|
|
184 |
CleanupStack::Pop();
|
|
185 |
appUid.Reset();
|
|
186 |
|
|
187 |
iServiceHandler->ExecuteServiceCmdL( *iHspsService,inParamList,outParamList );
|
|
188 |
inParamList.Reset();
|
|
189 |
TInt pos = 0;
|
|
190 |
outParamList.FindFirst( pos, KHSPSConfigurationIf );
|
|
191 |
if( pos != KErrNotFound )
|
|
192 |
{
|
|
193 |
iHspsInterface = outParamList[ pos ].Value().AsInterface();
|
|
194 |
outParamList.Reset();
|
|
195 |
}
|
|
196 |
else
|
|
197 |
{
|
|
198 |
outParamList.Reset();
|
|
199 |
User::Leave( KErrNotFound );
|
|
200 |
}
|
|
201 |
|
|
202 |
inParamList.Reset();
|
|
203 |
outParamList.Reset();
|
|
204 |
|
|
205 |
if( iObserver )
|
|
206 |
{
|
|
207 |
iTransactionId = -1;
|
|
208 |
iHspsInterface->ExecuteCmdL( KRequestNotification,
|
|
209 |
inParamList,
|
|
210 |
outParamList,
|
|
211 |
KLiwOptASyncronous,
|
|
212 |
this );
|
|
213 |
const TLiwGenericParam* outParam( NULL );
|
|
214 |
|
|
215 |
TInt pos( 0 );
|
|
216 |
outParam = outParamList.FindFirst( pos, _L8("status") );
|
|
217 |
|
|
218 |
if ( outParam )
|
|
219 |
{
|
|
220 |
TInt retval;
|
|
221 |
retval = outParam->Value().AsTInt32();
|
|
222 |
if(retval == KErrNone )
|
|
223 |
{
|
|
224 |
pos = 0;
|
|
225 |
outParam = outParamList.FindFirst( pos, _L8("TransactionID") );
|
|
226 |
if( outParam )
|
|
227 |
{
|
|
228 |
retval = outParam->Value().AsTInt32();
|
|
229 |
iTransactionId = retval;
|
|
230 |
}
|
|
231 |
}
|
|
232 |
|
|
233 |
}
|
|
234 |
|
|
235 |
}
|
|
236 |
}
|
|
237 |
|
|
238 |
// ---------------------------------------------------------------------------
|
|
239 |
// ---------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
EXPORT_C CHspsWrapper* CHspsWrapper::NewL(const TDesC8& aAppUid,
|
|
242 |
MHspsWrapperObserver* aObserver)
|
|
243 |
{
|
|
244 |
CHspsWrapper* self = CHspsWrapper::NewLC(aAppUid, aObserver);
|
|
245 |
CleanupStack::Pop( self );
|
|
246 |
return self;
|
|
247 |
}
|
|
248 |
|
|
249 |
// ---------------------------------------------------------------------------
|
|
250 |
// ---------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
EXPORT_C CHspsWrapper* CHspsWrapper::NewLC(const TDesC8& aAppUid,
|
|
253 |
MHspsWrapperObserver* aObserver)
|
|
254 |
{
|
|
255 |
CHspsWrapper* self = new( ELeave ) CHspsWrapper( aObserver );
|
|
256 |
CleanupStack::PushL( self );
|
|
257 |
self->ConstructL(aAppUid);
|
|
258 |
return self;
|
|
259 |
}
|
|
260 |
|
|
261 |
// ---------------------------------------------------------------------------
|
|
262 |
// ---------------------------------------------------------------------------
|
|
263 |
//
|
|
264 |
EXPORT_C CHspsWrapper::~CHspsWrapper()
|
|
265 |
{
|
|
266 |
if( iHspsInterface )
|
|
267 |
{
|
|
268 |
// Close interface
|
|
269 |
iHspsInterface->Close();
|
|
270 |
}
|
|
271 |
|
|
272 |
if( iServiceHandler && iHspsService )
|
|
273 |
{
|
|
274 |
// Detach services from the handler
|
|
275 |
RCriteriaArray interestList;
|
|
276 |
TRAP_IGNORE( interestList.AppendL( iHspsService ) );
|
|
277 |
TRAP_IGNORE( iServiceHandler->DetachL( interestList ) );
|
|
278 |
interestList.Reset();
|
|
279 |
}
|
|
280 |
|
|
281 |
delete iHspsService;
|
|
282 |
delete iServiceHandler;
|
|
283 |
delete iRepository;
|
|
284 |
delete iActivePluginId;
|
|
285 |
}
|
|
286 |
|
|
287 |
// ---------------------------------------------------------------------------
|
|
288 |
// ---------------------------------------------------------------------------
|
|
289 |
//
|
|
290 |
EXPORT_C CHspsConfiguration* CHspsWrapper::GetAppConfigurationL()
|
|
291 |
{
|
|
292 |
CHspsConfiguration* configuration = CHspsConfiguration::NewLC();
|
|
293 |
|
|
294 |
// Fetch from liw service
|
|
295 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
296 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
297 |
|
|
298 |
iHspsInterface->ExecuteCmdL( KHSPSCommandGetActiveAppConf,
|
|
299 |
inParamList,
|
|
300 |
outParamList );
|
|
301 |
|
|
302 |
inParamList.Reset();
|
|
303 |
|
|
304 |
// 1: get appConf map
|
|
305 |
TInt index(0);
|
|
306 |
const TLiwGenericParam* conf = outParamList.FindFirst(index,KAppConfKey);
|
|
307 |
if(conf)
|
|
308 |
{
|
|
309 |
const CLiwMap* confMap = conf->Value().AsMap();
|
|
310 |
// 2: Process Configuration map
|
|
311 |
if(confMap)
|
|
312 |
{
|
|
313 |
ProcessConfigurationMapL( *confMap, *configuration, ETrue );
|
|
314 |
}
|
|
315 |
}
|
|
316 |
outParamList.Reset();
|
|
317 |
|
|
318 |
CleanupStack::Pop(configuration);
|
|
319 |
return configuration;
|
|
320 |
}
|
|
321 |
|
|
322 |
// ---------------------------------------------------------------------------
|
|
323 |
// ---------------------------------------------------------------------------
|
|
324 |
//
|
|
325 |
EXPORT_C void CHspsWrapper::GetAppConfigurationsL(
|
|
326 |
RPointerArray<CPluginInfo>& aPlugins )
|
|
327 |
{
|
|
328 |
// Fetch from liw service
|
|
329 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
330 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
331 |
|
|
332 |
iHspsInterface->ExecuteCmdL( KHSPSCommandGetAppConfs,
|
|
333 |
inParamList,
|
|
334 |
outParamList );
|
|
335 |
|
|
336 |
inParamList.Reset();
|
|
337 |
|
|
338 |
TInt index(0);
|
|
339 |
const TLiwGenericParam* confs = outParamList.FindFirst(index,KAppConfsKey);
|
|
340 |
if(confs)
|
|
341 |
{
|
|
342 |
const CLiwList* list = confs->Value().AsList();
|
|
343 |
if(list)
|
|
344 |
{
|
|
345 |
TInt listCount = list->Count();
|
|
346 |
TLiwVariant mapVar;
|
|
347 |
mapVar.PushL();
|
|
348 |
|
|
349 |
for ( TInt index(0); list->AtL( index, mapVar ); ++index )
|
|
350 |
{
|
|
351 |
const CLiwMap* confMap = mapVar.AsMap();
|
|
352 |
|
|
353 |
if ( confMap )
|
|
354 |
{
|
|
355 |
CPluginInfo* plugin = CPluginInfo::NewLC();
|
|
356 |
|
|
357 |
TLiwVariant confVar;
|
|
358 |
confVar.PushL();
|
|
359 |
|
|
360 |
if( confMap->FindL( _L8("uid"), confVar ) )
|
|
361 |
{
|
|
362 |
plugin->SetUidL( confVar.AsData() );
|
|
363 |
}
|
|
364 |
|
|
365 |
confVar.Reset();
|
|
366 |
|
|
367 |
if( confMap->FindL(_L8("name"), confVar ) )
|
|
368 |
{
|
|
369 |
plugin->SetNameL( confVar.AsData() );
|
|
370 |
}
|
|
371 |
|
|
372 |
CleanupStack::Pop(&confVar);
|
|
373 |
confVar.Reset();
|
|
374 |
|
|
375 |
plugin->SetTypeL( _L8("application") );
|
|
376 |
|
|
377 |
aPlugins.AppendL( plugin );
|
|
378 |
CleanupStack::Pop( plugin );
|
|
379 |
}
|
|
380 |
}
|
|
381 |
CleanupStack::Pop(&mapVar);
|
|
382 |
mapVar.Reset();
|
|
383 |
}
|
|
384 |
}
|
|
385 |
outParamList.Reset();
|
|
386 |
}
|
|
387 |
|
|
388 |
|
|
389 |
// ---------------------------------------------------------------------------
|
|
390 |
// ---------------------------------------------------------------------------
|
|
391 |
//
|
|
392 |
EXPORT_C TInt CHspsWrapper::SetAppConfigurationL(
|
|
393 |
const TDesC8& aConfigurationUid )
|
|
394 |
{
|
|
395 |
SetActivePluginL( KPluginIdNotSet );
|
|
396 |
|
|
397 |
#ifdef _XN_PERFORMANCE_TEST_
|
|
398 |
RDebug::Print( _L( "CHspsWrapper::SetAppConfigurationL() - start" ) );
|
|
399 |
#endif //_XN_PERFORMANCE_TEST_
|
|
400 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
401 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
402 |
|
|
403 |
// Compose Liw message
|
|
404 |
TLiwGenericParam confIdParam;
|
|
405 |
confIdParam.SetNameAndValueL( KKeyConfUid, TLiwVariant(aConfigurationUid) );
|
|
406 |
confIdParam.PushL();
|
|
407 |
inParamList.AppendL( confIdParam );
|
|
408 |
CleanupStack::Pop(&confIdParam);
|
|
409 |
confIdParam.Reset();
|
|
410 |
|
|
411 |
iHspsInterface->ExecuteCmdL( KHSPSCommandSetAppConf,
|
|
412 |
inParamList,
|
|
413 |
outParamList );
|
|
414 |
|
|
415 |
inParamList.Reset();
|
|
416 |
|
|
417 |
// check success
|
|
418 |
const TLiwGenericParam* outParam = NULL;
|
|
419 |
TInt pos(0);
|
|
420 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
421 |
TInt status(KErrGeneral);
|
|
422 |
|
|
423 |
if ( outParam )
|
|
424 |
{
|
|
425 |
status = outParam->Value().AsTInt32();
|
|
426 |
}
|
|
427 |
outParamList.Reset();
|
|
428 |
#ifdef _XN_PERFORMANCE_TEST_
|
|
429 |
RDebug::Print( _L( "CHspsWrapper::SetAppConfigurationL() - end" ) );
|
|
430 |
#endif //_XN_PERFORMANCE_TEST_
|
|
431 |
return status;
|
|
432 |
}
|
|
433 |
|
|
434 |
// ---------------------------------------------------------------------------
|
|
435 |
// ---------------------------------------------------------------------------
|
|
436 |
//
|
|
437 |
EXPORT_C CHspsConfiguration* CHspsWrapper::GetPluginConfigurationL(
|
|
438 |
const TDesC8& aPluginId)
|
|
439 |
{
|
|
440 |
CHspsConfiguration* configuration = CHspsConfiguration::NewLC();
|
|
441 |
|
|
442 |
// Fetch from liw service
|
|
443 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
444 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
445 |
// Form input message
|
|
446 |
|
|
447 |
TLiwGenericParam pluginIdParam;
|
|
448 |
TLiwVariant pluginIdVar;
|
|
449 |
pluginIdVar.Set( aPluginId );
|
|
450 |
pluginIdParam.SetNameAndValueL( KKeyPluginId, pluginIdVar );
|
|
451 |
pluginIdParam.PushL();
|
|
452 |
inParamList.AppendL( pluginIdParam );
|
|
453 |
CleanupStack::Pop(&pluginIdParam);
|
|
454 |
pluginIdParam.Reset();
|
|
455 |
|
|
456 |
|
|
457 |
iHspsInterface->ExecuteCmdL( KHSPSCommandGetPluginConf,
|
|
458 |
inParamList,
|
|
459 |
outParamList );
|
|
460 |
inParamList.Reset();
|
|
461 |
|
|
462 |
// 1: get pluginConf map
|
|
463 |
TInt index(0);
|
|
464 |
const TLiwGenericParam* conf = outParamList.FindFirst(index,KPluginConfKey);
|
|
465 |
if(conf)
|
|
466 |
{
|
|
467 |
const CLiwMap* confMap = conf->Value().AsMap();
|
|
468 |
// 2: Process Configuration map
|
|
469 |
if(confMap)
|
|
470 |
{
|
|
471 |
ProcessConfigurationMapL( *confMap, *configuration, EFalse );
|
|
472 |
}
|
|
473 |
}
|
|
474 |
|
|
475 |
outParamList.Reset();
|
|
476 |
CleanupStack::Pop(configuration);
|
|
477 |
|
|
478 |
return configuration;
|
|
479 |
}
|
|
480 |
|
|
481 |
// ---------------------------------------------------------------------------
|
|
482 |
// ---------------------------------------------------------------------------
|
|
483 |
//
|
|
484 |
EXPORT_C void CHspsWrapper::GetPluginsL(
|
|
485 |
RPointerArray<CPluginInfo>& aPlugins,
|
|
486 |
const TDesC8& aPluginInterface,
|
|
487 |
const TDesC8& aPluginType)
|
|
488 |
{
|
|
489 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
490 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
491 |
|
|
492 |
// plugin interface
|
|
493 |
TLiwGenericParam interfaceParam( KInterface, TLiwVariant( aPluginInterface ) );
|
|
494 |
interfaceParam.PushL();
|
|
495 |
inParamList.AppendL( interfaceParam );
|
|
496 |
CleanupStack::Pop(&interfaceParam);
|
|
497 |
interfaceParam.Reset();
|
|
498 |
|
|
499 |
// plugin type
|
|
500 |
TLiwGenericParam typeParam;
|
|
501 |
typeParam.SetNameAndValueL( KType, TLiwVariant(aPluginType ) );
|
|
502 |
typeParam.PushL();
|
|
503 |
inParamList.AppendL( typeParam );
|
|
504 |
CleanupStack::Pop(&typeParam);
|
|
505 |
typeParam.Reset();
|
|
506 |
|
|
507 |
TLiwGenericParam logosParam;
|
|
508 |
logosParam.SetNameAndValueL( KCopyLogos, TLiwVariant( ETrue ) );
|
|
509 |
logosParam.PushL();
|
|
510 |
inParamList.AppendL( logosParam );
|
|
511 |
CleanupStack::Pop(&logosParam);
|
|
512 |
logosParam.Reset();
|
|
513 |
|
|
514 |
iHspsInterface->ExecuteCmdL( KHSPSCommandGetPlugins, inParamList, outParamList );
|
|
515 |
inParamList.Reset();
|
|
516 |
|
|
517 |
TInt index(0);
|
|
518 |
const TLiwGenericParam* plugins = outParamList.FindFirst(index,KPluginsKey);
|
|
519 |
if(plugins)
|
|
520 |
{
|
|
521 |
const CLiwList* list = plugins->Value().AsList();
|
|
522 |
if(list)
|
|
523 |
{
|
|
524 |
ProcessPluginsL(*list,aPlugins);
|
|
525 |
}
|
|
526 |
}
|
|
527 |
|
|
528 |
// check success
|
|
529 |
TInt pos(0);
|
|
530 |
const TLiwGenericParam* outParam =
|
|
531 |
outParamList.FindFirst( pos, KOutKeyStatus );
|
|
532 |
if ( outParam )
|
|
533 |
{
|
|
534 |
User::LeaveIfError( outParam->Value().AsTInt32() );
|
|
535 |
}
|
|
536 |
|
|
537 |
outParamList.Reset();
|
|
538 |
}
|
|
539 |
|
|
540 |
// ---------------------------------------------------------------------------
|
|
541 |
// ---------------------------------------------------------------------------
|
|
542 |
//
|
|
543 |
EXPORT_C CAddPluginResult* CHspsWrapper::AddPluginL(
|
|
544 |
const TDesC8& aTargetConfiguration,
|
|
545 |
const TDesC8& aPluginUid)
|
|
546 |
{
|
|
547 |
// Compose AddPlugin hsps LIW message to Service.HomeScreenPluginConfiguration
|
|
548 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
549 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
550 |
|
|
551 |
TLiwGenericParam confIdParam;
|
|
552 |
confIdParam.SetNameAndValueL( KConfId, TLiwVariant(aTargetConfiguration) );
|
|
553 |
confIdParam.PushL();
|
|
554 |
inParamList.AppendL( confIdParam );
|
|
555 |
CleanupStack::Pop(&confIdParam);
|
|
556 |
confIdParam.Reset();
|
|
557 |
|
|
558 |
TLiwGenericParam pluginUidParam;
|
|
559 |
pluginUidParam.SetNameAndValueL( KPluginUid, TLiwVariant(aPluginUid) );
|
|
560 |
pluginUidParam.PushL();
|
|
561 |
inParamList.AppendL( pluginUidParam );
|
|
562 |
CleanupStack::Pop(&pluginUidParam);
|
|
563 |
pluginUidParam.Reset();
|
|
564 |
|
|
565 |
// add widget to configuration
|
|
566 |
iHspsInterface->ExecuteCmdL( KHSPSCommandAddPlugin,
|
|
567 |
inParamList,
|
|
568 |
outParamList );
|
|
569 |
inParamList.Reset();
|
|
570 |
|
|
571 |
CAddPluginResult* result = CAddPluginResult::NewL();
|
|
572 |
CleanupStack::PushL(result);
|
|
573 |
// test success
|
|
574 |
const TLiwGenericParam* outParam = NULL;
|
|
575 |
TInt pos(0);
|
|
576 |
outParam = outParamList.FindFirst( pos, _L8("status") );
|
|
577 |
if ( outParam )
|
|
578 |
{
|
|
579 |
result->SetStatus(outParam->Value().AsTInt32());
|
|
580 |
}
|
|
581 |
else
|
|
582 |
{
|
|
583 |
result->SetStatus(KErrNone);
|
|
584 |
pos = 0;
|
|
585 |
outParam = outParamList.FindFirst( pos, _L8("pluginId") );
|
|
586 |
if ( outParam )
|
|
587 |
{
|
|
588 |
result->SetPluginIdL(outParam->Value().AsData());
|
|
589 |
}
|
|
590 |
else
|
|
591 |
{
|
|
592 |
// should never happen, but change status back to KErrNotFound
|
|
593 |
result->SetStatus(KErrNotFound);
|
|
594 |
}
|
|
595 |
}
|
|
596 |
|
|
597 |
CleanupStack::Pop(result);
|
|
598 |
return result;
|
|
599 |
}
|
|
600 |
|
|
601 |
// ---------------------------------------------------------------------------
|
|
602 |
// ---------------------------------------------------------------------------
|
|
603 |
//
|
|
604 |
EXPORT_C CAddPluginResult* CHspsWrapper::AddPluginL(
|
|
605 |
const TDesC8& aTargetConfiguration,
|
|
606 |
const TDesC8& aPluginUid,
|
|
607 |
const TInt aIndex )
|
|
608 |
{
|
|
609 |
// Compose AddPlugin hsps LIW message to Service.HomeScreenPluginConfiguration
|
|
610 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
611 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
612 |
|
|
613 |
TLiwGenericParam confIdParam;
|
|
614 |
confIdParam.SetNameAndValueL( KConfId, TLiwVariant(aTargetConfiguration) );
|
|
615 |
confIdParam.PushL();
|
|
616 |
inParamList.AppendL( confIdParam );
|
|
617 |
CleanupStack::Pop(&confIdParam);
|
|
618 |
confIdParam.Reset();
|
|
619 |
|
|
620 |
TLiwGenericParam pluginUidParam;
|
|
621 |
pluginUidParam.SetNameAndValueL( KPluginUid, TLiwVariant(aPluginUid) );
|
|
622 |
pluginUidParam.PushL();
|
|
623 |
inParamList.AppendL( pluginUidParam );
|
|
624 |
CleanupStack::Pop(&pluginUidParam);
|
|
625 |
pluginUidParam.Reset();
|
|
626 |
|
|
627 |
if(aIndex >= 0)
|
|
628 |
{
|
|
629 |
TBuf8<32> buf;
|
|
630 |
buf.Num( aIndex );
|
|
631 |
TLiwGenericParam indexParam;
|
|
632 |
indexParam.SetNameAndValueL( KIndex, TLiwVariant( buf ) );
|
|
633 |
indexParam.PushL();
|
|
634 |
inParamList.AppendL( indexParam );
|
|
635 |
CleanupStack::Pop(&indexParam);
|
|
636 |
indexParam.Reset();
|
|
637 |
}
|
|
638 |
|
|
639 |
// add widget to configuration
|
|
640 |
iHspsInterface->ExecuteCmdL( KHSPSCommandAddPlugin,
|
|
641 |
inParamList,
|
|
642 |
outParamList );
|
|
643 |
inParamList.Reset();
|
|
644 |
|
|
645 |
CAddPluginResult* result = CAddPluginResult::NewL();
|
|
646 |
CleanupStack::PushL(result);
|
|
647 |
// test success
|
|
648 |
const TLiwGenericParam* outParam = NULL;
|
|
649 |
TInt pos(0);
|
|
650 |
outParam = outParamList.FindFirst( pos, _L8("status") );
|
|
651 |
if ( outParam )
|
|
652 |
{
|
|
653 |
result->SetStatus(outParam->Value().AsTInt32());
|
|
654 |
}
|
|
655 |
else
|
|
656 |
{
|
|
657 |
result->SetStatus(KErrNone);
|
|
658 |
pos = 0;
|
|
659 |
outParam = outParamList.FindFirst( pos, _L8("pluginId") );
|
|
660 |
if ( outParam )
|
|
661 |
{
|
|
662 |
result->SetPluginIdL(outParam->Value().AsData());
|
|
663 |
}
|
|
664 |
else
|
|
665 |
{
|
|
666 |
// should never happen, but change status back to KErrNotFound
|
|
667 |
result->SetStatus(KErrNotFound);
|
|
668 |
}
|
|
669 |
}
|
|
670 |
|
|
671 |
CleanupStack::Pop(result);
|
|
672 |
return result;
|
|
673 |
}
|
|
674 |
|
|
675 |
// ---------------------------------------------------------------------------
|
|
676 |
// ---------------------------------------------------------------------------
|
|
677 |
//
|
|
678 |
EXPORT_C TInt CHspsWrapper::RemovePluginL(const TDesC8& aPluginId)
|
|
679 |
{
|
|
680 |
// Compose AddPlugin hsps LIW message to Service.HomeScreenPluginConfiguration
|
|
681 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
682 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
683 |
|
|
684 |
// Compose Liw message
|
|
685 |
TLiwGenericParam pluginIdParam;
|
|
686 |
pluginIdParam.SetNameAndValueL( KKeyPluginId, TLiwVariant(aPluginId) );
|
|
687 |
pluginIdParam.PushL();
|
|
688 |
inParamList.AppendL( pluginIdParam );
|
|
689 |
CleanupStack::Pop(&pluginIdParam);
|
|
690 |
pluginIdParam.Reset();
|
|
691 |
|
|
692 |
iHspsInterface->ExecuteCmdL( KHSPSCommandRemovePlugin,
|
|
693 |
inParamList,
|
|
694 |
outParamList );
|
|
695 |
|
|
696 |
inParamList.Reset();
|
|
697 |
|
|
698 |
// check success
|
|
699 |
const TLiwGenericParam* outParam = NULL;
|
|
700 |
TInt pos(0);
|
|
701 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
702 |
TInt status(KErrGeneral);
|
|
703 |
|
|
704 |
if ( outParam )
|
|
705 |
{
|
|
706 |
status = outParam->Value().AsTInt32();
|
|
707 |
}
|
|
708 |
outParamList.Reset();
|
|
709 |
return status;
|
|
710 |
}
|
|
711 |
|
|
712 |
// ---------------------------------------------------------------------------
|
|
713 |
// ---------------------------------------------------------------------------
|
|
714 |
//
|
|
715 |
EXPORT_C TInt CHspsWrapper::ReplacePluginL(
|
|
716 |
const TDesC8& aPluginId,
|
|
717 |
const TDesC8& aConfUid )
|
|
718 |
{
|
|
719 |
// Compose ReplacePlugin hsps LIW message to Service.HomeScreenPluginConfiguration
|
|
720 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
721 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
722 |
|
|
723 |
// Compose Liw message
|
|
724 |
TLiwGenericParam pluginIdParam;
|
|
725 |
pluginIdParam.SetNameAndValueL( KKeyPluginId, TLiwVariant(aPluginId) );
|
|
726 |
pluginIdParam.PushL();
|
|
727 |
inParamList.AppendL( pluginIdParam );
|
|
728 |
CleanupStack::Pop(&pluginIdParam);
|
|
729 |
pluginIdParam.Reset();
|
|
730 |
|
|
731 |
TLiwGenericParam confUidParam;
|
|
732 |
confUidParam.SetNameAndValueL( KKeyConfUid, TLiwVariant( aConfUid ) );
|
|
733 |
confUidParam.PushL();
|
|
734 |
inParamList.AppendL( confUidParam );
|
|
735 |
CleanupStack::Pop( &confUidParam );
|
|
736 |
confUidParam.Reset();
|
|
737 |
|
|
738 |
// Execute command
|
|
739 |
iHspsInterface->ExecuteCmdL( KHSPSCommandReplacePlugin,
|
|
740 |
inParamList,
|
|
741 |
outParamList );
|
|
742 |
|
|
743 |
inParamList.Reset();
|
|
744 |
|
|
745 |
// check success
|
|
746 |
const TLiwGenericParam* outParam = NULL;
|
|
747 |
TInt pos(0);
|
|
748 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
749 |
TInt status( KErrGeneral );
|
|
750 |
|
|
751 |
if ( outParam )
|
|
752 |
{
|
|
753 |
status = outParam->Value().AsTInt32();
|
|
754 |
}
|
|
755 |
outParamList.Reset();
|
|
756 |
return status;
|
|
757 |
}
|
|
758 |
|
|
759 |
// ---------------------------------------------------------------------------
|
|
760 |
// ---------------------------------------------------------------------------
|
|
761 |
//
|
|
762 |
EXPORT_C TInt CHspsWrapper::SetActivePluginL( const TDesC8& aPluginId )
|
|
763 |
{
|
|
764 |
TPtrC8 pluginId = aPluginId;
|
|
765 |
if( aPluginId.Length() > KMaxPluginIdLen )
|
|
766 |
{
|
|
767 |
pluginId.Set( aPluginId.Left( KMaxPluginIdLen ) );
|
|
768 |
}
|
|
769 |
|
|
770 |
const TInt error = iRepository->Set( KAIActiveViewPluginId, pluginId );
|
|
771 |
|
|
772 |
delete iActivePluginId;
|
|
773 |
iActivePluginId = NULL;
|
|
774 |
|
|
775 |
if( error == KErrNone )
|
|
776 |
{
|
|
777 |
iActivePluginId = pluginId.AllocL();
|
|
778 |
}
|
|
779 |
else
|
|
780 |
{
|
|
781 |
iActivePluginId = KPluginIdNotSet().AllocL();
|
|
782 |
}
|
|
783 |
|
|
784 |
return error;
|
|
785 |
}
|
|
786 |
|
|
787 |
// ---------------------------------------------------------------------------
|
|
788 |
// ---------------------------------------------------------------------------
|
|
789 |
//
|
|
790 |
EXPORT_C TInt CHspsWrapper::RestoreViewsL()
|
|
791 |
{
|
|
792 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
793 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
794 |
|
|
795 |
// Compose Liw message
|
|
796 |
TLiwGenericParam restoreTypeParam;
|
|
797 |
restoreTypeParam.SetNameAndValueL( KRestore, TLiwVariant( KRestoreViews ) );
|
|
798 |
restoreTypeParam.PushL();
|
|
799 |
inParamList.AppendL( restoreTypeParam );
|
|
800 |
CleanupStack::Pop( &restoreTypeParam );
|
|
801 |
restoreTypeParam.Reset();
|
|
802 |
|
|
803 |
iHspsInterface->ExecuteCmdL( KHSPSCommandRestoreConfigurations,
|
|
804 |
inParamList,
|
|
805 |
outParamList );
|
|
806 |
|
|
807 |
inParamList.Reset();
|
|
808 |
|
|
809 |
// check success
|
|
810 |
const TLiwGenericParam* outParam = NULL;
|
|
811 |
TInt pos(0);
|
|
812 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
813 |
TInt status(KErrGeneral);
|
|
814 |
|
|
815 |
if ( outParam )
|
|
816 |
{
|
|
817 |
status = outParam->Value().AsTInt32();
|
|
818 |
}
|
|
819 |
outParamList.Reset();
|
|
820 |
return status;
|
|
821 |
}
|
|
822 |
|
|
823 |
// ---------------------------------------------------------------------------
|
|
824 |
// ---------------------------------------------------------------------------
|
|
825 |
//
|
|
826 |
EXPORT_C TInt CHspsWrapper::RestoreRomConfL()
|
|
827 |
{
|
|
828 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
829 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
830 |
|
|
831 |
// Compose Liw message
|
|
832 |
TLiwGenericParam restoreTypeParam;
|
|
833 |
restoreTypeParam.SetNameAndValueL( KRestore, TLiwVariant( KRestoreRom ) );
|
|
834 |
restoreTypeParam.PushL();
|
|
835 |
inParamList.AppendL( restoreTypeParam );
|
|
836 |
CleanupStack::Pop( &restoreTypeParam );
|
|
837 |
restoreTypeParam.Reset();
|
|
838 |
|
|
839 |
iHspsInterface->ExecuteCmdL( KHSPSCommandRestoreConfigurations,
|
|
840 |
inParamList,
|
|
841 |
outParamList );
|
|
842 |
|
|
843 |
inParamList.Reset();
|
|
844 |
|
|
845 |
// check success
|
|
846 |
const TLiwGenericParam* outParam = NULL;
|
|
847 |
TInt pos(0);
|
|
848 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
849 |
TInt status(KErrGeneral);
|
|
850 |
|
|
851 |
if ( outParam )
|
|
852 |
{
|
|
853 |
status = outParam->Value().AsTInt32();
|
|
854 |
}
|
|
855 |
outParamList.Reset();
|
|
856 |
return status;
|
|
857 |
}
|
|
858 |
|
|
859 |
// ---------------------------------------------------------------------------
|
|
860 |
// ---------------------------------------------------------------------------
|
|
861 |
//
|
|
862 |
EXPORT_C TInt CHspsWrapper::RestoreAllConfL()
|
|
863 |
{
|
|
864 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
865 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
866 |
|
|
867 |
// Compose Liw message
|
|
868 |
TLiwGenericParam restoreTypeParam;
|
|
869 |
restoreTypeParam.SetNameAndValueL( KRestore, TLiwVariant( KRestoreAll ) );
|
|
870 |
restoreTypeParam.PushL();
|
|
871 |
inParamList.AppendL( restoreTypeParam );
|
|
872 |
CleanupStack::Pop( &restoreTypeParam );
|
|
873 |
restoreTypeParam.Reset();
|
|
874 |
|
|
875 |
iHspsInterface->ExecuteCmdL( KHSPSCommandRestoreConfigurations,
|
|
876 |
inParamList,
|
|
877 |
outParamList );
|
|
878 |
|
|
879 |
inParamList.Reset();
|
|
880 |
|
|
881 |
// check success
|
|
882 |
const TLiwGenericParam* outParam = NULL;
|
|
883 |
TInt pos(0);
|
|
884 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
885 |
TInt status(KErrGeneral);
|
|
886 |
|
|
887 |
if ( outParam )
|
|
888 |
{
|
|
889 |
status = outParam->Value().AsTInt32();
|
|
890 |
}
|
|
891 |
outParamList.Reset();
|
|
892 |
return status;
|
|
893 |
}
|
|
894 |
|
|
895 |
// ---------------------------------------------------------------------------
|
|
896 |
// ---------------------------------------------------------------------------
|
|
897 |
//
|
|
898 |
EXPORT_C TInt CHspsWrapper::RestoreDefaultConfL()
|
|
899 |
{
|
|
900 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
901 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
902 |
|
|
903 |
// Compose Liw message
|
|
904 |
TLiwGenericParam restoreTypeParam;
|
|
905 |
restoreTypeParam.SetNameAndValueL( KRestore, TLiwVariant( KRestoreDefault ) );
|
|
906 |
restoreTypeParam.PushL();
|
|
907 |
inParamList.AppendL( restoreTypeParam );
|
|
908 |
CleanupStack::Pop( &restoreTypeParam );
|
|
909 |
restoreTypeParam.Reset();
|
|
910 |
|
|
911 |
iHspsInterface->ExecuteCmdL( KHSPSCommandRestoreConfigurations,
|
|
912 |
inParamList,
|
|
913 |
outParamList );
|
|
914 |
|
|
915 |
inParamList.Reset();
|
|
916 |
|
|
917 |
// check success
|
|
918 |
const TLiwGenericParam* outParam = NULL;
|
|
919 |
TInt pos(0);
|
|
920 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
921 |
TInt status(KErrGeneral);
|
|
922 |
|
|
923 |
if ( outParam )
|
|
924 |
{
|
|
925 |
status = outParam->Value().AsTInt32();
|
|
926 |
}
|
|
927 |
outParamList.Reset();
|
|
928 |
return status;
|
|
929 |
}
|
|
930 |
|
|
931 |
// ---------------------------------------------------------------------------
|
|
932 |
// ---------------------------------------------------------------------------
|
|
933 |
//
|
|
934 |
EXPORT_C TInt CHspsWrapper::MovePluginsL(
|
|
935 |
const TDesC8& aConfId,
|
|
936 |
const MDesC8Array& aPluginIds)
|
|
937 |
{
|
|
938 |
// Compose AddPlugin hsps LIW message to Service.HomeScreenPluginConfiguration
|
|
939 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
940 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
941 |
|
|
942 |
TLiwGenericParam confIdParam;
|
|
943 |
confIdParam.SetNameAndValueL( KConfId, TLiwVariant(aConfId) );
|
|
944 |
confIdParam.PushL();
|
|
945 |
inParamList.AppendL( confIdParam );
|
|
946 |
CleanupStack::Pop( &confIdParam );
|
|
947 |
confIdParam.Reset();
|
|
948 |
|
|
949 |
// add "plugins" parameter to the inParamList
|
|
950 |
CLiwDefaultList* inPluginList = CLiwDefaultList::NewLC();
|
|
951 |
for( int i = 0; i < aPluginIds.MdcaCount(); i++ )
|
|
952 |
{
|
|
953 |
const TDesC8& id = aPluginIds.MdcaPoint(i);
|
|
954 |
inPluginList->AppendL( TLiwVariant(id) );
|
|
955 |
}
|
|
956 |
|
|
957 |
TLiwGenericParam pluginsParam;
|
|
958 |
pluginsParam.SetNameAndValueL( KKeyPlugins, TLiwVariant(inPluginList) );
|
|
959 |
pluginsParam.PushL();
|
|
960 |
inParamList.AppendL( pluginsParam );
|
|
961 |
CleanupStack::Pop( &pluginsParam );
|
|
962 |
pluginsParam.Reset();
|
|
963 |
|
|
964 |
iHspsInterface->ExecuteCmdL( KHSPSMovePlugins,
|
|
965 |
inParamList,
|
|
966 |
outParamList );
|
|
967 |
|
|
968 |
CleanupStack::PopAndDestroy( inPluginList );
|
|
969 |
inParamList.Reset();
|
|
970 |
|
|
971 |
|
|
972 |
// check success
|
|
973 |
const TLiwGenericParam* outParam = NULL;
|
|
974 |
TInt pos(0);
|
|
975 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
976 |
TInt status(KErrGeneral);
|
|
977 |
|
|
978 |
if ( outParam )
|
|
979 |
{
|
|
980 |
status = outParam->Value().AsTInt32();
|
|
981 |
}
|
|
982 |
outParamList.Reset();
|
|
983 |
return status;
|
|
984 |
}
|
|
985 |
|
|
986 |
// ---------------------------------------------------------------------------
|
|
987 |
// ---------------------------------------------------------------------------
|
|
988 |
//
|
|
989 |
EXPORT_C TInt CHspsWrapper::SetPluginSettingsL(
|
|
990 |
const TDesC8& aPluginId,
|
|
991 |
const RPointerArray<CItemMap>& aSettings)
|
|
992 |
{
|
|
993 |
// Compose AddPlugin hsps LIW message to Service.HomeScreenPluginConfiguration
|
|
994 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
995 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
996 |
|
|
997 |
TLiwGenericParam pluginIdParam;
|
|
998 |
pluginIdParam.SetNameAndValueL( KKeyPluginId, TLiwVariant(aPluginId) );
|
|
999 |
pluginIdParam.PushL();
|
|
1000 |
inParamList.AppendL( pluginIdParam );
|
|
1001 |
CleanupStack::Pop( &pluginIdParam );
|
|
1002 |
pluginIdParam.Reset();
|
|
1003 |
|
|
1004 |
CLiwDefaultList* itemMapList = CLiwDefaultList::NewLC();
|
|
1005 |
for( int i = 0; i < aSettings.Count(); i++ )
|
|
1006 |
{
|
|
1007 |
CItemMap* itemMap = aSettings[i];
|
|
1008 |
|
|
1009 |
CLiwDefaultMap* inItemMap = CLiwDefaultMap::NewLC();
|
|
1010 |
FillMapFromItemL(*inItemMap,*itemMap);
|
|
1011 |
itemMapList->AppendL( TLiwVariant(inItemMap) );
|
|
1012 |
CleanupStack::PopAndDestroy(inItemMap);
|
|
1013 |
}
|
|
1014 |
|
|
1015 |
TLiwGenericParam settingsParam;
|
|
1016 |
settingsParam.SetNameAndValueL( KKeySettings, TLiwVariant(itemMapList) );
|
|
1017 |
settingsParam.PushL();
|
|
1018 |
inParamList.AppendL( settingsParam );
|
|
1019 |
CleanupStack::Pop( &settingsParam );
|
|
1020 |
settingsParam.Reset();
|
|
1021 |
|
|
1022 |
iHspsInterface->ExecuteCmdL( KHSPSSetPluginSettings,
|
|
1023 |
inParamList,
|
|
1024 |
outParamList );
|
|
1025 |
|
|
1026 |
CleanupStack::PopAndDestroy( itemMapList );
|
|
1027 |
inParamList.Reset();
|
|
1028 |
|
|
1029 |
|
|
1030 |
// check success
|
|
1031 |
const TLiwGenericParam* outParam = NULL;
|
|
1032 |
TInt pos(0);
|
|
1033 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
1034 |
TInt status(KErrGeneral);
|
|
1035 |
|
|
1036 |
if ( outParam )
|
|
1037 |
{
|
|
1038 |
status = outParam->Value().AsTInt32();
|
|
1039 |
}
|
|
1040 |
outParamList.Reset();
|
|
1041 |
return status;
|
|
1042 |
}
|
|
1043 |
|
|
1044 |
// ---------------------------------------------------------------------------
|
|
1045 |
// ---------------------------------------------------------------------------
|
|
1046 |
//
|
|
1047 |
EXPORT_C TInt CHspsWrapper::SetConfStateL( const TDesC8& aConfId,
|
|
1048 |
const TDesC8& aState, TBool aIncludePlugins )
|
|
1049 |
{
|
|
1050 |
// Compose AddPlugin hsps LIW message to Service.HomeScreenPluginConfiguration
|
|
1051 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
1052 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
1053 |
|
|
1054 |
// Compose Liw message
|
|
1055 |
TLiwGenericParam confIdParam;
|
|
1056 |
confIdParam.SetNameAndValueL( KConfId, TLiwVariant( aConfId ) );
|
|
1057 |
confIdParam.PushL();
|
|
1058 |
inParamList.AppendL( confIdParam );
|
|
1059 |
CleanupStack::Pop(&confIdParam);
|
|
1060 |
confIdParam.Reset();
|
|
1061 |
|
|
1062 |
TLiwGenericParam pluginStateParam;
|
|
1063 |
pluginStateParam.SetNameAndValueL( KConfState, TLiwVariant( aState ) );
|
|
1064 |
pluginStateParam.PushL();
|
|
1065 |
inParamList.AppendL( pluginStateParam );
|
|
1066 |
CleanupStack::Pop(&pluginStateParam);
|
|
1067 |
pluginStateParam.Reset();
|
|
1068 |
|
|
1069 |
iHspsInterface->ExecuteCmdL( KHSPSCommandSetConfState,
|
|
1070 |
inParamList,
|
|
1071 |
outParamList );
|
|
1072 |
|
|
1073 |
const TLiwGenericParam* outParam = NULL;
|
|
1074 |
TInt pos(0);
|
|
1075 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
1076 |
TInt status(KErrGeneral);
|
|
1077 |
|
|
1078 |
if ( outParam )
|
|
1079 |
{
|
|
1080 |
status = outParam->Value().AsTInt32();
|
|
1081 |
}
|
|
1082 |
|
|
1083 |
outParamList.Reset();
|
|
1084 |
|
|
1085 |
if( !status && aIncludePlugins )
|
|
1086 |
{
|
|
1087 |
_LIT8( KFilter, "filter" );
|
|
1088 |
_LIT8( KFilterPlugins, "Plugins" );
|
|
1089 |
|
|
1090 |
TLiwGenericParam filterParam;
|
|
1091 |
filterParam.PushL();
|
|
1092 |
filterParam.SetNameAndValueL( KFilter, TLiwVariant( KFilterPlugins ) );
|
|
1093 |
inParamList.AppendL( filterParam );
|
|
1094 |
CleanupStack::Pop(&filterParam);
|
|
1095 |
filterParam.Reset();
|
|
1096 |
|
|
1097 |
iHspsInterface->ExecuteCmdL( KHSPSCommandSetConfState,
|
|
1098 |
inParamList,
|
|
1099 |
outParamList );
|
|
1100 |
|
|
1101 |
// check success
|
|
1102 |
pos = 0;
|
|
1103 |
outParam = outParamList.FindFirst( pos, KOutKeyStatus );
|
|
1104 |
status = KErrGeneral;
|
|
1105 |
|
|
1106 |
if ( outParam )
|
|
1107 |
{
|
|
1108 |
status = outParam->Value().AsTInt32();
|
|
1109 |
}
|
|
1110 |
|
|
1111 |
outParamList.Reset();
|
|
1112 |
}
|
|
1113 |
|
|
1114 |
inParamList.Reset();
|
|
1115 |
|
|
1116 |
return status;
|
|
1117 |
}
|
|
1118 |
|
|
1119 |
// ---------------------------------------------------------------------------
|
|
1120 |
// ---------------------------------------------------------------------------
|
|
1121 |
//
|
|
1122 |
EXPORT_C CLiwServiceHandler* CHspsWrapper::ServiceHandler() const
|
|
1123 |
{
|
|
1124 |
return iServiceHandler;
|
|
1125 |
}
|
|
1126 |
|
|
1127 |
// ---------------------------------------------------------------------------
|
|
1128 |
// ---------------------------------------------------------------------------
|
|
1129 |
//
|
|
1130 |
EXPORT_C CLiwCriteriaItem* CHspsWrapper::HspsService() const
|
|
1131 |
{
|
|
1132 |
return iHspsService;
|
|
1133 |
}
|
|
1134 |
|
|
1135 |
// ---------------------------------------------------------------------------
|
|
1136 |
// ---------------------------------------------------------------------------
|
|
1137 |
//
|
|
1138 |
EXPORT_C MLiwInterface* CHspsWrapper::HspsInterface() const
|
|
1139 |
{
|
|
1140 |
return iHspsInterface;
|
|
1141 |
}
|
|
1142 |
|
|
1143 |
// ---------------------------------------------------------------------------
|
|
1144 |
// ---------------------------------------------------------------------------
|
|
1145 |
//
|
|
1146 |
void CHspsWrapper::ProcessConfigurationMapL(
|
|
1147 |
const CLiwMap& aSource,
|
|
1148 |
CHspsConfiguration& aTarget,
|
|
1149 |
const TBool aAppConf )
|
|
1150 |
{
|
|
1151 |
TLiwVariant tempVariant;
|
|
1152 |
tempVariant.PushL();
|
|
1153 |
|
|
1154 |
if ( aSource.FindL( _L8("id"), tempVariant ) )
|
|
1155 |
{
|
|
1156 |
aTarget.SetConfIdL(tempVariant.AsData());
|
|
1157 |
}
|
|
1158 |
if ( aSource.FindL( _L8("uid"), tempVariant ) )
|
|
1159 |
{
|
|
1160 |
aTarget.PluginInfo().SetUidL(tempVariant.AsData());
|
|
1161 |
}
|
|
1162 |
if ( aSource.FindL( _L8("type"), tempVariant ) )
|
|
1163 |
{
|
|
1164 |
aTarget.PluginInfo().SetTypeL(tempVariant.AsData());
|
|
1165 |
}
|
|
1166 |
if ( aSource.FindL( _L8("interface"), tempVariant ) )
|
|
1167 |
{
|
|
1168 |
aTarget.PluginInfo().SetInterfaceL(tempVariant.AsData());
|
|
1169 |
}
|
|
1170 |
if ( aSource.FindL( _L8("name"), tempVariant ) )
|
|
1171 |
{
|
|
1172 |
aTarget.PluginInfo().SetNameL(tempVariant.AsData());
|
|
1173 |
}
|
|
1174 |
if ( aSource.FindL( _L8("state"), tempVariant ) )
|
|
1175 |
{
|
|
1176 |
aTarget.PluginInfo().SetConfigurationStateL(tempVariant.AsData());
|
|
1177 |
}
|
|
1178 |
if ( aSource.FindL( _L8("multiinstance"), tempVariant ) )
|
|
1179 |
{
|
|
1180 |
aTarget.PluginInfo().SetMultiInstanceL( tempVariant.AsTInt32() );
|
|
1181 |
}
|
|
1182 |
if ( aSource.FindL( _L8( "max_child" ), tempVariant ) )
|
|
1183 |
{
|
|
1184 |
aTarget.PluginInfo().SetMaxChild( tempVariant.AsTInt32() );
|
|
1185 |
}
|
|
1186 |
if( aSource.FindL( _L8("plugins"), tempVariant ) )
|
|
1187 |
{
|
|
1188 |
const CLiwList* plugins( tempVariant.AsList() );
|
|
1189 |
if( plugins )
|
|
1190 |
{
|
|
1191 |
ProcessConfigurationPluginsL( *plugins,
|
|
1192 |
aTarget,
|
|
1193 |
aAppConf );
|
|
1194 |
}
|
|
1195 |
}
|
|
1196 |
if( aSource.FindL( _L8("settings"), tempVariant ) )
|
|
1197 |
{
|
|
1198 |
const CLiwList* settings( tempVariant.AsList() );
|
|
1199 |
if( settings )
|
|
1200 |
{
|
|
1201 |
ProcessConfigurationSettingsL(*settings,aTarget);
|
|
1202 |
}
|
|
1203 |
}
|
|
1204 |
if( aSource.FindL( _L8("resources"), tempVariant ) )
|
|
1205 |
{
|
|
1206 |
const CLiwList* resources( tempVariant.AsList() );
|
|
1207 |
if( resources )
|
|
1208 |
{
|
|
1209 |
ProcessConfigurationResourcesL(*resources,aTarget);
|
|
1210 |
}
|
|
1211 |
}
|
|
1212 |
CleanupStack::Pop(&tempVariant);
|
|
1213 |
tempVariant.Reset();
|
|
1214 |
}
|
|
1215 |
|
|
1216 |
// ---------------------------------------------------------------------------
|
|
1217 |
// ---------------------------------------------------------------------------
|
|
1218 |
//
|
|
1219 |
void CHspsWrapper::ProcessConfigurationPluginsL(
|
|
1220 |
const CLiwList& aPluginsList,
|
|
1221 |
CHspsConfiguration& aTarget,
|
|
1222 |
const TBool aAppConf )
|
|
1223 |
{
|
|
1224 |
TBool activePluginFound = EFalse;
|
|
1225 |
|
|
1226 |
TLiwVariant pluginMapVariant;
|
|
1227 |
pluginMapVariant.PushL();
|
|
1228 |
for( int i=0;i<aPluginsList.Count();++i )
|
|
1229 |
{
|
|
1230 |
if( aPluginsList.AtL(i,pluginMapVariant) )
|
|
1231 |
{
|
|
1232 |
const CLiwMap* pluginMap( pluginMapVariant.AsMap() );
|
|
1233 |
TLiwVariant pluginVariant;
|
|
1234 |
pluginVariant.PushL();
|
|
1235 |
if( pluginMap )
|
|
1236 |
{
|
|
1237 |
CPluginMap* plugin = CPluginMap::NewLC();
|
|
1238 |
if( pluginMap->FindL( _L8("id"),pluginVariant) )
|
|
1239 |
{
|
|
1240 |
plugin->SetPluginIdL( pluginVariant.AsData() );
|
|
1241 |
}
|
|
1242 |
if( pluginMap->FindL( _L8("uid"),pluginVariant) )
|
|
1243 |
{
|
|
1244 |
plugin->SetPluginUidL( pluginVariant.AsData() );
|
|
1245 |
}
|
|
1246 |
if ( pluginMap->FindL( _L8( "locking_status" ), pluginVariant ) )
|
|
1247 |
{
|
|
1248 |
plugin->SetLockingStatusL( pluginVariant.AsData() );
|
|
1249 |
}
|
|
1250 |
|
|
1251 |
if( aAppConf )
|
|
1252 |
{
|
|
1253 |
if( ActivePluginId().Compare( KPluginIdNotSet ) == 0 &&
|
|
1254 |
pluginMap->FindL( _L8( "activationstate" ), pluginVariant ) )
|
|
1255 |
{
|
|
1256 |
const TPtrC8 data = pluginVariant.AsData();
|
|
1257 |
|
|
1258 |
plugin->SetActivationStateL( data );
|
|
1259 |
|
|
1260 |
if( data.Compare( K1 ) == 0 )
|
|
1261 |
{
|
|
1262 |
SetActivePluginL( plugin->PluginId() );
|
|
1263 |
activePluginFound = ETrue;
|
|
1264 |
}
|
|
1265 |
}
|
|
1266 |
else if( ActivePluginId().Compare( plugin->PluginId() ) == 0 )
|
|
1267 |
{
|
|
1268 |
plugin->SetActivationStateL( K1 );
|
|
1269 |
activePluginFound = ETrue;
|
|
1270 |
}
|
|
1271 |
else
|
|
1272 |
{
|
|
1273 |
plugin->SetActivationStateL( K0 );
|
|
1274 |
}
|
|
1275 |
}
|
|
1276 |
else
|
|
1277 |
{
|
|
1278 |
if ( pluginMap->FindL( _L8( "activationstate" ), pluginVariant ) )
|
|
1279 |
{
|
|
1280 |
plugin->SetActivationStateL( pluginVariant.AsData() );
|
|
1281 |
}
|
|
1282 |
}
|
|
1283 |
|
|
1284 |
aTarget.AddPluginMapL(plugin);
|
|
1285 |
CleanupStack::Pop(plugin);
|
|
1286 |
}
|
|
1287 |
CleanupStack::Pop(&pluginVariant);
|
|
1288 |
pluginVariant.Reset();
|
|
1289 |
}
|
|
1290 |
}
|
|
1291 |
|
|
1292 |
CleanupStack::Pop(&pluginMapVariant);
|
|
1293 |
pluginMapVariant.Reset();
|
|
1294 |
|
|
1295 |
if( aAppConf &&
|
|
1296 |
!activePluginFound &&
|
|
1297 |
aTarget.PluginMaps().Count() > 0 )
|
|
1298 |
{
|
|
1299 |
CPluginMap* plugin = aTarget.PluginMaps()[0];
|
|
1300 |
if( plugin )
|
|
1301 |
{
|
|
1302 |
plugin->SetActivationStateL( K1 );
|
|
1303 |
SetActivePluginL( plugin->PluginId() );
|
|
1304 |
}
|
|
1305 |
}
|
|
1306 |
}
|
|
1307 |
|
|
1308 |
// ---------------------------------------------------------------------------
|
|
1309 |
// ---------------------------------------------------------------------------
|
|
1310 |
//
|
|
1311 |
void CHspsWrapper::ProcessConfigurationSettingsL(
|
|
1312 |
const CLiwList& aItemList,
|
|
1313 |
CHspsConfiguration& aTarget)
|
|
1314 |
{
|
|
1315 |
TLiwVariant itemMapVariant;
|
|
1316 |
itemMapVariant.PushL();
|
|
1317 |
for( int i=0;i<aItemList.Count();++i )
|
|
1318 |
{
|
|
1319 |
if( aItemList.AtL(i,itemMapVariant) )
|
|
1320 |
{
|
|
1321 |
const CLiwMap* itemMap( itemMapVariant.AsMap() );
|
|
1322 |
TLiwVariant itemVariant;
|
|
1323 |
itemVariant.PushL();
|
|
1324 |
if( itemMap )
|
|
1325 |
{
|
|
1326 |
CItemMap* item = CItemMap::NewLC();
|
|
1327 |
if( itemMap->FindL( _L8("itemId"),itemVariant) )
|
|
1328 |
{
|
|
1329 |
item->SetItemIdL( itemVariant.AsData() );
|
|
1330 |
}
|
|
1331 |
if( itemMap->FindL( _L8("name"),itemVariant) )
|
|
1332 |
{
|
|
1333 |
item->SetItemNameL( itemVariant.AsData() );
|
|
1334 |
}
|
|
1335 |
if( itemMap->FindL( _L8("properties"),itemVariant) )
|
|
1336 |
{
|
|
1337 |
const CLiwList* properties( itemVariant.AsList() );
|
|
1338 |
if(properties)
|
|
1339 |
{
|
|
1340 |
ProcessConfItemPropertiesL(*properties,*item);
|
|
1341 |
}
|
|
1342 |
}
|
|
1343 |
|
|
1344 |
aTarget.AddItemMapL(item);
|
|
1345 |
CleanupStack::Pop(item);
|
|
1346 |
}
|
|
1347 |
CleanupStack::Pop(&itemVariant);
|
|
1348 |
itemVariant.Reset();
|
|
1349 |
}
|
|
1350 |
|
|
1351 |
}
|
|
1352 |
CleanupStack::Pop(&itemMapVariant);
|
|
1353 |
itemMapVariant.Reset();
|
|
1354 |
}
|
|
1355 |
|
|
1356 |
// ---------------------------------------------------------------------------
|
|
1357 |
// ---------------------------------------------------------------------------
|
|
1358 |
//
|
|
1359 |
void CHspsWrapper::ProcessConfigurationResourcesL(
|
|
1360 |
const CLiwList& aObjectList,
|
|
1361 |
CHspsConfiguration& aTarget)
|
|
1362 |
{
|
|
1363 |
TLiwVariant objectMapVariant;
|
|
1364 |
objectMapVariant.PushL();
|
|
1365 |
for( int i=0;i<aObjectList.Count();++i )
|
|
1366 |
{
|
|
1367 |
if( aObjectList.AtL(i,objectMapVariant) )
|
|
1368 |
{
|
|
1369 |
const CLiwMap* objectMap( objectMapVariant.AsMap() );
|
|
1370 |
TLiwVariant objectVariant;
|
|
1371 |
objectVariant.PushL();
|
|
1372 |
if( objectMap )
|
|
1373 |
{
|
|
1374 |
CObjectMap* object = CObjectMap::NewLC();
|
|
1375 |
if( objectMap->FindL( _L8("name"),objectVariant) )
|
|
1376 |
{
|
|
1377 |
object->SetNameL( objectVariant.AsData() );
|
|
1378 |
}
|
|
1379 |
if( objectMap->FindL( _L8("path"),objectVariant) )
|
|
1380 |
{
|
|
1381 |
object->SetPathL( objectVariant.AsData() );
|
|
1382 |
}
|
|
1383 |
if( objectMap->FindL( _L8("mediatype"),objectVariant) )
|
|
1384 |
{
|
|
1385 |
object->SetMediaTypeL( objectVariant.AsData() );
|
|
1386 |
}
|
|
1387 |
if( objectMap->FindL( _L8("tag"),objectVariant) )
|
|
1388 |
{
|
|
1389 |
object->SetTagL( objectVariant.AsData() );
|
|
1390 |
}
|
|
1391 |
aTarget.AddObjectMapL(object);
|
|
1392 |
CleanupStack::Pop(object);
|
|
1393 |
}
|
|
1394 |
CleanupStack::Pop(&objectVariant);
|
|
1395 |
objectVariant.Reset();
|
|
1396 |
}
|
|
1397 |
}
|
|
1398 |
CleanupStack::Pop(&objectMapVariant);
|
|
1399 |
objectMapVariant.Reset();
|
|
1400 |
}
|
|
1401 |
|
|
1402 |
// ---------------------------------------------------------------------------
|
|
1403 |
// ---------------------------------------------------------------------------
|
|
1404 |
//
|
|
1405 |
void CHspsWrapper::ProcessConfItemPropertiesL(
|
|
1406 |
const CLiwList& aPropertyMapList,
|
|
1407 |
CItemMap& aItemMap)
|
|
1408 |
{
|
|
1409 |
TLiwVariant propertyMapVariant;
|
|
1410 |
propertyMapVariant.PushL();
|
|
1411 |
for( int i=0;i<aPropertyMapList.Count();++i )
|
|
1412 |
{
|
|
1413 |
if( aPropertyMapList.AtL(i,propertyMapVariant) )
|
|
1414 |
{
|
|
1415 |
const CLiwMap* propertyMap( propertyMapVariant.AsMap() );
|
|
1416 |
TLiwVariant propertyVariant;
|
|
1417 |
propertyVariant.PushL();
|
|
1418 |
if( propertyMap )
|
|
1419 |
{
|
|
1420 |
CPropertyMap* property = CPropertyMap::NewLC();
|
|
1421 |
if( propertyMap->FindL( _L8("name"),propertyVariant ) )
|
|
1422 |
{
|
|
1423 |
property->SetNameL( propertyVariant.AsData() );
|
|
1424 |
}
|
|
1425 |
if( propertyMap->FindL( _L8("value"),propertyVariant ) )
|
|
1426 |
{
|
|
1427 |
property->SetValueL( propertyVariant.AsData() );
|
|
1428 |
}
|
|
1429 |
aItemMap.AddPropertyMapL(property);
|
|
1430 |
CleanupStack::Pop(property);
|
|
1431 |
}
|
|
1432 |
CleanupStack::Pop(&propertyVariant);
|
|
1433 |
propertyVariant.Reset();
|
|
1434 |
}
|
|
1435 |
|
|
1436 |
}
|
|
1437 |
CleanupStack::Pop(&propertyMapVariant);
|
|
1438 |
propertyMapVariant.Reset();
|
|
1439 |
}
|
|
1440 |
|
|
1441 |
// ---------------------------------------------------------------------------
|
|
1442 |
// ---------------------------------------------------------------------------
|
|
1443 |
//
|
|
1444 |
void CHspsWrapper::ProcessPluginsL(
|
|
1445 |
const CLiwList& aPluginInfoMapList,
|
|
1446 |
RPointerArray<CPluginInfo>& aPlugins)
|
|
1447 |
{
|
|
1448 |
// create widget array and populate it from HSPS list
|
|
1449 |
TLiwVariant mapVar;
|
|
1450 |
mapVar.PushL();
|
|
1451 |
|
|
1452 |
for ( int index(0); aPluginInfoMapList.AtL( index, mapVar ); ++index )
|
|
1453 |
{
|
|
1454 |
const CLiwMap* pluginInfoMap = mapVar.AsMap();
|
|
1455 |
if ( pluginInfoMap )
|
|
1456 |
{
|
|
1457 |
TLiwVariant pluginVar;
|
|
1458 |
pluginVar.PushL();
|
|
1459 |
CPluginInfo* pluginInfo = CPluginInfo::NewLC();
|
|
1460 |
|
|
1461 |
if( pluginInfoMap->FindL( _L8("uid"), pluginVar) )
|
|
1462 |
{
|
|
1463 |
pluginInfo->SetUidL( pluginVar.AsData() );
|
|
1464 |
}
|
|
1465 |
if( pluginInfoMap->FindL( _L8("interface"), pluginVar ) )
|
|
1466 |
{
|
|
1467 |
pluginInfo->SetInterfaceL( pluginVar.AsData() );
|
|
1468 |
}
|
|
1469 |
if( pluginInfoMap->FindL( _L8("type"), pluginVar ) )
|
|
1470 |
{
|
|
1471 |
pluginInfo->SetTypeL( pluginVar.AsData() );
|
|
1472 |
}
|
|
1473 |
if( pluginInfoMap->FindL( _L8("name"), pluginVar ) )
|
|
1474 |
{
|
|
1475 |
pluginInfo->SetNameL( pluginVar.AsData() );
|
|
1476 |
}
|
|
1477 |
if ( pluginInfoMap->FindL( _L8("multiinstance"), pluginVar ) )
|
|
1478 |
{
|
|
1479 |
pluginInfo->SetMultiInstanceL( pluginVar.AsTInt32() );
|
|
1480 |
}
|
|
1481 |
if ( pluginInfoMap->FindL( _L8( "max_child" ), pluginVar ) )
|
|
1482 |
{
|
|
1483 |
pluginInfo->SetMaxChild( pluginVar.AsTInt32() );
|
|
1484 |
}
|
|
1485 |
if ( pluginInfoMap->FindL( _L8("desc"), pluginVar ) )
|
|
1486 |
{
|
|
1487 |
pluginInfo->SetDescriptionL( pluginVar.AsData() );
|
|
1488 |
}
|
|
1489 |
if ( pluginInfoMap->FindL( _L8("logo"), pluginVar ) )
|
|
1490 |
{
|
|
1491 |
pluginInfo->SetLogoIconL( pluginVar.AsData() );
|
|
1492 |
}
|
|
1493 |
|
|
1494 |
aPlugins.AppendL(pluginInfo);
|
|
1495 |
CleanupStack::Pop(pluginInfo);
|
|
1496 |
CleanupStack::Pop(&pluginVar);
|
|
1497 |
pluginVar.Reset();
|
|
1498 |
}
|
|
1499 |
}
|
|
1500 |
CleanupStack::Pop(&mapVar);
|
|
1501 |
mapVar.Reset();
|
|
1502 |
}
|
|
1503 |
|
|
1504 |
// ---------------------------------------------------------------------------
|
|
1505 |
// ---------------------------------------------------------------------------
|
|
1506 |
//
|
|
1507 |
void CHspsWrapper::FillMapFromItemL( CLiwDefaultMap& aMap, const CItemMap& aItemMap )
|
|
1508 |
{
|
|
1509 |
aMap.InsertL( KKeyItemId, TLiwVariant(aItemMap.ItemId()) );
|
|
1510 |
aMap.InsertL( KKeyName, TLiwVariant(aItemMap.ItemName()) );
|
|
1511 |
|
|
1512 |
CLiwDefaultList* inPropertyMapList = CLiwDefaultList::NewLC();
|
|
1513 |
FillMapFromPropertiesL(*inPropertyMapList,aItemMap.Properties());
|
|
1514 |
aMap.InsertL( KKeyProperties, TLiwVariant(inPropertyMapList) );
|
|
1515 |
CleanupStack::PopAndDestroy(inPropertyMapList);
|
|
1516 |
}
|
|
1517 |
|
|
1518 |
// ---------------------------------------------------------------------------
|
|
1519 |
// ---------------------------------------------------------------------------
|
|
1520 |
//
|
|
1521 |
void CHspsWrapper::FillMapFromPropertiesL(
|
|
1522 |
CLiwDefaultList& aInPropertyMapList,
|
|
1523 |
const RPointerArray<CPropertyMap>& aProperties )
|
|
1524 |
{
|
|
1525 |
|
|
1526 |
for(int i=0; i<aProperties.Count(); ++i)
|
|
1527 |
{
|
|
1528 |
CLiwDefaultMap* inPropertyMap = CLiwDefaultMap::NewLC();
|
|
1529 |
inPropertyMap->InsertL( KKeyName, TLiwVariant(aProperties[i]->Name()) );
|
|
1530 |
inPropertyMap->InsertL( KKeyValue, TLiwVariant(aProperties[i]->Value()) );
|
|
1531 |
aInPropertyMapList.AppendL(inPropertyMap);
|
|
1532 |
CleanupStack::PopAndDestroy(inPropertyMap);
|
|
1533 |
}
|
|
1534 |
}
|
|
1535 |
|
|
1536 |
// ---------------------------------------------------------------------------
|
|
1537 |
// ---------------------------------------------------------------------------
|
|
1538 |
//
|
|
1539 |
TInt CHspsWrapper::HandleNotifyL( TInt aCmdId, TInt aEventId,
|
|
1540 |
CLiwGenericParamList& aEventParamList,
|
|
1541 |
const CLiwGenericParamList& /*aInParamList*/ )
|
|
1542 |
{
|
|
1543 |
TInt retval( KErrNone );
|
|
1544 |
|
|
1545 |
if( iObserver && iTransactionId == aCmdId )
|
|
1546 |
{
|
|
1547 |
const TLiwGenericParam* outParam( NULL );
|
|
1548 |
|
|
1549 |
TInt pos( 0 );
|
|
1550 |
outParam = aEventParamList.FindFirst( pos, _L8("status") );
|
|
1551 |
|
|
1552 |
if ( outParam )
|
|
1553 |
{
|
|
1554 |
retval = outParam->Value().AsTInt32();
|
|
1555 |
}
|
|
1556 |
else
|
|
1557 |
{
|
|
1558 |
pos = 0;
|
|
1559 |
|
|
1560 |
retval = KErrNotFound;
|
|
1561 |
|
|
1562 |
outParam = aEventParamList.FindFirst( pos, _L8("notification") );
|
|
1563 |
|
|
1564 |
if( !outParam )
|
|
1565 |
{
|
|
1566 |
// should never happen, but change status back to KErrNotFound
|
|
1567 |
return retval;
|
|
1568 |
}
|
|
1569 |
|
|
1570 |
HBufC8* event( NULL );
|
|
1571 |
HBufC8* appConfUid( NULL );
|
|
1572 |
HBufC8* pluginUid( NULL );
|
|
1573 |
HBufC8* pluginName( NULL );
|
|
1574 |
HBufC8* origUid( NULL );
|
|
1575 |
TInt pushCount( 0 );
|
|
1576 |
|
|
1577 |
TLiwVariant variant;
|
|
1578 |
variant.PushL();
|
|
1579 |
pushCount++;
|
|
1580 |
|
|
1581 |
variant = outParam->Value();
|
|
1582 |
|
|
1583 |
const CLiwMap* notifMap( variant.AsMap() );
|
|
1584 |
|
|
1585 |
if ( notifMap->FindL( _L8("event"), variant ) )
|
|
1586 |
{
|
|
1587 |
event = variant.AsData().AllocLC();
|
|
1588 |
pushCount++;
|
|
1589 |
}
|
|
1590 |
|
|
1591 |
variant.Reset();
|
|
1592 |
|
|
1593 |
if( notifMap->FindL( _L8("appConfUid"), variant ) )
|
|
1594 |
{
|
|
1595 |
appConfUid = variant.AsData().AllocLC();
|
|
1596 |
pushCount++;
|
|
1597 |
}
|
|
1598 |
|
|
1599 |
variant.Reset();
|
|
1600 |
|
|
1601 |
if( notifMap->FindL( _L8("name"), variant ) )
|
|
1602 |
{
|
|
1603 |
pluginName = variant.AsData().AllocLC();
|
|
1604 |
pushCount++;
|
|
1605 |
}
|
|
1606 |
|
|
1607 |
variant.Reset();
|
|
1608 |
|
|
1609 |
if( notifMap->FindL( _L8("origUid"), variant ) )
|
|
1610 |
{
|
|
1611 |
origUid = variant.AsData().AllocLC();
|
|
1612 |
pushCount++;
|
|
1613 |
}
|
|
1614 |
|
|
1615 |
variant.Reset();
|
|
1616 |
|
|
1617 |
if( notifMap->FindL( _L8("pluginUid"), variant ) )
|
|
1618 |
{
|
|
1619 |
pluginUid = variant.AsData().AllocLC();
|
|
1620 |
pushCount++;
|
|
1621 |
}
|
|
1622 |
|
|
1623 |
variant.Reset();
|
|
1624 |
|
|
1625 |
if( notifMap->FindL( _L8("pluginIds"), variant ) )
|
|
1626 |
{
|
|
1627 |
const CLiwList* pluginIdList( variant.AsList() );
|
|
1628 |
|
|
1629 |
variant.Reset();
|
|
1630 |
|
|
1631 |
TInt count( pluginIdList->Count() );
|
|
1632 |
|
|
1633 |
retval = KErrNone;
|
|
1634 |
|
|
1635 |
for( TInt i = 0; i < count && retval == KErrNone; i++ )
|
|
1636 |
{
|
|
1637 |
pluginIdList->AtL( i, variant );
|
|
1638 |
|
|
1639 |
HBufC8* pluginId( NULL );
|
|
1640 |
|
|
1641 |
pluginId = variant.AsData().AllocLC();
|
|
1642 |
|
|
1643 |
retval = iObserver->HandleNotifyL(
|
|
1644 |
( event ) ? *event : KNullDesC8(),
|
|
1645 |
( appConfUid ) ? *appConfUid : KNullDesC8(),
|
|
1646 |
( pluginName ) ? *pluginName : KNullDesC8(),
|
|
1647 |
( origUid ) ? *origUid : KNullDesC8(),
|
|
1648 |
( pluginUid ) ? *pluginUid : KNullDesC8(),
|
|
1649 |
( pluginId ) ? * pluginId : KNullDesC8() );
|
|
1650 |
|
|
1651 |
CleanupStack::PopAndDestroy( pluginId );
|
|
1652 |
|
|
1653 |
variant.Reset();
|
|
1654 |
}
|
|
1655 |
}
|
|
1656 |
|
|
1657 |
CleanupStack::PopAndDestroy( pushCount );
|
|
1658 |
}
|
|
1659 |
}
|
|
1660 |
|
|
1661 |
if( retval != KErrNone && aEventId != KLiwEventInProgress)
|
|
1662 |
{
|
|
1663 |
CLiwGenericParamList& inParamList = iServiceHandler->InParamListL();
|
|
1664 |
CLiwGenericParamList& outParamList = iServiceHandler->OutParamListL();
|
|
1665 |
|
|
1666 |
inParamList.Reset();
|
|
1667 |
outParamList.Reset();
|
|
1668 |
//cancel old notification request
|
|
1669 |
iHspsInterface->ExecuteCmdL( KRequestNotification,
|
|
1670 |
inParamList,
|
|
1671 |
outParamList,
|
|
1672 |
KLiwOptCancel,
|
|
1673 |
this );
|
|
1674 |
|
|
1675 |
inParamList.Reset();
|
|
1676 |
outParamList.Reset();
|
|
1677 |
//request notification again
|
|
1678 |
iTransactionId = -1;
|
|
1679 |
iHspsInterface->ExecuteCmdL( KRequestNotification,
|
|
1680 |
inParamList,
|
|
1681 |
outParamList,
|
|
1682 |
KLiwOptASyncronous,
|
|
1683 |
this );
|
|
1684 |
|
|
1685 |
const TLiwGenericParam* outParam( NULL );
|
|
1686 |
|
|
1687 |
TInt pos( 0 );
|
|
1688 |
outParam = outParamList.FindFirst( pos, _L8("status") );
|
|
1689 |
|
|
1690 |
if ( outParam )
|
|
1691 |
{
|
|
1692 |
TInt retval;
|
|
1693 |
retval = outParam->Value().AsTInt32();
|
|
1694 |
|
|
1695 |
if(retval == KErrNone )
|
|
1696 |
{
|
|
1697 |
pos = 0;
|
|
1698 |
outParam = outParamList.FindFirst( pos, _L8("TransactionID") );
|
|
1699 |
|
|
1700 |
if( outParam )
|
|
1701 |
{
|
|
1702 |
retval = outParam->Value().AsTInt32();
|
|
1703 |
iTransactionId = retval;
|
|
1704 |
}
|
|
1705 |
}
|
|
1706 |
}
|
|
1707 |
|
|
1708 |
}
|
|
1709 |
|
|
1710 |
|
|
1711 |
return retval;
|
|
1712 |
}
|
|
1713 |
|
|
1714 |
// ---------------------------------------------------------------------------
|
|
1715 |
// ---------------------------------------------------------------------------
|
|
1716 |
//
|
|
1717 |
TInt CHspsWrapper::LoadActivePluginIdL()
|
|
1718 |
{
|
|
1719 |
delete iActivePluginId;
|
|
1720 |
iActivePluginId = NULL;
|
|
1721 |
|
|
1722 |
iActivePluginId = HBufC8::NewL( KMaxPluginIdLen );
|
|
1723 |
TPtr8 activePluginId = iActivePluginId->Des();
|
|
1724 |
|
|
1725 |
const TInt error = iRepository->Get( KAIActiveViewPluginId, activePluginId );
|
|
1726 |
|
|
1727 |
if( error != KErrNone )
|
|
1728 |
{
|
|
1729 |
delete iActivePluginId;
|
|
1730 |
iActivePluginId = NULL;
|
|
1731 |
iActivePluginId = KPluginIdNotSet().AllocL();
|
|
1732 |
}
|
|
1733 |
|
|
1734 |
return error;
|
|
1735 |
}
|
|
1736 |
|
|
1737 |
// ---------------------------------------------------------------------------
|
|
1738 |
// ---------------------------------------------------------------------------
|
|
1739 |
//
|
|
1740 |
const TDesC8& CHspsWrapper::ActivePluginId() const
|
|
1741 |
{
|
|
1742 |
if( iActivePluginId )
|
|
1743 |
{
|
|
1744 |
return *iActivePluginId;
|
|
1745 |
}
|
|
1746 |
else
|
|
1747 |
{
|
|
1748 |
return KPluginIdNotSet;
|
|
1749 |
}
|
|
1750 |
}
|
|
1751 |
|
|
1752 |
}
|
|
1753 |
|
|
1754 |
//End of file
|