sipplugins/sippsystemstatemonitor/src/sipsystemstatemonitorimpl.cpp
branchRCL_3
changeset 9 1e1cc61f56c3
parent 0 307788aac0a8
child 12 c2e8c8b73582
--- a/sipplugins/sippsystemstatemonitor/src/sipsystemstatemonitorimpl.cpp	Fri Feb 19 23:10:33 2010 +0200
+++ b/sipplugins/sippsystemstatemonitor/src/sipsystemstatemonitorimpl.cpp	Fri Mar 12 15:44:11 2010 +0200
@@ -21,6 +21,8 @@
 #include "CSystemStateConnUsagePermissionMonitor.h"
 #include "sipdevicestateaware.h"
 #include "siprfsmonitorao.h"
+#include "sipvpnmonitorao.h"
+#include <featmgr.h>          // for Feature Manager
 
 // -----------------------------------------------------------------------------
 // CSipSystemStateMonitorImpl::NewL
@@ -62,6 +64,13 @@
 //
 CSipSystemStateMonitorImpl::~CSipSystemStateMonitorImpl()
     {
+    // iVpnMonitor is created in StartMonitoringL().
+    if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
+        {
+        delete iVpnMonitor;
+        iVpnMonitor = NULL;
+        }
+		
     delete iMonitorAo;
     iSnapMonitors.ResetAndDestroy();
     delete iUsagePermissionMonitor;
@@ -116,6 +125,16 @@
         iRfsMonitor = iRfsMonitor?iRfsMonitor:CSipRfsMonitorAo::NewL();
         iRfsMonitor->AddObserverL( aObserver );
         }
+    // CSipVpnMonitorAo is created for P&S key change monitoring.
+    else if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+         && ( aVariable == EVpnState ) )
+        {
+        if ( !iVpnMonitor )
+            {
+            iVpnMonitor = CSipVpnMonitorAo::NewL();
+            }
+        iVpnMonitor->AddObserverL( aObserver );
+        }
     else
         {
         User::Leave( KErrNotSupported );
@@ -155,6 +174,15 @@
         if(iRfsMonitor)
             iRfsMonitor->RemoveObserver( aObserver );
         }
+    // Remove the client as an observer when stops VPN P&S key monitoring.
+    else if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+         && ( aVariable == EVpnState ) )
+        {
+        if ( iVpnMonitor )
+            {
+            iVpnMonitor->RemoveObserver( aObserver );
+            }
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -188,6 +216,15 @@
         if(iRfsMonitor)
             iRfsMonitor->State();
         }
+    else if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+         && ( aVariable == EVpnState ) )
+        {
+        if( iVpnMonitor )
+            {
+            return iVpnMonitor->State();
+            }
+        }
+		
     return KErrNotFound;
     }
 
@@ -208,6 +245,13 @@
         {
         iSipDeviceAwareObject->EventProcessingCompleted(aObserver);
         }
+    // SIP deregistration for VPN session has been completed. 
+    else if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
+         && ( aVariable == EVpnState ) 
+         && iVpnMonitor )
+        {
+        iVpnMonitor->EventProcessingCompleted(aObserver);
+        }
     }
 
 // -----------------------------------------------------------------------------