diff -r 2c8580950a26 -r 5d0ec111abfc syncmlfw/common/syncagent/src/NSmlAgentBase.cpp --- a/syncmlfw/common/syncagent/src/NSmlAgentBase.cpp Fri May 14 16:42:50 2010 +0300 +++ b/syncmlfw/common/syncagent/src/NSmlAgentBase.cpp Thu May 27 13:43:36 2010 +0300 @@ -49,10 +49,10 @@ #include // RConnection RSocket #include // TConnectionInfo #include -#include -#include -#include -#include +#include +#include +#include +#include #include "nsmlhttp.h" //Fix to Remove the Bad Compiler Warnings @@ -450,7 +450,7 @@ //Auto_Restart iPacketDataUnAvailable = EFalse; iNetmonAPId = 0; - iNetmonAPBearerType = TApBearerType(-1); + iAllowAutoRestart = EFalse; } @@ -957,7 +957,6 @@ if(error == KErrNone && val == 1) { - DBG_FILE_CODE(iNetmonAPBearerType, _S8("CNSmlAgentBase::SendingStateL The Network Bearer Type is")); DBG_FILE_CODE(err, _S8("CNSmlAgentBase::SendingStateL The Network Error is")); if(err == TNSmlHTTPErrCode::ENSmlHTTPErr_RequestTimeout) @@ -970,8 +969,7 @@ LaunchAutoRestartL(err); } - else if(iNetmonAPBearerType == EApBearerTypeGPRS || - iNetmonAPBearerType == EApBearerTypeCDMA ) + else if( iAllowAutoRestart ) { DBG_FILE(_S8("CNSmlAgentBase::SendingStateL Waiting for 30 sec")); User::After(TTimeIntervalMicroSeconds32(30000000)); @@ -1604,74 +1602,29 @@ connectionInfo ); iNetmonAPId = connectionInfo().iIapId; DBG_FILE_CODE(iNetmonAPId, _S8("CNSmlAgentBase::ReadAcessPointL(), The IAPId is:")); - iNetmonAPBearerType = CheckAPBearerTypeL( iNetmonAPId ); - DBG_FILE_CODE(TInt(iNetmonAPBearerType), _S8("CNSmlAgentBase::ReadAcessPointL(), The Enumerated IAPId is:")); - - } + RCmManager cmmanager; + cmmanager.OpenL(); + CleanupClosePushL(cmmanager); + RCmConnectionMethod cm; + cm = cmmanager.ConnectionMethodL( iNetmonAPId ); + CleanupClosePushL( cm ); + TUint32 bearer = 0; + //TRAP_IGNORE( accesspointId = cm.GetIntAttributeL(CMManager::ECmIapId) );? + bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); + CleanupStack::PopAndDestroy( 2 ); //cmmanager,cm + if ( bearer == KUidWlanBearerType ) + { + iAllowAutoRestart = EFalse; + } + else + { + iAllowAutoRestart = ETrue; + } + } myConnection.Close(); socketServer.Close(); } - -// ----------------------------------------------------------------------------- -// CNSmlAgentBase::CheckAPBearerTypeL -// Returns bearer type of the selected Access Point. -// ----------------------------------------------------------------------------- -EXPORT_C TApBearerType CNSmlAgentBase::CheckAPBearerTypeL( const TUint32 aIAPId ) -{ - // Create connection to the Access Points setting data. - CCommsDatabase* cAPCommsDatabase = CCommsDatabase::NewL( EDatabaseTypeIAP ); - - TApBearerType bearerType(TApBearerType(-1)); - - // Attach to the Access Point Engine. - CApSelect* apSelect = CApSelect::NewLC( - *cAPCommsDatabase, - KEApIspTypeAll, - EApBearerTypeWLAN | - EApBearerTypeCDMA | - EApBearerTypeGPRS, - KEApSortUidAscending, - EIPv4 | EIPv6 - ); - - // Create ApUtils for some utilities functions. - CApUtils* apUtils = CApUtils::NewLC( *cAPCommsDatabase ); - - // Get supported Access Points from Access Point Engine.. - CApListItemList* apItems = new (ELeave) CApListItemList; - CleanupStack::PushL( apItems ); - apSelect->AllListItemDataL( *apItems ); - - for ( TInt i = 0; i < apItems->Count(); i++ ) - { - // Get id from APEngine and convert it to the CommsDB id. - TUint32 iapId = apUtils->IapIdFromWapIdL( apItems->At( i )->Uid() ); - - // Change bearer type according to id match. - if ( aIAPId == iapId ) - { - bearerType = apItems->At( i )->BearerType(); - - //Getting the IAP name - const TDesC& name = apItems->At( i )->Name(); - - DBG_ARGS(_S("CNSmlAgentBase::CheckAPBearerTypeL(), The IAP Name is: %S"), &name); - - i = apItems->Count(); - } - } - - // PopAndDestroy some items. - CleanupStack::PopAndDestroy( apItems ); - CleanupStack::PopAndDestroy( apUtils ); - CleanupStack::PopAndDestroy( apSelect ); - - delete cAPCommsDatabase; - - // Return bearer type. - return bearerType; -} //RD_AUTO_RESTART // ---------------------------------------------------------