equal
deleted
inserted
replaced
15 |
15 |
16 |
16 |
17 |
17 |
18 // INCLUDE FILES |
18 // INCLUDE FILES |
19 #include <s32mem.h> |
19 #include <s32mem.h> |
|
20 #include <e32property.h> |
20 #include <lbs/epos_privacy.h> |
21 #include <lbs/epos_privacy.h> |
21 #include <lbs/epos_cposcontactrequestor.h> |
22 #include <lbs/epos_cposcontactrequestor.h> |
22 #include <lbs/epos_cposservicerequestor.h> |
23 #include <lbs/epos_cposservicerequestor.h> |
23 #include <lbs/epos_rposrequestorstack.h> |
24 #include <lbs/epos_rposrequestorstack.h> |
24 #include <lbs/epos_privacynotifier.hrh> |
25 #include <lbs/epos_privacynotifier.hrh> |
34 const TUid KNotifierUid = { 0x10283744 }; |
35 const TUid KNotifierUid = { 0x10283744 }; |
35 #else |
36 #else |
36 const TUid KNotifierUid = { KPosPrivacyNotifierImplUid }; |
37 const TUid KNotifierUid = { KPosPrivacyNotifierImplUid }; |
37 #endif // NRH_UNIT_TEST |
38 #endif // NRH_UNIT_TEST |
38 |
39 |
|
40 // P&S Key so NG can check the status of notifications |
|
41 const TInt EPrivacyNumberOfRequest = 0x1028720F; |
|
42 |
39 // The output descriptor for Notifier calls. Since we want to pass |
43 // The output descriptor for Notifier calls. Since we want to pass |
40 // just a dummy null descriptor there is no need to create a HBufC |
44 // just a dummy null descriptor there is no need to create a HBufC |
41 // each time. |
45 // each time. |
42 TPtr8 nullPtr(reinterpret_cast<TUint8*>(NULL), 0); |
46 TPtr8 nullPtr(reinterpret_cast<TUint8*>(NULL), 0); |
43 |
47 |
56 // EPOC default constructor can leave. |
60 // EPOC default constructor can leave. |
57 void CPosDialogCtrl::ConstructL() |
61 void CPosDialogCtrl::ConstructL() |
58 { |
62 { |
59 TInt err = iNotifier.Connect(); |
63 TInt err = iNotifier.Connect(); |
60 User::LeaveIfError(err); |
64 User::LeaveIfError(err); |
|
65 |
|
66 // Define the property |
|
67 RProperty::Define(KUidSystemCategory, EPrivacyNumberOfRequest, RProperty::EInt); |
|
68 UpdateProperty(); |
61 } |
69 } |
62 |
70 |
63 // Two-phased constructor. |
71 // Two-phased constructor. |
64 CPosDialogCtrl* CPosDialogCtrl::InstanceL() |
72 CPosDialogCtrl* CPosDialogCtrl::InstanceL() |
65 { |
73 { |
76 Cancel(); |
84 Cancel(); |
77 TInt count = iRequestQueue.Count(); |
85 TInt count = iRequestQueue.Count(); |
78 for (TInt i = 0; i < count; i++) |
86 for (TInt i = 0; i < count; i++) |
79 { |
87 { |
80 DoCompleteRequest(0, KErrServerTerminated); |
88 DoCompleteRequest(0, KErrServerTerminated); |
81 // Delete the pointer items |
|
82 delete iRequestQueue[i].iRequestInfo; |
|
83 } |
89 } |
84 |
90 |
85 iNotifier.Close(); |
91 iNotifier.Close(); |
86 iRequestQueue.Close(); |
92 iRequestQueue.Close(); |
|
93 RProperty::Delete(KUidSystemCategory, EPrivacyNumberOfRequest); |
87 } |
94 } |
88 |
95 |
89 // --------------------------------------------------------- |
96 // --------------------------------------------------------- |
90 // CPosDialogCtrl::NotifyL |
97 // CPosDialogCtrl::NotifyL |
91 // |
98 // |
277 // |
284 // |
278 void CPosDialogCtrl::DoCompleteRequest( |
285 void CPosDialogCtrl::DoCompleteRequest( |
279 TInt aIndex, |
286 TInt aIndex, |
280 TInt aCompletionCode) |
287 TInt aCompletionCode) |
281 { |
288 { |
282 TRequestStatus* status = iRequestQueue[aIndex].iStatus; |
289 TRequest request = iRequestQueue[aIndex]; |
283 User::RequestComplete(status, aCompletionCode); |
290 if (request.iType == TPosQNInputData::ENotification) |
|
291 { |
|
292 delete request.iRequestInfo; |
|
293 } |
|
294 else |
|
295 { |
|
296 TRequestStatus* status = request.iStatus; |
|
297 User::RequestComplete(status, aCompletionCode); |
|
298 } |
284 iRequestQueue.Remove(aIndex); |
299 iRequestQueue.Remove(aIndex); |
285 iRequestQueue.Compress(); |
300 iRequestQueue.Compress(); |
|
301 UpdateProperty(); |
286 } |
302 } |
287 |
303 |
288 // --------------------------------------------------------- |
304 // --------------------------------------------------------- |
289 // CPosDialogCtrl::ScheduleRequestL |
305 // CPosDialogCtrl::ScheduleRequestL |
290 // |
306 // |
294 void CPosDialogCtrl::ScheduleRequestL(TRequest& aRequest) |
310 void CPosDialogCtrl::ScheduleRequestL(TRequest& aRequest) |
295 { |
311 { |
296 // Start a new request. |
312 // Start a new request. |
297 aRequest.iId = ++iRequestId; |
313 aRequest.iId = ++iRequestId; |
298 User::LeaveIfError(iRequestQueue.Append(aRequest)); |
314 User::LeaveIfError(iRequestQueue.Append(aRequest)); |
|
315 UpdateProperty(); |
299 |
316 |
300 if (iRequestQueue.Count() == 1) |
317 if (iRequestQueue.Count() == 1) |
301 { |
318 { |
302 TInt err = StartNotifierRequest(); |
319 TInt err = StartNotifierRequest(); |
303 |
320 |
363 buffer->Des().Append(*reqStackBuf); |
380 buffer->Des().Append(*reqStackBuf); |
364 |
381 |
365 delete reqStackBuf; |
382 delete reqStackBuf; |
366 reqStackBuf = NULL; |
383 reqStackBuf = NULL; |
367 |
384 |
368 if (data.iType == TPosQNInputData::ENotification) // We dont expect a resonse from a notfication |
385 iNotifier.StartNotifierAndGetResponse( |
369 { |
386 iStatus, KNotifierUid, nullPtr, nullPtr); |
370 iNotifier.StartNotifier(KNotifierUid, nullPtr, nullPtr); |
387 SetActive(); |
371 |
388 |
372 // As we wont be getting a response remove from the notification list |
|
373 delete iRequestQueue[0].iRequestInfo; |
|
374 iRequestQueue.Remove(0); |
|
375 iRequestQueue.Compress(); |
|
376 } |
|
377 else |
|
378 { |
|
379 iNotifier.StartNotifierAndGetResponse( |
|
380 iStatus, KNotifierUid, nullPtr, nullPtr); |
|
381 SetActive(); |
|
382 } |
|
383 |
|
384 err = iNotifier.UpdateNotifier(KNotifierUid, *buffer, nullPtr); |
389 err = iNotifier.UpdateNotifier(KNotifierUid, *buffer, nullPtr); |
385 if (err != KErrNone) |
390 if (err != KErrNone) |
386 { |
391 { |
387 Cancel(); |
392 Cancel(); |
388 } |
393 } |
621 for( TInt i = 1; i < iRequestQueue.Count(); i++ ) |
626 for( TInt i = 1; i < iRequestQueue.Count(); i++ ) |
622 { |
627 { |
623 if ( iRequestQueue[i].iType == TPosQNInputData::ENotification ) |
628 if ( iRequestQueue[i].iType == TPosQNInputData::ENotification ) |
624 { |
629 { |
625 User::LeaveIfError(iRequestQueue.Insert( aRequest,i )); |
630 User::LeaveIfError(iRequestQueue.Insert( aRequest,i )); |
|
631 UpdateProperty(); |
626 return; |
632 return; |
627 } |
633 } |
628 } |
634 } |
629 |
635 |
630 User::LeaveIfError(iRequestQueue.Append(aRequest)); |
636 User::LeaveIfError(iRequestQueue.Append(aRequest)); |
|
637 UpdateProperty(); |
631 } |
638 } |
632 |
639 |
633 // --------------------------------------------------------- |
640 // --------------------------------------------------------- |
634 // CPosDialogCtrl::DeferNotificationL |
641 // CPosDialogCtrl::DeferNotificationL |
635 // |
642 // |
645 TRequest request = iRequestQueue[0]; |
652 TRequest request = iRequestQueue[0]; |
646 EnqueueRequestL(request); |
653 EnqueueRequestL(request); |
647 } |
654 } |
648 iRequestQueue.Remove(0); |
655 iRequestQueue.Remove(0); |
649 iRequestQueue.Compress(); |
656 iRequestQueue.Compress(); |
|
657 UpdateProperty(); |
650 NextRequest(); |
658 NextRequest(); |
651 } |
659 } |
652 |
660 |
653 // --------------------------------------------------------- |
661 // --------------------------------------------------------- |
654 // CPosDialogCtrl::CreateNotificationAndEnqueueL |
662 // CPosDialogCtrl::CreateNotificationAndEnqueueL |
689 |
697 |
690 EnqueueRequestL(notifyRequest); |
698 EnqueueRequestL(notifyRequest); |
691 CleanupStack::Pop(requestinfocopy); |
699 CleanupStack::Pop(requestinfocopy); |
692 |
700 |
693 } |
701 } |
|
702 |
|
703 void CPosDialogCtrl::UpdateProperty() |
|
704 { |
|
705 RProperty::Set(KUidSystemCategory, EPrivacyNumberOfRequest, iRequestQueue.Count()); |
|
706 } |
|
707 |
|
708 |
694 // End of File |
709 // End of File |