Create new internet access point

Login to reply to this topic.
Fri, 2008-05-16 10:11
Joined: 2008-01-22
Forum posts: 44

Hi,

I am trying to create a new internet access point, here is what I wrote:

TInt error;
TUint32 gprsId;
TInt nId=0;
TCommDbOpeningMethod method;
CCommsDatabase* cdb=CCommsDatabase::NewL(EDatabaseTypeIAP,method);
CleanupStack::PushL(cdb);
view = cdb->OpenTableLC(TPtrC(OUTGOING_GPRS));
view->InsertRecord(gprsId);
view->WriteTextL(TPtrC(COMMDB_NAME), _L("MyGPRSService"));
view->WriteTextL(TPtrC(GPRS_APN), _L("shwap"));
view->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), EFalse);
view->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue);
view->WriteTextL(TPtrC(GPRS_IP_ADDR),_L("0.0.0.0"));
view->WriteTextL(TPtrC(GPRS_IP_NETMASK), _L("0.0.0.0"));
view->WriteTextL(TPtrC(GPRS_IP_GATEWAY), _L("0.0.0.0"));
view->WriteTextL(TPtrC(GPRS_IF_AUTH_NAME), _L("star"));
view->WriteTextL(TPtrC(GPRS_IF_AUTH_PASS), _L("hub"));
view->WriteBoolL(TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER), ETrue);
view->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER1),_L("010.012.001.002"));
view->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER2),_L("0.0.0.0"));
view->WriteBoolL(TPtrC(GPRS_ENABLE_LCP_EXTENSIONS), ETrue);
view->WriteBoolL(TPtrC(GPRS_DISABLE_PLAIN_TEXT_AUTH), EFalse);
error = view->PutRecordChanges();
CleanupStack::PopAndDestroy(view);
                 
// Create a entry in the Network table. Every IAP needs a unique networking entry
TUint32 networkId;
view = cdb->OpenTableLC(TPtrC(NETWORK));
view->InsertRecord(networkId);
view->WriteTextL(TPtrC(COMMDB_NAME), _L("MyNetwork"));
error = view->PutRecordChanges();
CleanupStack::PopAndDestroy(view);
                 
// Create the IAP entry
TUint32 aIapId;
view = cdb->OpenTableLC(TPtrC(IAP));
view->InsertRecord(aIapId);
view->WriteTextL(TPtrC(COMMDB_NAME),_L("Gee! 3G/GPRS"));
view->WriteTextL(TPtrC(IAP_SERVICE_TYPE), TPtrC(OUTGOING_GPRS));
view->WriteUintL(TPtrC(IAP_SERVICE), gprsId);
view->WriteUintL(TPtrC(IAP_BEARER), 3);
view->WriteTextL(TPtrC(IAP_BEARER_TYPE), TPtrC(MODEM_BEARER));
view->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0);
view->WriteUintL(TPtrC(IAP_NETWORK), networkId);
view->WriteUintL(TPtrC(IAP_LOCATION), 2);
view->PutRecordChanges();
CleanupStack::PopAndDestroy(view);

_LIT(KContextAP, "MyAP Wap Bearer");
TUint32 wapAPId;
TUint32 wapIpBearerId;
TUint32 iapId;
view = cdb->OpenTableLC(TPtrC(WAP_ACCESS_POINT));
error = view->InsertRecord(wapAPId);
view->WriteTextL(TPtrC(COMMDB_NAME), KContextAP);
view->WriteTextL(TPtrC(WAP_CURRENT_BEARER), TPtrC(WAP_IP_BEARER));
view->WriteTextL(TPtrC(WAP_START_PAGE), _L("http://www.starhub.com"));
view->PutRecordChanges();
CleanupStack::PopAndDestroy(view);
view = NULL;
view = cdb->OpenTableLC(TPtrC(WAP_IP_BEARER));
view->InsertRecord(wapIpBearerId);
view->WriteUintL(TPtrC(WAP_ACCESS_POINT_ID), wapAPId );
view->WriteUintL(TPtrC(WAP_IAP), iapId);
view->WriteBoolL(TPtrC(WAP_WSP_OPTION), ETrue);
view->WriteTextL(TPtrC(WAP_GATEWAY_ADDRESS), _L("010.012.001.002"));
view->WriteUintL(TPtrC(WAP_PROXY_PORT), 80);
view->PutRecordChanges();
CleanupStack::PopAndDestroy(view);
view = NULL;
CleanupStack::PopAndDestroy(cdb);

I did create a new internet access point in the phone. But I am not able to change the proxy_port and gateway address, the rest is alright.
besides that, when i set the access point I created to preferred account, the browser is not working, can any1 lend me some help?


Thu, 2008-05-22 10:42
Joined: 2008-01-22
Forum posts: 44
Re: Create new internet access point

I added the a proxy record into the existing code..however, the proxy address and port stil remains 0.0.0.0 .....How come?

TUint32 iProxyId;
TUint32 iGprsId;
CCommsDbTableView* proxyTable = db->OpenTableLC(TPtrC(PROXIES));
User::LeaveIfError( proxyTable->InsertRecord(iProxyId) );
proxyTable->WriteUintL(TPtrC(PROXY_ISP),iGprsId);
proxyTable->WriteTextL(TPtrC(PROXY_SERVICE_TYPE), TPtrC(OUTGOING_GPRS));
proxyTable->WriteBoolL(TPtrC(PROXY_USE_PROXY_SERVER), ETrue);
proxyTable->WriteLongTextL(TPtrC(PROXY_SERVER_NAME), _L("10.12.1.2"));
proxyTable->WriteTextL(TPtrC(PROXY_PROTOCOL_NAME), _L("http"));
proxyTable->WriteUintL(TPtrC(PROXY_PORT_NUMBER),80);
error = proxyTable->PutRecordChanges(EFalse,EFalse);
CleanupStack::PopAndDestroy(proxyTable);

Any help pls...need this in urgent.....thanks in advance

Wed, 2008-07-16 08:54
Joined: 2008-06-23
Forum posts: 62
Re: Create new internet access point

Why don't you use the APEngine? It is much easier to create an access point that way than tweaking manually the CommsDb.

  • Login to reply to this topic.