--- a/webservices/wscore/src/senmobilityobserver.cpp Tue Feb 02 00:57:16 2010 +0200
+++ b/webservices/wscore/src/senmobilityobserver.cpp Fri Mar 19 09:52:55 2010 +0200
@@ -18,17 +18,14 @@
// INCLUDE FILES
-#include <connpref.h>
-#include <commdbconnpref.h>
+
#include "senmobilityobserver.h"
-#include "sentransportproperties.h"
-#include "senwspattern.h"
-#include "msenproperties.h"
-#include "senlayeredtransportproperties.h"
-#include "senlogger.h"
-#include "senservicemanagerdefines.h"
-#include <versioninfo.h> // VersionInfo
-#include <extendedconnpref.h>
+#include <SenTransportProperties.h>
+#include "SenWSPattern.h"
+#include "MSenProperties.h"
+#include "SenLayeredTransportProperties.h"
+#include "SenLogger.h"
+#include "SenServiceManagerDefines.h"
// -----------------------------------------------------------------------------
// CALRObserver::NewL
@@ -67,7 +64,6 @@
#endif
User::LeaveIfError( iSocketServer.Connect());
TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "CALRObserver::ConstructL()");
- IsOCCImplementedSDK();
}
// -----------------------------------------------------------------------------
@@ -80,8 +76,7 @@
iIapId(0),
iNewIapId(0),
iSnapId(0),
- iReader(aReader),
- iOCCenabled(EFalse)
+ iReader(aReader)
{
CActiveScheduler::Add( this );
}
@@ -144,59 +139,8 @@
//RunL status error: " ) );
User::Leave(iStatus.Int()) ;
}
- }
-
-// On return, aMajor and aMinor contain the version information
-TBool CALRObserver::IsOCCImplementedSDK()
- {
- TBool occ = EFalse;
- // Obtain the version number
- TUint major;
- TUint minor;
- TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("CSenHttpChannelImpl::IsOCCImplementedSDK()")));
- TInt ret = GetS60PlatformVersion(major, minor);
- if (ret == KErrNone)
- {
- if(major == 5 && minor == 2)
- {
- occ = ETrue;
- iOCCenabled = ETrue;
- TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("---- IsOCCImplementedSDK() returns TRUE")));
- }
- else
- {
- TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("---- IsOCCImplementedSDK() returns False")));
- }
- }
- return occ;
- }
-
-// On return, aMajor and aMinor contain the version information
-TInt CALRObserver::GetS60PlatformVersion(TUint& aMajor, TUint& aMinor)
- {
- TInt ret = KErrNone;
- // Connect to the file server session
- RFs fsSession;
- TLSLOG(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel,(_L("CSenHttpChannelImpl::GetS60PlatformVersion()")));
- ret = fsSession.Connect();
- if(ret == KErrNone)
- {
- CleanupClosePushL(fsSession); // Obtain the version numberTUint major;
- VersionInfo::TPlatformVersion platformVersion;
- TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "--- GetS60PlatformVersion getting Version info");
- ret = VersionInfo::GetVersion(platformVersion, fsSession);
- CleanupStack::PopAndDestroy(); // fsSession
- if (ret == KErrNone)
- {
- aMajor = platformVersion.iMajorVersion;
- aMinor = platformVersion.iMinorVersion;
- TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("--- GetS60PlatformVersion Version: Major [%d], Minor[%d]"), aMajor, aMinor));
- }
- }
- TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("--- GetS60PlatformVersion returns [%d]"), ret));
- return ret;
- }
-
+ }
+
// -----------------------------------------------------------------------------
// CALRObserver::RunError
// -----------------------------------------------------------------------------
@@ -418,7 +362,7 @@
TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get SNAPID from pTransportProperties ");
TInt error = pTransportProperties->SnapIdL(id) ;
- if(error || id >= (TUint)KErrNotFound) //SNAP not found
+ if(error || id >= (TUint)KErrNotFound) //
{
TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get IAPID from pTransportProperties ");
error = pTransportProperties->IapIdL(id);
@@ -428,7 +372,7 @@
isSnap = ETrue ;
}
- if(error || id >= (TUint)KErrNotFound) //IAP also not found
+ if(error || id >= (TUint)KErrNotFound)
{
//Application Did not provide IAP ID through transport properties
//Now we need to check consumer and provider policy of service description
@@ -440,7 +384,7 @@
CSenWSPattern* pConsumerPolicy = (CSenWSPattern*)&aInitializer;
TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get SNAPID from pConsumerPolicy ");
error = pConsumerPolicy->ConsumerSnapId( id );
- if(error || id >= (TUint)KErrNotFound) //SNAP not found
+ if(error || id >= (TUint)KErrNotFound)
{
TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- trying to get IAPID from pConsumerPolicy ");
error = pConsumerPolicy->ConsumerIapId( id );
@@ -500,11 +444,6 @@
{
//check with first Snapid
isStartConnectionRequired = ETrue ;
- if(iOCCenabled != EFalse)
- {
- isSnap = ETrue; //We must start with SNAP for OCC
- TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- isSnap Modified for OCC Support ");
- }
TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- StartConnection required as (iIapId == 0 && iSnapId == 0) openId = %d, isSnap = %d, iIapId = %d and iSnapId = %d "), openId, isSnap, iIapId, iSnapId));
}
else if(isSnap != EFalse && openId != iSnapId)
@@ -555,146 +494,6 @@
TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::OpenConnectionL returnd %d "), error));
return error ;
}
-
-TInt CALRObserver::SetID(TUint32 aId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer, TBool aSNAP)
- {
- /*
- * Single click connectivity feature has been implemented by CSock (RConnection class).
- * According to this client no need to set the IAP ID.
- * Automatically RConnection will use the suitable IAP
- */
- TInt retVal = KErrNone;
- TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("CSenHttpChannelImpl called with ID [%d]"), aId));
-
- if (iOCCenabled == EFalse)
- {
- if(aSNAP != EFalse && aId)
- {
- TConnSnapPref SNAPPrefs;
- iSnapId = aId ;
- SNAPPrefs.SetSnap( aId );
- // Start connecting with Snap
- retVal = iConnection.Start(SNAPPrefs);
- TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection Started with SNAP");
- }
- else //default is iap
- {
- if( aId )
- {
- TCommDbConnPref iapPrefs ;
- iapPrefs.SetIapId( aId );
- iapPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
- TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::SetDialogPref is FALSE");
- //iapPrefs.SetDialogPreference( ECommDbDialogPrefPrompt );
- // Start connecting with IAP
- retVal = iConnection.Start(iapPrefs);
- TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::StartConnection connection started with iapid %d and preference"), aId));
- }
- else
- {
- if (iIapId != 0)
- {
- //OpenSocketSever is already called for this iIapId When multiple
- //sendL are calld for the same IAPId StartConnection may be called
- //unintentionaly and may create crash
- //strange case StartConnection must not be called in this case
- TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection StartConnection must not be called as aId == 0 and iIapId != 0");
- }
- else
- {
- //Using Default Connection
- TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection started Using Default Connection");
- retVal = iConnection.Start();
- }
- }
- }
- }
- else
- {
- if (aSNAP == EFalse)
- {
- /* If IAP id is zero, it is interpreted as
- * client's request for not requesting any specific IAP.
- * Default value is 0.
- *
- * If IAP id is set, SNAP id shall be zero.
- * If IAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
- * If IAP id is set, Connection selection dialog shall be disabled.
- * If IAP id is set, bearer set shall be EExtendedConnBearerUnknown.
- * If IAP id is set, forced roaming is disabled automatically.
- * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
- * selection dialog shall be enabled.
- */
-
- TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC with IAP Settings");
- TConnPrefList prefList;
- TExtendedConnPref extPrefs;
- //extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
- //TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC Silent Connection");
- //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
- //extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
- extPrefs.SetIapId(aId);
- extPrefs.SetSnapId(0);
- prefList.AppendL(&extPrefs);
- retVal = aConnection.Start(prefList);
- if(retVal == KErrNone)
- {
- iIapId = aId;
- }
- else
- {
- TLSLOG_FORMAT((KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, _L8("IAP ->Start retVal [%d]"), retVal));
- }
- }
- else
- {
- /**
- * Sets SNAP id. If SNAP id is zero, it is interpreted as
- * client's request for not requesting any specific SNAP.
- * Default value is 0.
- *
- * If SNAP id is set, IAP id shall be zero.
- * If SNAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
- * If SNAP id is set, Connection selection dialog shall be disabled.
- * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
- * selection dialog shall be enabled.
- */
- TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC with SNAP Settings");
- TConnPrefList prefList;
- TExtendedConnPref extPrefs;
- //extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
- //TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting up OCC Silent Connection");
- //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
- //extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
- if(aId == 0)
- {
- TLSLOG_L(KSenSenMobilityLogChannelBase , KSenSenMobilityLogLevel, "- Setting SnapPurpose Internet");
- if(aDialogPref) //If it fails because of unavailibility of access points
- {
- extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
- extPrefs.SetConnSelectionDialog(ETrue);
- }
- else
- {
- extPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet);
- //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
- }
- }
- else
- {
- extPrefs.SetSnapId(aId);
- extPrefs.SetIapId(0);
- extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
- extPrefs.SetConnSelectionDialog(EFalse);
- }
- prefList.AppendL(&extPrefs);
- retVal = aConnection.Start(prefList);
- }
- }
-
- return retVal;
- }
-
// -----------------------------------------------------------------------------
// CALRObserver::StartConnection
// -----------------------------------------------------------------------------
@@ -730,13 +529,45 @@
TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection closed as new SNAPID for the same connection");
}
}
-
- errRet = OpenSocketSever();
-
+ errRet = OpenSocketSever();
if (!errRet)
{
- errRet = SetID(aId, EFalse, iConnection, iSocketServer, aIsSnapId);
-
+ if(aIsSnapId != EFalse && aId)
+ {
+ iSnapId = aId ;
+ iSNAPPrefs.SetSnap( aId );
+ // Start connecting with Snap
+ errRet = iConnection.Start(iSNAPPrefs);
+ TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection iConnection Started with SNAP");
+ }
+ else //default is iap
+ {
+ if( aId )
+ {
+ iPrefs.SetIapId( aId );
+ SetDialogPref(EFalse) ;
+ // Start connecting with IAP
+ errRet = iConnection.Start(iPrefs);
+ TLSLOG_FORMAT((KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , _L8("- CALRObserver::StartConnection connection started with iapid %d and preference"), aId));
+ }
+ else
+ {
+ if (iIapId != 0)
+ {
+ //OpenSocketSever is already called for this iIapId When multiple
+ //sendL are calld for the same IAPId StartConnection may be called
+ //unintentionaly and may create crash
+ //strange case StartConnection must not be called in this case
+ TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection StartConnection must not be called as aId == 0 and iIapId != 0");
+ }
+ else
+ {
+ //Using Default Connection
+ TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::StartConnection connection started Using Default Connection");
+ errRet = iConnection.Start();
+ }
+ }
+ }
if (errRet == KErrNone)
{
//iConnection.GetIntSetting( _L( "IAP\\Id" ), aId );
@@ -755,6 +586,20 @@
return errRet;
}
+void CALRObserver::SetDialogPref(TBool aDialogPref)
+ {
+ if (aDialogPref == EFalse)
+ {
+ TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel , "- CALRObserver::SetDialogPref is FALSE");
+ iPrefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
+ }
+ else
+ {
+ TLSLOG_L(KSenSenMobilityLogChannelBase, KSenSenMobilityLogLevel ,"- CALRObserver::SetDialogPref is TRUE");
+ iPrefs.SetDialogPreference( ECommDbDialogPrefPrompt );
+ }
+ }
+
// -----------------------------------------------------------------------------
// CALRObserver::RefreshAvailability
// -----------------------------------------------------------------------------
--- a/webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp Tue Feb 02 00:57:16 2010 +0200
+++ b/webservices/wshttpchanneltransportplugin/src/senhttpchannelimpl.cpp Fri Mar 19 09:52:55 2010 +0200
@@ -31,10 +31,10 @@
#include <http.h>
#include "sendebug.h" // filelogging and debugging MACROS
-#include "senserviceconnection.h" // KErrSenNoHttpResponseBody
-#include "senelement.h"
-#include "senxmlutils.h"
-#include "senhttptransportproperties.h"
+#include <SenServiceConnection.h> // KErrSenNoHttpResponseBody
+#include <SenElement.h>
+#include <SenXmlUtils.h>
+#include <SenHttpTransportProperties.h>
#include "senhttpchannelimpl.h"
#include "senhttpeventhandler.h"
#include "sentxnstate.h"
@@ -47,15 +47,10 @@
#include "senhttpchanneltransportplugin.h"
//For HTTPProxyFilter
-#include <httpfilterproxyinterface.h>
-#include <httpfilteracceptheaderinterface.h>
-#include <httpfiltercommonstringsext.h>
-#include <deflatefilterinterface.h>
-
-#ifndef __ENABLE_ALR__
-#include <versioninfo.h> // VersionInfo
-#include <extendedconnpref.h>
-#endif
+#include <HttpFilterProxyInterface.h>
+#include <HttpFilterAcceptHeaderInterface.h>
+#include <HttpFilterCommonStringsExt.h>
+#include <DeflateFilterInterface.h>
// CONSTANTS
namespace
@@ -90,11 +85,7 @@
iProxyHostPort(NULL),
iXopResponse(EFalse),
iHasHttpContentType(ETrue)
-#ifndef __ENABLE_ALR__
- , iOCCenabled(EFalse)
-#endif
{
-// IsOCCImplementedSDK();
}
CSenHttpChannelImpl* CSenHttpChannelImpl::NewL(MSenIdentityManager& aManager)
@@ -129,59 +120,6 @@
return pNew;
}
-#ifndef __ENABLE_ALR__
-// On return, aMajor and aMinor contain the version information
-TInt CSenHttpChannelImpl::GetS60PlatformVersion(TUint& aMajor, TUint& aMinor)
- {
- TInt ret = KErrNone;
- // Connect to the file server session
- RFs fsSession;
- TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::GetS60PlatformVersion()")));
- ret = fsSession.Connect();
- if(ret == KErrNone)
- {
- CleanupClosePushL(fsSession); // Obtain the version numberTUint major;
- VersionInfo::TPlatformVersion platformVersion;
- TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "--- GetS60PlatformVersion getting Version info");
- ret = VersionInfo::GetVersion(platformVersion, fsSession);
- CleanupStack::PopAndDestroy(); // fsSession
- if (ret == KErrNone)
- {
- aMajor = platformVersion.iMajorVersion;
- aMinor = platformVersion.iMinorVersion;
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("--- GetS60PlatformVersion Version: Major [%d], Minor[%d]"), aMajor, aMinor));
- }
- }
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("--- GetS60PlatformVersion returns [%d]"), ret));
- return ret;
- }
-
-// On return, aMajor and aMinor contain the version information
-TBool CSenHttpChannelImpl::IsOCCImplementedSDK()
- {
- TBool occ = EFalse;
- // Obtain the version number
- TUint major;
- TUint minor;
- TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("CSenHttpChannelImpl::IsOCCImplementedSDK()")));
- TInt ret = GetS60PlatformVersion(major, minor);
- if (ret == KErrNone)
- {
- if(major == 5 && minor == 2)
- {
- occ = ETrue;
- iOCCenabled = ETrue;
- TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("---- IsOCCImplementedSDK() returns TRUE")));
- }
- else
- {
- TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("---- IsOCCImplementedSDK() returns False")));
- }
- }
- return occ;
- }
-#endif
-
// Ask IAP from user
void CSenHttpChannelImpl::ConstructL()
{
@@ -224,10 +162,6 @@
new (ELeave) CArrayPtrFlat<CSenTxnState>(KMinimumArrayGranularity);
iBasicConnectionTries = 0;
-
-#ifndef __ENABLE_ALR__
- IsOCCImplementedSDK();
-#endif
#ifdef _SENDEBUG
ListFilters();
@@ -249,9 +183,6 @@
// Use local variable (new RSocketServer each time; handle is given to RHTTPSession via RConnectionInfo..)
// RSocketServ server; // with "anon" (local) socket servers, should we keep array of open ones in case of pending txns?
// SetIapPrefsL(aIapId, iConnection, server);
-#ifndef __ENABLE_ALR__
- IsOCCImplementedSDK();
-#endif
const TInt result = SetIapPrefsL(aIapId, ETrue, iConnection, iSockServ);
User::LeaveIfError( result );
@@ -298,9 +229,163 @@
TLSLOG_CLOSE(KSenHttpChannelLogChannelBase);
}
+// This function expects that RConnection has been connected
+// and that RConnection has already been opened!
+/*
+void CSenHttpChannelImpl::SetIapPrefsL(TUint32 aIapId,
+ RConnection& aConnection,
+ RSocketServ& aSocketServer)
+ {
+ // Check whether IAP ID is not equal with the one that is currently in effect:
+ if(iExplicitIapDefined && iIapId == aIapId )
+ {
+ return; // nothing to do
+ }
+
+ LOG_WRITEFORMAT((_L8("- SetIapPrefsL: Re-setting IAP ID (%d)"), aIapId));
+
+ // Check if socket server (connection) is already open..
+ if( iExplicitIapDefined )
+ {
+ // Socket server opened once before for some other IAP
+ LOG_WRITE_L("- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
+ aConnection.Stop();
+ }
+ else
+ {
+ aConnection.Stop(); // prompted from user
+ iSess.DisconnectL();
+ iSess.ConnectL();
+
+ // Connect to a socket server
+ LOG_WRITE_L("- SetIapPrefsL: Connecting to new socket server");
+ User::LeaveIfError(aSocketServer.Connect());
+
+ // Open new connection
+ LOG_WRITE_L("- SetIapPrefsL: Opening new RConnection using the socket server.");
+ User::LeaveIfError(aConnection.Open(aSocketServer));
+ }
+
+ // Set the IAP selection preferences (IAP ID, do not prompt)
+ TCommDbConnPref pref;
+ pref.SetIapId( aIapId );
+
+ TCommDbDialogPref dialogPref;
+ dialogPref = ECommDbDialogPrefDoNotPrompt;
+ pref.SetDialogPreference(dialogPref);
+
+ // Start the connection with the new preferences
+ LOG_WRITE_L("- SetIapPrefsL: Calling RConnection::Start with new IAP prefs");
+ aConnection.Start(pref);
+
+ // Get the connection "handle" from the HTTP session
+ RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
+
+ // Attach socket server
+ connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketServ,
+ RHTTPSession::GetTable()),
+ THTTPHdrVal(aSocketServer.Handle()));
+
+ // Attach connection
+ TInt connPtr = REINTERPRET_CAST(TInt, &aConnection);
+ connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketConnection,
+ RHTTPSession::GetTable()),
+ THTTPHdrVal(connPtr));
+
+ // Remember the IAP id that is being set; there is
+ // no direct API to query effective IAP ID from CommsDB.
+ iExplicitIapDefined = ETrue;
+ iIapId = aIapId;
+ }
+*/
+
+
+/*
+void CSenHttpChannelImpl::SetupConnectionWithIapPrefsL( TUint32 aIapId,
+ RConnection& aConnection,
+ RSocketServ& aSocketServer )
+ {
+ // Check whether IAP ID is not equal with the one that is currently in effect:
+ if(iExplicitIapDefined && iIapId == aIapId )
+ {
+ return; // nothing to do
+ }
+
+ LOG_WRITEFORMAT((_L8("- SetIapPrefsL, IAP ID (%d)"), aIapId));
+
+ // Check if socket server (connection) is already open..
+ if( iExplicitIapDefined )
+ {
+ // Socket server opened once before for some other IAP
+ LOG_WRITE_L("- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop");
+ aConnection.Stop();
+ }
+ else
+ {
+ // Connect to a socket server
+ LOG_WRITE_L("- SetIapPrefsL: Connecting to new socket server");
+ User::LeaveIfError( aSocketServer.Connect() );
+
+ // Open new connection
+ LOG_WRITE_L("- SetIapPrefsL: Opening new RConnection using the socket server.");
+ User::LeaveIfError( aConnection.Open(aSocketServer) );
+ }
+
+ // Set the IAP selection preferences (IAP ID, do not prompt)
+ TCommDbConnPref pref;
+ pref.SetIapId( aIapId );
+
+ TCommDbDialogPref dialogPref;
+ dialogPref = ECommDbDialogPrefDoNotPrompt;
+ pref.SetDialogPreference(dialogPref);
+
+ // Start the connection with the new preferences
+ LOG_WRITE_L("- SetIapPrefsL: Calling RConnection::Start with new IAP prefs");
+ aConnection.Start(pref);
+ }
+
+
+void CSenHttpChannelImpl::AttachSocketServerAndConnectionWithHttpSession( TUint32 aIapId,
+ RConnection& aConnection,
+ RSocketServ& aSocketServer )
+ {
+ if(iExplicitIapDefined && iIapId == aIapId )
+ {
+ return; // nothing to do
+ }
+
+ // Get the connection "handle" from the HTTP session
+ RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
+
+ // Attach socket server
+ connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketServ,
+ RHTTPSession::GetTable()),
+ THTTPHdrVal(aSocketServer.Handle()));
+
+ // Attach connection
+ TInt connPtr = REINTERPRET_CAST(TInt, &aConnection);
+ connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketConnection,
+ RHTTPSession::GetTable()),
+ THTTPHdrVal(connPtr));
+
+ // Remember the IAP id that is being set, because *at the moment*,
+ // there is NO direct API to query effective IAP ID from CommsDB.
+ iExplicitIapDefined = ETrue;
+ iIapId = aIapId;
+ }
+
+
+void CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, RConnection& aConnection, RSocketServ& aSocketServer )
+ {
+ SetupConnectionWithIapPrefsL( aIapId, aConnection, aSocketServer );
+ AttachSocketServerAndConnectionWithHttpSession( aIapId, aConnection, aSocketServer );
+ }
+*/
+
+
TInt CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
{
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KNormalLogLevel, _L8("- SetIapPrefsL , IAP ID (%d)"), aIapId));
+ TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KNormalLogLevel, _L8("- SetIapPrefsL, IAP ID (%d)"), aIapId));
// Check whether IAP ID is not equal with the one that is currently in effect:
if(iExplicitIapDefined && iIapId == aIapId )
@@ -308,10 +393,10 @@
TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id is same as currently in effect");
return KErrNone;
}
- else
- {
- TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id different with the currently in effect");
- }
+ else
+ {
+ TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id different with the currently in effect");
+ }
// Check if socket server (connection) is already open..
@@ -332,9 +417,39 @@
User::LeaveIfError( aConnection.Open(aSocketServer) );
}
- // Set the IAP selection preferences (IAP ID, do not prompt)
- TInt retVal = SetID(aIapId, aDialogPref, aConnection, aSocketServer);
-
+ // Set the IAP selection preferences (IAP ID, do not prompt)
+ /*
+ *Single click connectivity feature has been implemented by CSock (RConnection class).
+ *According to this client no need to set the IAP ID.
+ *Automatically RConnection will use the suitable IAP
+ */
+
+
+ TCommDbConnPref pref;
+ #ifndef __SINGLE_CLICK_CONNECTIVITY_ENABLED__
+ pref.SetIapId( aIapId );
+ #else
+ pref.SetIapId( 0 ); //By default IAP ID is "0". IAP selection will take care by RConnection
+ #endif //__SINGLE_CLICK_CONNECTIVITY_ENABLED__
+ TCommDbDialogPref dialogPref;
+
+ if (aDialogPref)
+ {
+ dialogPref = ECommDbDialogPrefDoNotPrompt;
+ }
+ else
+ {
+ dialogPref = ECommDbDialogPrefPrompt;
+ }
+ pref.SetDialogPreference(dialogPref);
+
+ // Start the connection with the new preferences
+ TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Calling RConnection::Start with new IAP prefs");
+
+ TInt retVal =aConnection.Start(pref);
+
+ TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection->Start retVal [%d]"), retVal));
+
// Get the connection "handle" from the HTTP session
RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
@@ -347,160 +462,24 @@
TInt connPtr = REINTERPRET_CAST(TInt, &aConnection);
connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketConnection,
RHTTPSession::GetTable()),
- THTTPHdrVal(connPtr));
+ THTTPHdrVal(connPtr));
+
+ // Remember the IAP id that is being set, because *at the moment*,
+ // there is NO direct API to query effective IAP ID from CommsDB.
+ if (!retVal)
+ {
+ #ifdef __SINGLE_CLICK_CONNECTIVITY_ENABLED__
+ //Since we are using by default setIapId "0".
+ //There won't be any explicitly defined Iap Id
+ iExplicitIapDefined = EFalse;
+ iIapId = 0;
+ #else
+ iExplicitIapDefined = ETrue;
+ iIapId = aIapId;
+ #endif //__SINGLE_CLICK_CONNECTIVITY_ENABLED__
+ }
return retVal;
}
-
-TInt CSenHttpChannelImpl::SetID(TUint32 aId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer, TBool aSNAP)
-{
- /*
- * Single click connectivity feature has been implemented by CSock (RConnection class).
- * According to this client no need to set the IAP ID.
- * Automatically RConnection will use the suitable IAP
- */
- TInt retVal = KErrNone;
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl called with ID [%d]"), aId));
-
-#ifndef __ENABLE_ALR__
- if (iOCCenabled == EFalse)
- {
-#endif
- if (aSNAP == EFalse)
- {
- TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- SetIAPID");
- TCommDbConnPref pref;
- pref.SetIapId( aId );
- TCommDbDialogPref dialogPref;
- if (aDialogPref)
- {
- dialogPref = ECommDbDialogPrefDoNotPrompt;
- }
- else
- {
- dialogPref = ECommDbDialogPrefPrompt;
- }
- pref.SetDialogPreference(dialogPref);
- retVal = aConnection.Start(pref);
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection->Start retVal [%d]"), retVal));
- }
- else
- {
- TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- SetSNAPID");
- // Set the SNAP selection preferences (SNAP ID)
- TConnSnapPref pref;
- pref.SetSnap(aId);
- // Start the connection with the new preferences
- TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Calling RConnection::Start with new SNAP prefs");
- TInt retVal = aConnection.Start(pref);
- }
-#ifndef __ENABLE_ALR__
- }
- else
- {
- if (aSNAP == EFalse)
- {
- /* If IAP id is zero, it is interpreted as
- * client's request for not requesting any specific IAP.
- * Default value is 0.
- *
- * If IAP id is set, SNAP id shall be zero.
- * If IAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
- * If IAP id is set, Connection selection dialog shall be disabled.
- * If IAP id is set, bearer set shall be EExtendedConnBearerUnknown.
- * If IAP id is set, forced roaming is disabled automatically.
- * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
- * selection dialog shall be enabled.
- */
-
- TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC with IAP Settings");
- TConnPrefList prefList;
- TExtendedConnPref extPrefs;
- //extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
- //TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC Silent Connection");
- //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
- //extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
- extPrefs.SetIapId(aId);
- extPrefs.SetSnapId(0);
- prefList.AppendL(&extPrefs);
- retVal = aConnection.Start(prefList);
- if(retVal == KErrNone)
- {
- iIapId = aId;
- }
- else
- {
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP ->Start retVal [%d]"), retVal));
- }
- }
- else
- {
- /**
- * Sets SNAP id. If SNAP id is zero, it is interpreted as
- * client's request for not requesting any specific SNAP.
- * Default value is 0.
- *
- * If SNAP id is set, IAP id shall be zero.
- * If SNAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
- * If SNAP id is set, Connection selection dialog shall be disabled.
- * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
- * selection dialog shall be enabled.
- */
- TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC with SNAP Settings");
- TConnPrefList prefList;
- TExtendedConnPref extPrefs;
- //extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown);
- //TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC Silent Connection");
- //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
- //extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown);
- if(aId == 0)
- {
- TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting SnapPurpose Internet");
- if(aDialogPref) //If it fails because of unavailibility of access points
- {
- extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
- extPrefs.SetConnSelectionDialog(ETrue);
- }
- else
- {
- extPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet);
- //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
- }
- }
- else
- {
- extPrefs.SetSnapId(aId);
- extPrefs.SetIapId(0);
- extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown);
- extPrefs.SetConnSelectionDialog(EFalse);
- }
- prefList.AppendL(&extPrefs);
- retVal = aConnection.Start(prefList);
-
- if(retVal == KErrNone)
- {
- aConnection.GetIntSetting( _L("IAP\\Id"), iIapId);
- TName name;
- retVal = aConnection.Name(name);
- if(retVal == KErrNone)
- {
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP Name [%S]"), &name));
- }
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("GetIntSetting returned IAP [%d]"), iIapId));
- }
- else
- {
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("SNAP ->Start retVal [%d]"), retVal));
- }
- }
- }
-#endif
- if (!retVal)
- {
- iExplicitIapDefined = ETrue;
- }
- return retVal;
-}
-
TInt CSenHttpChannelImpl::SetSnapPrefsL( TUint32 aSnapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer )
{
TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- CSenHttpChannelImpl::SetSnapPrefsL, SNAP ID (%d)"), aSnapId));
@@ -514,7 +493,7 @@
{
TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Sanp is different with currently in effect");
}
-
+
// Check if socket server (connection) is already open..
if( iExplicitIapDefined )
{
@@ -533,10 +512,13 @@
User::LeaveIfError( aConnection.Open(aSocketServer) );
}
-
- // Set the SNAP selection preferences (SNAP ID, do not prompt)
- TInt retVal = SetID(aSnapId, aDialogPref, aConnection, aSocketServer, ETrue);
+ // Set the SNAP selection preferences (SNAP ID)
+ TConnSnapPref pref;
+ pref.SetSnap(aSnapId);
+ // Start the connection with the new preferences
+ TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Calling RConnection::Start with new SNAP prefs");
+ TInt retVal = aConnection.Start(pref);
TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- SetSnapPrefsL, RConnection::Start returned: (%d)"), retVal));
// Get the connection "handle" from the HTTP session
@@ -687,56 +669,42 @@
RStringF method;
TPtrC8 deflate;
// Set IAP preferences, if such exist in properties (and not already in effect):
- TUint32 id(KErrNone);
- TBool prompt(ETrue);
+ TUint32 iapId(KErrNone);
+ TBool doNotPrompt(ETrue);
- TInt retVal = aProps.IAPDialogL( prompt );
+ TInt retVal = aProps.IAPDialogL( doNotPrompt );
if ( retVal != KErrNone )
{
// by default, do not prompt (even if property does not exist!)
// => only if property is set, and has value "FALSE", show PROMPT
- prompt = ETrue;
+ doNotPrompt = ETrue;
}
-#ifndef __ENABLE_ALR__
// Independent of dialog preference (property's existance), if IAP was predefined, it must be set
- if(((aProps.IapIdL(id)) == KErrNone))
+ if(((aProps.IapIdL(iapId)) == KErrNone))
{
- retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ);
+ retVal = SetIapPrefsL(iapId, doNotPrompt, iConnection, iSockServ);
}
- else if(((aProps.SnapIdL(id)) == KErrNone))
+ else if(((aProps.SnapIdL(iapId)) == KErrNone))
{
- retVal = SetSnapPrefsL(id, prompt, iConnection, iSockServ);
+ retVal = SetSnapPrefsL(iapId, doNotPrompt, iConnection, iSockServ);
}
else//to better control RConnection, we have to call Start by ourselve
{
retVal = SetSnapPrefsL(0, EFalse, iConnection, iSockServ);
if(retVal == KErrNotFound)
{
- if(iOCCenabled == EFalse)
- {
- retVal = SetIapPrefsL(0, EFalse, iConnection, iSockServ);
- }
- else
- {
- retVal = SetSnapPrefsL(0, prompt, iConnection, iSockServ);
- }
+ retVal = SetIapPrefsL(0, EFalse, iConnection, iSockServ);
}
}
TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Set Snap/IAP prefs retVal [%d]"), retVal));
User::LeaveIfError(retVal);
TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL After User::Leave");
- TInt ret= iConnection.GetIntSetting(_L("IAP\\Id"), iUsedIapId);
+ TInt ret=iConnection.GetIntSetting(_L("IAP\\Id"), iUsedIapId);
// Check transport properties
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id));
-#else
- retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ);
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id));
- iUsedIapId = id;
-#endif
-
CSenLayeredHttpTransportProperties::TSenHttpMethod httpMethod;
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("PROMPT %d"), prompt));
+ TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP %d"), iapId));
+ TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("DONT PROMPT %d"), doNotPrompt));
TInt retValHttpMethod = aProps.HttpMethodL(httpMethod);
@@ -1909,20 +1877,17 @@
{
TInt handle = iConnection.SubSessionHandle();
if (handle>0)
- {
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): Current RConnection's subsession handle(%d)"), handle ));
- TUint connEnum(0);
- TInt err = iConnection.EnumerateConnections(connEnum);
- if (!err && !connEnum)
- {
- return EFalse;
- }
- }
- else
- {
- TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," -> RConnection has not been initialized.");
- }
+ {
+ TUint connEnum(0);
+ TInt err = iConnection.EnumerateConnections(connEnum);
+ if (!err && !connEnum)
+ {
+ return EFalse;
+ }
+ }
+ TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): Current RConnection's subsession handle(%d)"), iIapId ));
+#ifdef _SENDEBUG
if( iExplicitIapDefined )
{
TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8(" - IAP ID is known: %d"), iIapId ));
@@ -1931,16 +1896,23 @@
{
TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," - IAP ID is not known.");
}
-
+
+ if( handle < KErrNone )
+ {
+ TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," -> RConnection has not been initialized.");
+ }
+#endif // _SENDEBUG
+
if( handle && !iExplicitIapDefined )
{
// Eventhough IAP was not explicitely set (through Serene API), this
// code can check what IAP end-user provided via IAP selection dialog:
+ TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::EffectiveIapId: about to call RConnection::GetIntSetting()");
_LIT( KIapIdKey, "IAP\\Id" );
iConnection.GetIntSetting( KIapIdKey, iIapId);
if ( iIapId > 0 )
{
- TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("---- GetIntSetting(): retuens IAP(%d)"), iIapId ));
+ TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): end-user provided IAP(%d)"), iIapId ));
// Treat the end-user selection as "explicit" definition as well(!):
iExplicitIapDefined = ETrue;
}
@@ -1970,3 +1942,5 @@
return iUsedIapId;
}
// END OF FILE
+
+