Symbian (Create IAP)创建接入点
2010-08-11 12:10:00 来源:WEB开发网TUint32 locationId;
TUint32 mobileLocationId;
commsView = commsDb->OpenTableLC(TPtrC(LOCATION));
result = commsView->GotoFirstRecord();
TBuf<128> locationName;
while (result == KErrNone)
{
commsView->ReadTextL(TPtrC(COMMDB_NAME), locationName);
commsView->ReadUintL(TPtrC(LOCATION_MOBILE), locationId);
if (locationName.Match(_L("Mobile")) != KErrNotFound)
mobileLocationId = locationId;
result = commsView->GotoNextRecord();
}
CleanupStack::PopAndDestroy(commsView);
//利用刚刚找到的LOCATION ID在IAP表中添加记录
TUint32 iapId;
commsView = commsDb->OpenTableLC(TPtrC(IAP));
TRAP(error,commsView->InsertRecord(iapId));
// 设置记录的内容
commsView->WriteTextL(TPtrC(COMMDB_NAME), KDefaultIapName);
commsView->WriteTextL(TPtrC(IAP_SERVICE_TYPE), TPtrC(OUTGOING_GPRS));
commsView->WriteUintL(TPtrC(IAP_SERVICE), GPRSId);
commsView->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0);
commsView->WriteUintL(TPtrC(IAP_NETWORK), networkId);
commsView->WriteUintL(TPtrC(IAP_BEARER), 2);
commsView->WriteTextL(TPtrC(IAP_BEARER_TYPE), TPtrC(MODEM_BEARER));
commsView->WriteUintL(TPtrC(IAP_LOCATION), mobileLocationId);
// 添加这条新的记录
TRAP(error,commsView->PutRecordChanges());
//如果需要添加WAP接入点,需要在下列表中添加记录
//WAP接入点分二种,一种是彩信接入点,一种是常规WAP接入点
//二种区别在于,接入点的主页不同
// 在WAP_ACCESS_POINT表中添加记录
TUint32 wapId;
commsView = commsDb->OpenTableLC(TPtrC(WAP_ACCESS_POINT));
TRAP(error,commsView->InsertRecord(wapId));
commsView->WriteTextL(TPtrC(COMMDB_NAME), KDefaultIapName);
更多精彩
赞助商链接