locationrequestmgmt/networkrequesthandler/src/EPos_CPosDialogCtrl.cpp
branchRCL_3
changeset 31 b6bc347ed8ca
parent 28 cf8bf9651775
equal deleted inserted replaced
28:cf8bf9651775 31:b6bc347ed8ca
    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     {
    80         DoCompleteRequest(0, KErrServerTerminated);
    88         DoCompleteRequest(0, KErrServerTerminated);
    81         }
    89         }
    82 
    90 
    83     iNotifier.Close();
    91     iNotifier.Close();
    84     iRequestQueue.Close();
    92     iRequestQueue.Close();
       
    93     RProperty::Delete(KUidSystemCategory, EPrivacyNumberOfRequest);
    85     }
    94     }
    86 
    95 
    87 // ---------------------------------------------------------
    96 // ---------------------------------------------------------
    88 // CPosDialogCtrl::NotifyL
    97 // CPosDialogCtrl::NotifyL
    89 //
    98 //
   287         TRequestStatus* status = request.iStatus;
   296         TRequestStatus* status = request.iStatus;
   288         User::RequestComplete(status, aCompletionCode);
   297         User::RequestComplete(status, aCompletionCode);
   289         }
   298         }
   290     iRequestQueue.Remove(aIndex);
   299     iRequestQueue.Remove(aIndex);
   291     iRequestQueue.Compress();
   300     iRequestQueue.Compress();
       
   301     UpdateProperty();
   292     }
   302     }
   293 
   303 
   294 // ---------------------------------------------------------
   304 // ---------------------------------------------------------
   295 // CPosDialogCtrl::ScheduleRequestL
   305 // CPosDialogCtrl::ScheduleRequestL
   296 //
   306 //
   300 void CPosDialogCtrl::ScheduleRequestL(TRequest& aRequest)
   310 void CPosDialogCtrl::ScheduleRequestL(TRequest& aRequest)
   301     {
   311     {
   302     // Start a new request.    
   312     // Start a new request.    
   303     aRequest.iId = ++iRequestId;
   313     aRequest.iId = ++iRequestId;
   304     User::LeaveIfError(iRequestQueue.Append(aRequest));
   314     User::LeaveIfError(iRequestQueue.Append(aRequest));
       
   315     UpdateProperty();
   305 
   316 
   306     if (iRequestQueue.Count() == 1)
   317     if (iRequestQueue.Count() == 1)
   307         {
   318         {
   308         TInt err = StartNotifierRequest();
   319         TInt err = StartNotifierRequest();
   309 
   320 
   615     for( TInt i = 1; i < iRequestQueue.Count(); i++ )
   626     for( TInt i = 1; i < iRequestQueue.Count(); i++ )
   616 		{
   627 		{
   617 		if ( iRequestQueue[i].iType == TPosQNInputData::ENotification )
   628 		if ( iRequestQueue[i].iType == TPosQNInputData::ENotification )
   618 			{
   629 			{
   619 			User::LeaveIfError(iRequestQueue.Insert( aRequest,i ));
   630 			User::LeaveIfError(iRequestQueue.Insert( aRequest,i ));
       
   631 			UpdateProperty();
   620 			return;
   632 			return;
   621 			}
   633 			}
   622 		}
   634 		}
   623 	
   635 	
   624     User::LeaveIfError(iRequestQueue.Append(aRequest));
   636     User::LeaveIfError(iRequestQueue.Append(aRequest));
       
   637     UpdateProperty();
   625     }
   638     }
   626 
   639 
   627 // ---------------------------------------------------------
   640 // ---------------------------------------------------------
   628 // CPosDialogCtrl::DeferNotificationL
   641 // CPosDialogCtrl::DeferNotificationL
   629 //
   642 //
   639 		TRequest request = iRequestQueue[0];
   652 		TRequest request = iRequestQueue[0];
   640 		EnqueueRequestL(request);
   653 		EnqueueRequestL(request);
   641 		}
   654 		}
   642 	iRequestQueue.Remove(0);
   655 	iRequestQueue.Remove(0);
   643     iRequestQueue.Compress();
   656     iRequestQueue.Compress();
       
   657     UpdateProperty();
   644 	NextRequest();	
   658 	NextRequest();	
   645 	}
   659 	}
   646 
   660 
   647 // ---------------------------------------------------------
   661 // ---------------------------------------------------------
   648 // CPosDialogCtrl::CreateNotificationAndEnqueueL
   662 // CPosDialogCtrl::CreateNotificationAndEnqueueL
   683     
   697     
   684     EnqueueRequestL(notifyRequest);        
   698     EnqueueRequestL(notifyRequest);        
   685     CleanupStack::Pop(requestinfocopy);
   699     CleanupStack::Pop(requestinfocopy);
   686     
   700     
   687 	}
   701 	}
       
   702 
       
   703 void CPosDialogCtrl::UpdateProperty()
       
   704     {
       
   705     RProperty::Set(KUidSystemCategory, EPrivacyNumberOfRequest, iRequestQueue.Count());
       
   706     }
       
   707 
       
   708 
   688 //  End of File
   709 //  End of File