|
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: Content Publisher Server Session |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <s32mem.h> |
|
21 // for CleanupResetAndDestroyPushL |
|
22 #include <mmf/common/mmfcontrollerpluginresolver.h> |
|
23 #include <liwgenericparam.h> |
|
24 |
|
25 #include "cpserversession.h" |
|
26 #include "cpliwmap.h" |
|
27 #include "cpublisherregistrymap.h" |
|
28 #include "cpsecuritypolicy.h" |
|
29 #include "cpserverdef.h" |
|
30 #include "cpdebug.h" |
|
31 #include "cpserver.h" |
|
32 #include "cpserverdatamanager.h" |
|
33 #include "cpactionhandlerthread.h" |
|
34 #include "cpnotificationhandler.h" |
|
35 |
|
36 using namespace LIW; |
|
37 |
|
38 // ================= MEMBER FUNCTIONS ======================= |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CCPServerSession::NewL |
|
42 // Two-phased constructor. |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 CCPServerSession* CCPServerSession::NewL(TPointersForSession& aPasser) |
|
46 { |
|
47 CCPServerSession* self = CCPServerSession::NewLC(aPasser); |
|
48 CleanupStack::Pop( self ) ; |
|
49 return self; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CCPServerSession::NewLC |
|
54 // Two-phased constructor. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CCPServerSession* CCPServerSession::NewLC(TPointersForSession& aPasser) |
|
58 { |
|
59 CCPServerSession* self = new (ELeave) CCPServerSession(); |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL( aPasser ) ; |
|
62 return self; |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CCPServerSession::~CCPServerSession |
|
67 // Destructor. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 CCPServerSession::~CCPServerSession() |
|
71 { |
|
72 //remove notification handler from an array of sessions in data manager |
|
73 if ( iNotificationHandler && iDataManager ) |
|
74 { |
|
75 iDataManager->RemoveObserver( iNotificationHandler ); |
|
76 } |
|
77 if ( isRegister && iNotificationHandler ) |
|
78 { |
|
79 iNotificationHandler->ErrorComplete( KErrCancel ); |
|
80 } |
|
81 if ( iServer ) |
|
82 { |
|
83 iServer->RemoveSession( ); |
|
84 } |
|
85 delete iNotificationHandler; |
|
86 delete iParamList; |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CCPServerSession::CCPServerSession |
|
91 // C++ default constructor can NOT contain any code, that |
|
92 // might leave. |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 CCPServerSession::CCPServerSession() : |
|
96 CSession2() |
|
97 { |
|
98 |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CCPServerSession::ConstructL |
|
103 // Symbian 2nd phase constructor can leave. |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void CCPServerSession::ConstructL( TPointersForSession& aPasser ) |
|
107 { |
|
108 CP_DEBUG( _L8("CCPServerSession::ConstructL()") ); |
|
109 iDataManager = aPasser.iDataManager; |
|
110 iServer = aPasser.iServer; |
|
111 iActionHandlerThread = aPasser.iActionHandlerThread; |
|
112 iServer->AddSession( ); |
|
113 isRegister = EFalse; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CCPServerSession::ServiceL |
|
118 // Handle client requests. |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void CCPServerSession::ServiceL( const RMessage2& aMessage ) |
|
122 { |
|
123 CP_DEBUG( _L8("CCPServerSession::ServiceL()" ) ); |
|
124 TBool serverLocked = GetServerLock( aMessage ); |
|
125 if ( serverLocked ) |
|
126 { |
|
127 aMessage.Complete( KErrLocked ); |
|
128 } |
|
129 else |
|
130 { |
|
131 TInt err(KErrNone); |
|
132 TBool completeRequest( ETrue ); |
|
133 //complete request by default |
|
134 //not applicable when client panicked or |
|
135 //in case of ECpServerExecuteMultipleActions |
|
136 TRAP( err , DispatchMessageL( aMessage, completeRequest ) ); |
|
137 if ( (!(aMessage.Function( ) == ECpServerRegisterObserver ) |
|
138 || err == KErrInUse) && completeRequest ) |
|
139 { |
|
140 if( !aMessage.IsNull() ) |
|
141 { |
|
142 aMessage.Complete( err ); |
|
143 } |
|
144 } |
|
145 } |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CCPServerSession::ServiceL |
|
150 // Handle client requests. |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 void CCPServerSession::DispatchMessageL( const RMessage2& aMessage, |
|
154 TBool& aCompleteRequest ) |
|
155 { |
|
156 CP_DEBUG( _L8("CCPServerSession::DispatchMessageL()" ) ); |
|
157 switch ( aMessage.Function( ) ) |
|
158 { |
|
159 case ECpServerAddData: |
|
160 AddDataL( aMessage ); |
|
161 break; |
|
162 case ECpServerAddDataNonPersistent: |
|
163 AddDataNonPersistentL( aMessage ); |
|
164 break; |
|
165 case ECpServerGetListSize: |
|
166 GetListSizeL( aMessage ); |
|
167 break; |
|
168 case ECpServerGetListData: |
|
169 GetListDataL( aMessage ); |
|
170 break; |
|
171 case ECpServerRemoveData: |
|
172 RemoveDataL( aMessage ); |
|
173 break; |
|
174 case ECpServerRegisterObserver: |
|
175 RegisterObserverL( aMessage ); |
|
176 break; |
|
177 case ECpServerAddObserver: |
|
178 AddObserverL( aMessage ); |
|
179 break; |
|
180 case ECpServerRemoveObserver: |
|
181 RemoveObserverL( aMessage ); |
|
182 break; |
|
183 case ECpServerUnRegisterObserver: |
|
184 UnregisterObserverL( ); |
|
185 break; |
|
186 case ECpServerGetChangeInfoData: |
|
187 GetChangeInfoDataL( aMessage ); |
|
188 break; |
|
189 case ECpServerExecuteAction: |
|
190 ExecuteActionL( aMessage ); |
|
191 break; |
|
192 case ECpServerExecuteMultipleActions: |
|
193 ExecuteMultipleActionsL( aMessage ); |
|
194 aCompleteRequest = EFalse; |
|
195 break; |
|
196 default: |
|
197 iServer->PanicClient( aMessage, ECPServerBadRequest ); |
|
198 aCompleteRequest = EFalse; |
|
199 break; |
|
200 } |
|
201 } |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CCPServerSession::AddDataL |
|
205 // --------------- -------------------------------------------------------------- |
|
206 // |
|
207 void CCPServerSession::AddDataL( const RMessage2& aMessage ) |
|
208 { |
|
209 CP_DEBUG( _L8("CCPServerSession::AddDataL()" ) ); |
|
210 CCPLiwMap* map = UnpackFromClientLC( aMessage ); |
|
211 map->SetSecurityL( aMessage ); |
|
212 TBool activateSupport = map->ActivateActionSupport( ); |
|
213 TUint id( 0 ); |
|
214 id = iDataManager->AddDataL( *map ); |
|
215 TPckg<TUint> idData(id); |
|
216 aMessage.WriteL( KReturnPosition, idData ); |
|
217 if(activateSupport) |
|
218 { |
|
219 CLiwDefaultList* list = CLiwDefaultList::NewLC( ); |
|
220 // execute activation or deactivation action for publisher |
|
221 TRAP_IGNORE( GetAndExecuteActionL( map, list ) ); |
|
222 TRAP_IGNORE( SendNotificationL( map, list ) ); |
|
223 CleanupStack::PopAndDestroy( list ); |
|
224 } |
|
225 CleanupStack::PopAndDestroy( map ); |
|
226 } |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // CCPServerSession::AddDataNonPersistentL |
|
230 // --------------- -------------------------------------------------------------- |
|
231 // |
|
232 void CCPServerSession::AddDataNonPersistentL( const RMessage2& aMessage ) |
|
233 { |
|
234 CP_DEBUG( _L8("CCPServerSession::AddDataL()" ) ); |
|
235 CCPLiwMap* map = UnpackFromClientLC( aMessage ); |
|
236 map->SetSecurityL( aMessage ); |
|
237 TUint id( 0 ); |
|
238 TPckg<TUint> idData(id); |
|
239 iDataManager->AddNonPersistentDataL( map ); |
|
240 aMessage.WriteL( KReturnPosition, idData ); |
|
241 CleanupStack::PopAndDestroy( map ); |
|
242 } |
|
243 // ----------------------------------------------------------------------------- |
|
244 // CCPServerSession::GetListL |
|
245 // --------------- -------------------------------------------------------------- |
|
246 // |
|
247 void CCPServerSession::GetListSizeL( const RMessage2& aMessage ) |
|
248 { |
|
249 CP_DEBUG( _L8("CCPServerSession::GetListSizeL()" ) ); |
|
250 CCPLiwMap* map = UnpackFromClientLC( aMessage ); |
|
251 map->SetSecurityL( aMessage ); |
|
252 delete iParamList; |
|
253 iParamList = NULL; |
|
254 iParamList = CLiwGenericParamList::NewL( ); |
|
255 iDataManager->GetListL( *map, *iParamList ); |
|
256 TPckg<TInt> sizeDes(iParamList->Size( ) ); |
|
257 aMessage.WriteL( KReturnPosition, sizeDes ); |
|
258 CleanupStack::PopAndDestroy( map ); |
|
259 } |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // CCPServerSession::GetListDataL |
|
263 // --------------- -------------------------------------------------------------- |
|
264 // |
|
265 void CCPServerSession::GetListDataL( const RMessage2& aMessage ) |
|
266 { |
|
267 CP_DEBUG( _L8("CCPServerSession::GetListDataL()" ) ); |
|
268 if( iParamList ) |
|
269 { |
|
270 ExternalizeAndWriteToClientL( aMessage, iParamList ); |
|
271 delete iParamList; |
|
272 } |
|
273 iParamList = NULL; |
|
274 } |
|
275 |
|
276 // ----------------------------------------------------------------------------- |
|
277 // CCPServerSession::RemoveDataL |
|
278 // --------------- -------------------------------------------------------------- |
|
279 // |
|
280 void CCPServerSession::RemoveDataL( const RMessage2& aMessage ) |
|
281 { |
|
282 CP_DEBUG( _L8("CCPServerSession::RemoveDataL()" ) ); |
|
283 CCPLiwMap* map = UnpackFromClientLC( aMessage ); |
|
284 map->SetSecurityL( aMessage ); |
|
285 iDataManager->RemoveDataL( *map ); |
|
286 CleanupStack::PopAndDestroy( map ); |
|
287 } |
|
288 |
|
289 // ----------------------------------------------------------------------------- |
|
290 // CCPServerSession::ExecuteActionL |
|
291 // --------------- -------------------------------------------------------------- |
|
292 // |
|
293 void CCPServerSession::ExecuteActionL( const RMessage2& aMessage ) |
|
294 { |
|
295 CP_DEBUG( _L8("CCPServerSession::ExecuteActionSizeL()" ) ); |
|
296 TUint options = static_cast<TUint>( aMessage.Int2() ); // 2 == KOptionsPosition |
|
297 CCPLiwMap* map = UnpackFromClientLC( aMessage ); |
|
298 ExecuteActionL( map, EFalse, options ); |
|
299 CleanupStack::PopAndDestroy( map ); |
|
300 } |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 // --------------- -------------------------------------------------------------- |
|
305 // |
|
306 void CCPServerSession::ExecuteActionL(const CCPLiwMap* aMap, |
|
307 TBool aEnableCache, TUint aOptions) |
|
308 { |
|
309 CP_DEBUG( _L8("CCPServerSession::ExecuteActionSizeL()" ) ); |
|
310 TInt error(KErrNone); |
|
311 CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); |
|
312 CLiwDefaultList* list = CLiwDefaultList::NewLC(); |
|
313 error = iDataManager->GetActionsL(*aMap, aEnableCache, *paramList, list ); |
|
314 //we notify apart from action execution result. So in fact |
|
315 //notification means there was an attempt to execute action |
|
316 if (!(aOptions & KDisableNotification)) |
|
317 { |
|
318 iDataManager->HandleChangeL(list); |
|
319 } |
|
320 User::LeaveIfError(error); |
|
321 ExecuteL(*paramList); |
|
322 CleanupStack::PopAndDestroy(list); |
|
323 CleanupStack::PopAndDestroy(paramList); |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CCPServerSession::ExecuteMultipleActionsL |
|
328 // --------------- -------------------------------------------------------------- |
|
329 // |
|
330 void CCPServerSession::ExecuteMultipleActionsL(const RMessage2& aMessage) |
|
331 { |
|
332 CP_DEBUG( _L8("CCPServerSession::ExecuteMultipleActionsL()" ) ); |
|
333 |
|
334 CLiwGenericParamList* genericList = UnpackForMultiExecuteLC(aMessage); |
|
335 TUint options = static_cast<TUint> (aMessage.Int2()); // 2 == KOptionsPosition |
|
336 //complete message in order to unblock HS |
|
337 aMessage.Complete( KErrNone ); |
|
338 |
|
339 const TLiwGenericParam* param = NULL; |
|
340 TInt pos(0); |
|
341 param = genericList->FindFirst(pos, KFilters); |
|
342 if( param && pos!= KErrNotFound ) |
|
343 { |
|
344 const CLiwList* maps = param->Value().AsList(); |
|
345 CLiwDefaultList* cpMaps = CheckValidityLC(maps); |
|
346 //execute actions |
|
347 for (TInt i = 0; i < cpMaps->Count(); i++) |
|
348 { |
|
349 TLiwVariant mapVariant; |
|
350 mapVariant.PushL(); |
|
351 cpMaps->AtL(i, mapVariant); |
|
352 const CCPLiwMap* map = |
|
353 static_cast<const CCPLiwMap*> (mapVariant.AsMap()); |
|
354 TRAP_IGNORE(ExecuteActionL(map, ETrue, options)); |
|
355 CleanupStack::PopAndDestroy(&mapVariant); |
|
356 } |
|
357 CleanupStack::PopAndDestroy(cpMaps); |
|
358 } |
|
359 CleanupStack::PopAndDestroy(genericList); |
|
360 } |
|
361 |
|
362 // ----------------------------------------------------------------------------- |
|
363 // CCPServerSession::ExecuteL |
|
364 // --------------- -------------------------------------------------------------- |
|
365 // |
|
366 void CCPServerSession::ExecuteL( |
|
367 const CLiwGenericParamList& aActionParams ) |
|
368 { |
|
369 for ( TInt i = 0; i < aActionParams.Count(); i++ ) |
|
370 { |
|
371 TLiwGenericParam param; |
|
372 param.PushL(); |
|
373 aActionParams.AtL( i, param ); |
|
374 CLiwGenericParamList* singleAction = CLiwGenericParamList::NewLC(); |
|
375 singleAction->AppendL( param ); |
|
376 TRAP_IGNORE( iActionHandlerThread->ExecuteL( *singleAction ) ); |
|
377 CleanupStack::PopAndDestroy( singleAction ); |
|
378 CleanupStack::PopAndDestroy( ¶m ); |
|
379 } |
|
380 } |
|
381 |
|
382 // ----------------------------------------------------------------------------- |
|
383 // CCPServerSession::RegisterObserverL |
|
384 // --------------- -------------------------------------------------------------- |
|
385 // |
|
386 void CCPServerSession::RegisterObserverL( const RMessage2& aMessage ) |
|
387 { |
|
388 CP_DEBUG( _L8("CCPServerSession::RegisterObserverL()" ) ); |
|
389 if ( !isRegister ) |
|
390 { |
|
391 if (aMessage.Int3() != KErrAlreadyExists && |
|
392 aMessage.GetDesLength( KDescriptorPosition) < KErrNone ) |
|
393 { |
|
394 iServer->PanicClient( aMessage, ECPServerBadRequest ); |
|
395 User::Leave( KErrGeneral ); |
|
396 } |
|
397 isRegister = ETrue; |
|
398 if ( !iNotificationHandler ) |
|
399 { |
|
400 iNotificationHandler = CCPNotificationHandler::NewL( |
|
401 iServer->GetNotifications(), iServer->GetDataMapCache()); |
|
402 iDataManager->AddObserverL( iNotificationHandler ); |
|
403 } |
|
404 iNotificationHandler->SaveMessageL( aMessage ); |
|
405 } |
|
406 else |
|
407 { |
|
408 User::Leave( KErrInUse ); |
|
409 } |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // CCPServerSession::AddObserverL |
|
414 // --------------- -------------------------------------------------------------- |
|
415 // |
|
416 void CCPServerSession::AddObserverL( const RMessage2& aMessage ) |
|
417 { |
|
418 CP_DEBUG( _L8("CCPServerSession::AddObserverL()" ) ); |
|
419 if( iNotificationHandler ) |
|
420 { |
|
421 iNotificationHandler->AddObserverL( aMessage ); |
|
422 } |
|
423 } |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // CCPServerSession::RemoveObserverL |
|
427 // --------------- -------------------------------------------------------------- |
|
428 // |
|
429 void CCPServerSession::RemoveObserverL( const RMessage2& aMessage ) |
|
430 { |
|
431 CP_DEBUG( _L8("CCPServerSession::RemoveObserverL()" ) ); |
|
432 if( iNotificationHandler ) |
|
433 { |
|
434 iNotificationHandler->RemoveObserverL( aMessage ); |
|
435 } |
|
436 } |
|
437 |
|
438 |
|
439 // ----------------------------------------------------------------------------- |
|
440 // CCPServerSession::UnregisterObserverL |
|
441 // --------------- -------------------------------------------------------------- |
|
442 // |
|
443 void CCPServerSession::UnregisterObserverL() |
|
444 { |
|
445 CP_DEBUG( _L8("CCPServerSession::UnregisterObserverL()" ) ); |
|
446 if ( isRegister && iNotificationHandler ) |
|
447 { |
|
448 //remove notification handler from an array of sessions in data manager |
|
449 iDataManager->RemoveObserver( iNotificationHandler ); |
|
450 //reset filter for this session |
|
451 iNotificationHandler->ErrorComplete( KErrCancel ); |
|
452 delete iNotificationHandler; |
|
453 iNotificationHandler = NULL; |
|
454 isRegister = EFalse; |
|
455 } |
|
456 else |
|
457 { |
|
458 User::Leave( KErrNotFound ); |
|
459 } |
|
460 } |
|
461 |
|
462 // ----------------------------------------------------------------------------- |
|
463 // CCPServerSession::GetChangeInfoDataL |
|
464 // ----------------------------------------------------------------------------- |
|
465 // |
|
466 void CCPServerSession::GetChangeInfoDataL( const RMessage2& aMessage ) |
|
467 { |
|
468 CP_DEBUG( _L8("CCPServerSession::GetChangeInfoData()" ) ); |
|
469 if( iNotificationHandler ) |
|
470 { |
|
471 ExternalizeAndWriteToClientL( aMessage, |
|
472 iNotificationHandler->GetPointerToChangeInfoList( ) ); |
|
473 iNotificationHandler->Reset( ); |
|
474 isRegister = EFalse; |
|
475 } |
|
476 } |
|
477 |
|
478 // ----------------------------------------------------------------------------- |
|
479 // CCPServerSession::ExternalizeAndWriteToClient |
|
480 // ----------------------------------------------------------------------------- |
|
481 // |
|
482 void CCPServerSession::ExternalizeAndWriteToClientL( |
|
483 const RMessage2& aMessage, const CLiwGenericParamList* outParamList ) |
|
484 { |
|
485 CP_DEBUG( _L8("CCPServerSession::ExternalizeAndWriteToClientL()" ) ); |
|
486 HBufC8* buf = HBufC8::NewLC( outParamList->Size( ) ); |
|
487 TPtr8 des = buf->Des( ); |
|
488 RDesWriteStream writeStream(des); |
|
489 CleanupClosePushL( writeStream ); |
|
490 outParamList->ExternalizeL( writeStream ); |
|
491 writeStream.CommitL( ); |
|
492 aMessage.WriteL( KDescriptorPosition, des ); |
|
493 CleanupStack::PopAndDestroy( &writeStream ); |
|
494 CleanupStack::PopAndDestroy( buf ); |
|
495 } |
|
496 |
|
497 // ----------------------------------------------------------------------------- |
|
498 // |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 CCPLiwMap* CCPServerSession::UnpackFromClientLC( const RMessage2& aMessage ) |
|
502 { |
|
503 CP_DEBUG( _L8("CCPServerSession::UnpackFromClientLC()") ); |
|
504 TInt deslen = aMessage.GetDesLengthL( KDescriptorPosition ); |
|
505 HBufC8* buffer = HBufC8::NewLC( deslen ); |
|
506 TPtr8 tempDes = buffer->Des( ); |
|
507 aMessage.Read( KDescriptorPosition, tempDes ); |
|
508 RDesReadStream datastrm( *buffer); |
|
509 CleanupClosePushL( datastrm ); |
|
510 CCPLiwMap* inParamList = CCPLiwMap::NewL( datastrm ); |
|
511 CleanupStack::PopAndDestroy( &datastrm ); |
|
512 CleanupStack::PopAndDestroy( buffer ); |
|
513 inParamList->PushL( ); |
|
514 return inParamList; |
|
515 } |
|
516 |
|
517 // ----------------------------------------------------------------------------- |
|
518 // CCPServerSession::SendNotificationL |
|
519 // ----------------------------------------------------------------------------- |
|
520 // |
|
521 void CCPServerSession::SendNotificationL( CCPLiwMap* aMap, |
|
522 CLiwDefaultList* aNotificationList ) |
|
523 { |
|
524 RBuf8 trigger; |
|
525 trigger.CleanupClosePushL(); |
|
526 aMap->GetPropertyL( KActionTrigger, trigger ); |
|
527 if( ( trigger == KActivateTrigger ) || ( trigger == KDeactivateTrigger ) ) |
|
528 { |
|
529 iDataManager->HandleChangeL( aNotificationList ); |
|
530 } |
|
531 CleanupStack::PopAndDestroy( &trigger ); |
|
532 } |
|
533 |
|
534 // ----------------------------------------------------------------------------- |
|
535 // CCPServerSession::GetAndExecuteActionL |
|
536 // --------------- -------------------------------------------------------------- |
|
537 // |
|
538 void CCPServerSession::GetAndExecuteActionL( CCPLiwMap* aMap, |
|
539 CLiwDefaultList* aNotificationList, TBool aInsertTrigger ) |
|
540 { |
|
541 if (aInsertTrigger) |
|
542 { |
|
543 aMap->InsertL( KActionTrigger, TLiwVariant( KActivateTrigger ) ); |
|
544 } |
|
545 CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC(); |
|
546 iDataManager->GetActionsL( *aMap, EFalse, *paramList, aNotificationList ); |
|
547 iActionHandlerThread->ExecuteL( *paramList ); |
|
548 CleanupStack::PopAndDestroy( paramList ); |
|
549 } |
|
550 |
|
551 // ----------------------------------------------------------------------------- |
|
552 // CCPServerSession::GetServerLock |
|
553 // --------------- -------------------------------------------------------------- |
|
554 // |
|
555 TBool CCPServerSession::GetServerLock( const RMessage2& aMessage ) |
|
556 { |
|
557 // Allways allow to unregister |
|
558 return ( (aMessage.Function() != ECpServerUnRegisterObserver) |
|
559 && iServer->GetLock() ); |
|
560 |
|
561 } |
|
562 |
|
563 // ----------------------------------------------------------------------------- |
|
564 // |
|
565 // --------------- -------------------------------------------------------------- |
|
566 // |
|
567 CLiwGenericParamList* CCPServerSession::UnpackForMultiExecuteLC( |
|
568 const RMessage2& aMessage) |
|
569 { |
|
570 TInt deslen = aMessage.GetDesLengthL(KDescriptorPosition); |
|
571 HBufC8* buffer = HBufC8::NewLC(deslen); |
|
572 TPtr8 tempDes = buffer->Des(); |
|
573 aMessage.Read(KDescriptorPosition, tempDes); |
|
574 RDesReadStream datastrm(*buffer); |
|
575 CleanupClosePushL(datastrm); |
|
576 CLiwGenericParamList* genericList = CLiwGenericParamList::NewL(datastrm); |
|
577 CleanupStack::PopAndDestroy(&datastrm); |
|
578 CleanupStack::PopAndDestroy(buffer); |
|
579 CleanupStack::PushL(genericList); |
|
580 return genericList; |
|
581 } |
|
582 |
|
583 // ----------------------------------------------------------------------------- |
|
584 // |
|
585 // --------------- -------------------------------------------------------------- |
|
586 // |
|
587 CLiwDefaultList* CCPServerSession::CheckValidityLC(const CLiwList* aMaps) |
|
588 { |
|
589 CLiwDefaultList* cpMaps = CLiwDefaultList::NewLC(); |
|
590 for (TInt i = 0; i < aMaps->Count(); i++) |
|
591 { |
|
592 TLiwVariant mapVariant; |
|
593 mapVariant.PushL(); |
|
594 aMaps->AtL(i, mapVariant); |
|
595 if (mapVariant.TypeId() != LIW::EVariantTypeMap) |
|
596 { |
|
597 User::Leave(KErrBadName); |
|
598 } |
|
599 CCPLiwMap* map = CCPLiwMap::NewL(*mapVariant.AsMap()); |
|
600 map->PushL(); |
|
601 map->IsValidForActionL(); |
|
602 cpMaps->AppendL(TLiwVariant(map)); |
|
603 CleanupStack::PopAndDestroy(map); |
|
604 CleanupStack::PopAndDestroy(&mapVariant); |
|
605 } |
|
606 return cpMaps; |
|
607 } |
|
608 |
|
609 // End of File |