coreapplicationuis/Rfs/src/rfsConnectionObserver.cpp
changeset 53 920c9a724929
parent 29 6a787171e1de
child 81 676b6116ca93
--- a/coreapplicationuis/Rfs/src/rfsConnectionObserver.cpp	Fri Jul 16 10:30:52 2010 +0300
+++ b/coreapplicationuis/Rfs/src/rfsConnectionObserver.cpp	Mon Aug 02 14:01:08 2010 +0300
@@ -23,14 +23,10 @@
 #include <featmgr.h>
 #include <eikenv.h>  
 #include <centralrepository.h>
-#include <pdpcontextmanagerpskeys.h>
 #include <pdpcontextmanagerinternalcrkeys.h>
 #include <StringLoader.h> 
 
-// P&S KEYS FROM SIP & PDP CONNECTION
-#include <e32property.h>
-#include <pdpcontextmanagerpskeys.h>
-#include <sipsystemstatemonitorpskeys.h>
+
 
 // USER INCLUDES
 #include "rfsConnectionObserver.h"
@@ -141,6 +137,9 @@
         Subscribe();
         }
     
+    // Create the Timer Active Object
+    iRfsConTimer = CRfsConTimer :: NewL(this);
+    
     TRACES("CRfsConnectionObserver::ConstructL(): End");
     }
 
@@ -170,6 +169,11 @@
 CRfsConnectionObserver::~CRfsConnectionObserver()
     {
     TRACES("CRfsConnectionObserver::~CRfsConnectionObserver()");
+    
+    if(iRfsConTimer)
+        {
+        delete iRfsConTimer;
+        }
     Cancel();
     delete iWait;
     TRACES("CRfsConnectionObserver::~CRfsConnectionObserver(): End");
@@ -191,16 +195,21 @@
     // only perform the following operation if the 'iIsClosingConnectionsApplicable' is ETrue 
     iAllConnectionClosed = EFalse;
       
-    // Send P&S notification to SIP that RFS has started
     TInt err(KErrNone);
     if (iIsSIPConnectionsPresent && iState == ESipConnectionClose)
         {
+        // Send P&S notification to SIP that RFS has started and start the timer
+   
         err = iSIPProperty.Set(KPSSipRfsUid, KSipRfsState, ESipRfsStarted );
+        iRfsConTimer->IssueTimerRequest();
         iIsSipInformedForClosingAllConnection = ETrue;
         }
     else if (iIsPDPFeatureEnabled && iState == EPdpConnectionClose)
         {
+        // Send P&S notification to PDP that RFS has started and start the timer
+    
         err = iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStart );
+        iRfsConTimer->IssueTimerRequest();
         iIsPDPInformedforClosingAllConnection = ETrue;
         }
     
@@ -208,12 +217,6 @@
     // Leave from here is there is any error setting the intial handshake information
     // This means that RFS has failed as there was some problem setting the P&S keys
     User::LeaveIfError(err);
-    if(err != KErrNone)
-        {
-        TRACES1("CRfsConnectionObserver::CloseAlwaysOnConnectionL(): Err = %d", err);
-        // This means that the RFS has failed
-        return EFalse; 
-        }
     
     // we set the flag to indicate showl is called and the dialog needs to be
     // dismissed from within the RunL()
@@ -255,9 +258,11 @@
                 {
                 iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStop);
                 }
-       
-                   
-        
+    if(iRfsConTimer)
+            {
+            // Cancel the Active timer if the user cancel the Rfs operation
+            iRfsConTimer->Cancel();
+            }        
 }
 
 
@@ -345,7 +350,9 @@
                     {
                     // set the information that we have closed all the active connections
                     // here itself because the PDP connection/feature doen't exist
+                    // Cancel the outstanding timer request
                     iAllConnectionClosed = ETrue;
+                    iRfsConTimer->Cancel();
                     DismissWaitDialog();
                     }
                 
@@ -354,7 +361,14 @@
                     iPDPProperty.Set(KPDPContextManager2,KPDPContextManagerFactorySettingsReset,EPDPContextManagerFactorySettingsResetStart );
                     
                     // change the state to the next from within this as we are done with closing the SIP connection
-                    iState = EPdpConnectionClose;
+                    // Cancel the Outstanding SIP  and timer request
+                    // Subscribe to PDP  and start the timer
+                    Cancel();
+                    iRfsConTimer->Cancel();
+                    iState = EPdpConnectionClose;                                        
+                    Subscribe(); 
+                    iRfsConTimer->IssueTimerRequest();
+                                        
                     //
                     // Under following cases the 'iIsPDPInformedforClosingAllConnection' will be set
                     //
@@ -395,6 +409,7 @@
                 // Now we may proceed to dsmiss the dialog and also set the state to the True for 
                 // all active connections closed
                 iAllConnectionClosed = ETrue;
+                iRfsConTimer->Cancel();                                    
                 DismissWaitDialog();
                 }
             }
@@ -429,17 +444,19 @@
     {
     TRACES("CRfsConnectionObserver::DoCancel()");
     
-    if(iIsPDPFeatureEnabled)
+    if(iIsSIPConnectionsPresent && iState == ESipConnectionClose)
+        {
+        iSIPProperty.Cancel();
+        if(!iIsPDPFeatureEnabled)
+            {
+            DismissWaitDialog();
+            }
+        }
+    if(iIsPDPFeatureEnabled && iState == EPdpConnectionClose)
         {
         iPDPProperty.Cancel();
+        DismissWaitDialog();            
         }
-    if(iIsSIPConnectionsPresent)
-        {
-        iSIPProperty.Cancel();
-        }
-
-    DismissWaitDialog();
-    
     TRACES("CRfsConnectionObserver::DoCancel(): End");
     }