Select Access Point

 // ====>> [Ver 3.01] by Figo.Yang ==========2007/11/14 19:31 ===>>>
 TUint32 cmnetIapId;
 _LIT(APN_CMNET, "cmnet");
 CCommsDatabase *commsDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
 CleanupStack::PushL(commsDb);
 CCommsDbTableView *tableView = commsDb->OpenTableLC(TPtrC(OUTGOING_GPRS));
 TInt err = tableView->GotoFirstRecord();
 while (err == KErrNone)
 {
  TBuf<KCommsDbSvrMaxColumnNameLength> apn;
  tableView->ReadTextL(TPtrC(GPRS_APN), apn);
  apn.LowerCase();
  if (apn.Compare(APN_CMNET) == 0)
  {
   tableView->ReadUintL(TPtrC(COMMDB_ID), cmnetIapId);
   break;
  }
  err = tableView->GotoNextRecord();
 }
 CleanupStack::PopAndDestroy(2, commsDb); // tableView, commsDb

 //
 // some time the iap id is not right. we need to convert it again.
 CCommsDatabase* commDb2 = CCommsDatabase::NewL(EDatabaseTypeIAP);
 CleanupStack::PushL(commDb2);
 CCommsDbTableView* pIAPView = commDb2->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(IAP_SERVICE), cmnetIapId);
 TInt nErr = pIAPView->GotoFirstRecord();
 if(nErr == KErrNone) {
  TRAPD(err, pIAPView->ReadUintL(TPtrC(COMMDB_ID), cmnetIapId));
  if(err != KErrNone)
   cmnetIapId = 0;
 }
 else
  cmnetIapId = 0;
 CleanupStack::PopAndDestroy(2);
// ====<< [Ver 3.01] by Figo.Yang ==========2007/11/14 19:31 ===<<<

// ====>> [Ver 3.01] by Figo.Yang ==========2007/11/14 20:07 ===>>>
 if( !iConnection.SubSessionHandle() )
  {
  User::LeaveIfError( iConnection.Open( iSocketServ ) );
  }
 
 TCommDbConnPref prefs;
 prefs.SetDialogPreference (ECommDbDialogPrefDoNotPrompt);
 prefs.SetDirection (ECommDbConnectionDirectionOutgoing);
 prefs.SetIapId (cmnetIapId);

 // Start an Outgoing Connection with overrides
 iConnection.Start(prefs);
// ====<< [Ver 3.01] by Figo.Yang ==========2007/11/14 20:07 ===<<< 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值