syncmlfw/ds/syncagent/src/nsmldsagent.cpp
changeset 32 5d0ec111abfc
parent 0 b497e44ab2fc
child 44 39aa16f3fdc2
--- a/syncmlfw/ds/syncagent/src/nsmldsagent.cpp	Fri May 14 16:42:50 2010 +0300
+++ b/syncmlfw/ds/syncagent/src/nsmldsagent.cpp	Thu May 27 13:43:36 2010 +0300
@@ -22,6 +22,9 @@
 #include <DataSyncInternalPSKeys.h>
 #include <nsmlconstants.h>
 #include <nsmldebug.h>
+#include <cmpluginwlandef.h>
+#include <cmmanager.h>
+#include <cmconnectionmethod.h>
 
 // common includes with DM
 #include "nsmlagenttestdefines.h"
@@ -1888,23 +1891,39 @@
 			profileUtil->AccessPointIdL(LastUsedIAPId);
 			if(LastUsedIAPId > 0)
 			{
-				//Check Whether the IAPID still exists
-		    	TApBearerType bearertype = CheckAPBearerTypeL(LastUsedIAPId);
-		    	if(bearertype != TApBearerType(-1))
-		    	{
-		    		iIAPId = LastUsedIAPId;    	
-		    		DBG_FILE_CODE(iIAPId , _S8("CNSmlDSAgent::ReadSettingsL, The Access Point ID Replaced from the CenRep:"));                
-		    	}
-		    	else
-		    	{
-		    		//Stop the DS Sync Session
-		    		DBG_FILE(_S8("CNSmlDSAgent::ReadSettingsL, The Access Point ID is invalid so stopping the session"));
-		    		iPacketDataUnAvailable = ETrue;
-		    		StopDSSession();
-		    	}	
+                //Check Whether the IAPID still exists
+                RCmManager  cmmanager;
+                cmmanager.OpenL();
+                CleanupClosePushL(cmmanager);
+                RCmConnectionMethod cm;
+                TRAPD(err, cm = cmmanager.ConnectionMethodL( LastUsedIAPId ));
+                CleanupClosePushL( cm );
+                TUint32 bearer = 0;
+                if( err == KErrNone )
+                {
+                    bearer = cm.GetIntAttributeL( CMManager::ECmBearerType );        
+                    DBG_FILE_CODE( bearer ,_S8("CNSmlDSAgent::ReadSettingsL, BearerType"));
+                    if ( bearer == KUidWlanBearerType )
+                    {
+                        DBG_FILE(_S8("CNSmlDSAgent::ReadSettingsL, The Access Point ID is invalid WLAN"));
+                        iPacketDataUnAvailable = ETrue;
+                        StopDSSession();
+                    }
+                    else
+                    {
+                        iIAPId = LastUsedIAPId;      
+                        DBG_FILE_CODE(iIAPId , _S8("CNSmlDSAgent::ReadSettingsL, The Access Point ID Replaced from the CenRep:"));
+                    }
+                }
+                else
+                {
+                    DBG_FILE_CODE( err ,_S8("CNSmlDSAgent::ReadSettingsL, The Access Point ID is invalid"));
+                    iPacketDataUnAvailable = ETrue;
+                    StopDSSession();
+                }              
+                CleanupStack::PopAndDestroy( 2 ); //cmmanagerext,cm			
 			}
-		}
-		
+		}		
 		CleanupStack::PopAndDestroy(profileUtil);
 	}
 }