How can I establish internet (GPRS/UMTS) connection?
Login to reply to this topic.
Thu, 2007-03-08 10:41
Joined: 2005-11-16
Forum posts: 63
I use the following code for establishing a connection.
If there is no connection available it should prompt the selection of the internet access points otherwise it should use the already existing connection.
In the first case it promps the bluetooth selection. How can I avoid this?

The code is placed in a method of an active object.

Code:
void CConnectionStarter::ConstructL()
{
RConnection currentConnection;
TPckgBuf<TConnectionInfo> connectionInfo;
TCommDbConnPref prefs;
TUint count=0;

iConnection=new (ELeave) RConnection;
iSocketServ.Connect();

//open current connection
currentConnection.Open(iSocketServ);

//enumerate connections
currentConnection.EnumerateConnections(dwConnectionCount);

// check if there are current connections available
if (count < 1)
{
//open and start new connection
iConnection->Open(iSocketServ);
iConnection->Start(iStatus);
currentConnection.Close();
}
else
{
//get connection infos
currentConnection.GetConnectionInfo(1, connectionInfo);

// Create overrides
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
prefs.SetIapId(connectionInfo().iIapId);

//open a copy of the current connection
iConnection->Open(iSocketServ);

// Start an Outgoing Connection with overrides
iConnection->Start(prefs, iStatus);

currentConnection.Close();
}

SetActive();
}

I use UIQ3 SDK and Carbide.C++.

Any help would be great.

regards
Martin

copyright 2003-2009 NewLC SARL