Default iap
Article Metadata
For selecting default IAP for 2nd and 3rd edition.
Hearders Required:
#include <Es_sock.h> //,RConnection ,RSocketServ
#include <Commdbconnpref.h> //TCommDbConnPref
#include <stringpool.h> //RStringPool
#include <http\rhttpconnectioninfo.h> //RHTTPConnectionInfo
Library required:
LIBRARY efsrv.lib //RSocketServ
LIBRARY esock.lib //RDbNamedDatabase,RDbView
LIBRARY bafl.lib //RStringPool
LIBRARY http.lib //RHTTPConnectionInfo
Source:
Place the code below after iSession.OpenL()
User::LeaveIfError(isockServ.Connect());
User::LeaveIfError(iconnection.Open(isockServ));
// TCommDbConnPref pref;
TUint32 m_Iap=0;
pref.SetIapId(m_Iap);
pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
pref.SetDirection(ECommDbConnectionDirectionOutgoing);
pref.SetBearerSet( ECommDbBearerGPRS | ECommDbBearerCdma2000
| ECommDbBearerLAN | ECommDbBearerCSD );
iconnection.Start(pref);
RStringPool strP = iSession.StringPool();
RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketServ,
RHTTPSession::GetTable() ), THTTPHdrVal (isockServ.Handle()) );
TInt connPtr = REINTERPRET_CAST(TInt, &iconnection);
connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketConnection,
RHTTPSession::GetTable() ), THTTPHdrVal (connPtr) );
Declare RSocketServ isockServ and RConnection iconnection as class members.


(no comments yet)