void CIAPConnectEngine::SetConnectionPreferences(TInt aBearer,
TBool aDialog, TUint32 aIapId)
{
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;
pref.iRanking = 1;
pref.iDirection = ECommDbConnectionDirectionOutgoing;
aDialog ? pref.iDialogPref = ECommDbDialogPrefPrompt : pref.iDialogPref = ECommDbDialogPrefDoNotPrompt;
CCommsDbConnectionPrefTableView::TCommDbIapBearer bearer;
bearer.iBearerSet = aBearer;
bearer.iIapId = aIapId;
pref.iBearer = bearer;
iPref = pref;
}
或者
RHTTPSession iSession;
RHTTPTransaction iTransaction;
TCommDbConnPref iPref;
RConnection iConnection;
RSocketServ iSocketServ;
TInt IAPId = 1;
User::LeaveIfError(iSocketServ.Connect());
User::LeaveIfError(iConnection.Open(iSocketServ));
iPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
iPref.SetIapId(IAPId);
iPref.SetBearerSet(KCommDbBearerPSD);
iPref.SetDirection(ECommDbConnectionDirectionOutgoing);
TInt ret;
if( ( ret = iConnection.Start(iPref)) != KErrNone)
{
...
}
TRAPD(err, iSession.OpenL());