如何在程序中选择接入点?
需求要求可以手动选择接入点或是在连网的时候选择接入点
这个应该怎么做?
--------------------编程问答-------------------- 1.手动选择接入点但是不联网:
自己遍历接入点数据库取得数据,然后自己画框框让用户选,保存用户选择的接入点ID,需要联网的时候不经用户提示就可以自动连
2.手动连接接入点并马上连:
RConnection.Start(TConnPref &aPref)即可,aPref中要指明需要弹框,并且不能指定接入点ID
具体的实现自己琢磨并Google --------------------编程问答-------------------- 终于有人回了...... --------------------编程问答-------------------- 你好 那手动选择接入点后弹出的页面 是自己加的列表还是可以使用系统的? --------------------编程问答-------------------- 是自己创建的,参考这个链接吧,里面说得很详细了
http://topic.csdn.net/u/20071128/13/4f5513c7-ba93-4c74-946e-545bfb4c242b.html
--------------------编程问答-------------------- 使用系统列表的关键点:
TCommDbConnPref connectPref;
// setup preferences
//connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt) ; //不提示用户
connectPref.SetDialogPreference(ECommDbDialogPrefPrompt); //提示用户
connectPref.SetDirection(ECommDbConnectionDirectionOutgoing) ;
connectPref.SetBearerSet(ECommDbBearerGPRS) ;
connectPref.SetIapId(iapId) ;
iConnection.Start(connectPref); --------------------编程问答-------------------- if( (aIapNameArray == NULL) || ( aIapUidArray == NULL ) )
return EFalse;
TUint32 iapId;
aIapUidArray->Reset();
aIapNameArray->Reset();
CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
CleanupStack::PushL(commDB);
CCommsDbTableView* tableView = commDB->OpenIAPTableViewMatchingBearerSetLC( ECommDbBearerGPRS, ECommDbConnectionDirectionOutgoing );
TInt retval;
retval = tableView->GotoFirstRecord();
while (retval == KErrNone)
{
// Read the service type.
HBufC* serviceType = tableView->ReadLongTextLC(TPtrC(IAP_SERVICE_TYPE));
// Read the service id
TUint32 ispId;
tableView->ReadUintL(TPtrC(IAP_SERVICE), ispId);
HBufC* apn = NULL;
// Open the service type table.
CCommsDbTableView* iaptable = commDB->OpenViewMatchingUintLC(*serviceType, TPtrC(COMMDB_ID), ispId);
retval = iaptable->GotoFirstRecord();
if (retval == KErrNone)
{
// Read the apn
apn = iaptable->ReadLongTextLC(TPtrC(GPRS_APN));
CleanupStack::Pop(apn); // apn
}
CleanupStack::PopAndDestroy(2);
HBufC* tempIapName = tableView->ReadLongTextLC( TPtrC( COMMDB_NAME) );
if (apn != NULL)
{
const TInt newLen = tempIapName->Length() + apn->Length() + 2;
if (tempIapName->Des().MaxLength() < newLen)
{
CleanupStack::Pop(tempIapName);
tempIapName = tempIapName->ReAllocL(newLen);
CleanupStack::PushL(tempIapName);
}
tempIapName->Des().Append(_L("("));
tempIapName->Des().Append(*apn);
tempIapName->Des().Append(_L(")"));
delete apn;
}
aIapNameArray->AppendL(*tempIapName);
CleanupStack::PopAndDestroy(tempIapName);
tableView->ReadUintL( TPtrC( COMMDB_ID), iapId );
aIapUidArray->AppendL(iapId);
retval = tableView->GotoNextRecord();
}
CleanupStack::PopAndDestroy(2);
return ETrue;
补充:移动开发 , Symbian