WEB开发网
开发学院手机开发Symbian 开发 设置Symbian默认接入点 阅读

设置Symbian默认接入点

 2010-08-11 12:08:00 来源:WEB开发网   
核心提示:void SetDefaultIap(TInt aIapType, TUint32 &aIapId){TInt ret = KErrNone;TBuf apnName;TBuf<10> defApn;TUint32 fakeIapId;aIapId = 0;if (aIapType == 0)defApn

void SetDefaultIap(TInt aIapType, TUint32 &aIapId)

{

TInt ret = KErrNone;

TBuf apnName;

TBuf<10> defApn;

TUint32 fakeIapId;

aIapId = 0;

if (aIapType == 0)

defApn = _L("cmnet");

else if (aIapType == 1)

defApn = _L("cmwap");

else if (aIapType == 2) //模拟器

defApn = _L("Winsock");

CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP);

CleanupStack::PushL(commDb);

CCommsDbTableView* commView = commDb->OpenTableLC(TPtrC(OUTGOING_WCDMA));

if (commView->GotoFirstRecord() == KErrNone)

{

do

{

commView->ReadTextL((TPtrC) GPRS_APN, apnName);

commView->ReadUintL(TPtrC(COMMDB_ID), fakeIapId);

if (apnName.Find(defApn) >= 0) //不区分大小写

{

CCommsDbTableView* pIAPView = commDb->OpenViewMatchingUintLC(

TPtrC(IAP), TPtrC(IAP_SERVICE), fakeIapId);

TInt nErr = pIAPView->GotoFirstRecord();

if (nErr == KErrNone)

{

pIAPView->ReadUintL(TPtrC(COMMDB_ID), fakeIapId);

aIapId = fakeIapId;

CleanupStack::PopAndDestroy(); //pIAPView

break;

}

CleanupStack::PopAndDestroy(); //pIAPView

}

}

while (commView->GotoNextRecord() == KErrNone);

}

CleanupStack::PopAndDestroy(2);

}

Symbian的接入点参数真多,真复杂~~记录之,以防忘记~

Tags:设置 Symbian 默认

编辑录入:coldstar [复制链接] [打 印]
赞助商链接