locationrequestmgmt/networkrequesthandler/src/EPos_CPosDialogCtrl.cpp
changeset 57 3267d9ea3e98
parent 23 2965a06983dc
--- a/locationrequestmgmt/networkrequesthandler/src/EPos_CPosDialogCtrl.cpp	Tue Jul 13 12:25:28 2010 +0100
+++ b/locationrequestmgmt/networkrequesthandler/src/EPos_CPosDialogCtrl.cpp	Wed Sep 08 15:16:57 2010 +0100
@@ -17,6 +17,7 @@
 
 // INCLUDE FILES
 #include <s32mem.h>
+#include <e32property.h>
 #include <lbs/epos_privacy.h>
 #include <lbs/epos_cposcontactrequestor.h>
 #include <lbs/epos_cposservicerequestor.h>
@@ -36,6 +37,9 @@
 const TUid KNotifierUid = { KPosPrivacyNotifierImplUid };
 #endif // NRH_UNIT_TEST
 
+// P&S Key so NG can check the status of notifications
+const TInt EPrivacyNumberOfRequest = 0x1028720F;
+
 // The output descriptor for Notifier calls. Since we want to pass
 // just a dummy null descriptor there is no need to create a HBufC
 // each time.
@@ -58,6 +62,10 @@
     {
     TInt err = iNotifier.Connect();
     User::LeaveIfError(err);
+    
+    // Define the property
+    RProperty::Define(KUidSystemCategory, EPrivacyNumberOfRequest, RProperty::EInt);
+    UpdateProperty();
     }
 
 // Two-phased constructor.
@@ -78,12 +86,11 @@
     for (TInt i = 0; i < count; i++)
         {
         DoCompleteRequest(0, KErrServerTerminated);
-        // Delete the pointer items
-        delete iRequestQueue[i].iRequestInfo;
         }
 
     iNotifier.Close();
     iRequestQueue.Close();
+    RProperty::Delete(KUidSystemCategory, EPrivacyNumberOfRequest);
     }
 
 // ---------------------------------------------------------
@@ -279,10 +286,19 @@
     TInt aIndex,
     TInt aCompletionCode)
     {
-    TRequestStatus* status = iRequestQueue[aIndex].iStatus;
-    User::RequestComplete(status, aCompletionCode);
+    TRequest request = iRequestQueue[aIndex];
+    if (request.iType == TPosQNInputData::ENotification)
+        {
+        delete request.iRequestInfo;
+        }
+    else
+        {
+        TRequestStatus* status = request.iStatus;
+        User::RequestComplete(status, aCompletionCode);
+        }
     iRequestQueue.Remove(aIndex);
     iRequestQueue.Compress();
+    UpdateProperty();
     }
 
 // ---------------------------------------------------------
@@ -296,6 +312,7 @@
     // Start a new request.    
     aRequest.iId = ++iRequestId;
     User::LeaveIfError(iRequestQueue.Append(aRequest));
+    UpdateProperty();
 
     if (iRequestQueue.Count() == 1)
         {
@@ -365,22 +382,10 @@
         delete reqStackBuf;
         reqStackBuf = NULL;
 
-        if (data.iType == TPosQNInputData::ENotification) // We dont expect a resonse from a notfication
-            {
-            iNotifier.StartNotifier(KNotifierUid, nullPtr, nullPtr);
-            
-            // As we wont be getting a response remove from the notification list
-            delete iRequestQueue[0].iRequestInfo;
-            iRequestQueue.Remove(0);
-            iRequestQueue.Compress();
-            }
-        else
-            {
-            iNotifier.StartNotifierAndGetResponse(
-                    iStatus, KNotifierUid, nullPtr, nullPtr);
-            SetActive();
-            }
-        
+        iNotifier.StartNotifierAndGetResponse(
+            iStatus, KNotifierUid, nullPtr, nullPtr);
+        SetActive();
+
         err = iNotifier.UpdateNotifier(KNotifierUid, *buffer, nullPtr);
         if (err != KErrNone)
             {
@@ -623,11 +628,13 @@
 		if ( iRequestQueue[i].iType == TPosQNInputData::ENotification )
 			{
 			User::LeaveIfError(iRequestQueue.Insert( aRequest,i ));
+			UpdateProperty();
 			return;
 			}
 		}
 	
     User::LeaveIfError(iRequestQueue.Append(aRequest));
+    UpdateProperty();
     }
 
 // ---------------------------------------------------------
@@ -647,6 +654,7 @@
 		}
 	iRequestQueue.Remove(0);
     iRequestQueue.Compress();
+    UpdateProperty();
 	NextRequest();	
 	}
 
@@ -691,4 +699,11 @@
     CleanupStack::Pop(requestinfocopy);
     
 	}
+
+void CPosDialogCtrl::UpdateProperty()
+    {
+    RProperty::Set(KUidSystemCategory, EPrivacyNumberOfRequest, iRequestQueue.Count());
+    }
+
+
 //  End of File