problem with creating IAP

Login to reply to this topic.
Tue, 2005-07-12 12:26
Anonymous
Forum posts: 2043
I'm trying to create an IAP like this but NOTHING IS CREATED when i run app on device.
plz check and guide whats wrong with this code ? Sad

.............................................................................................................................

CCommsDbTableView* view;

TInt error;
TUint32 gprsId;
TInt nId=0;
TCommDbOpeningMethod method;

CCommsDatabase* cdb=CCommsDatabase::NewL(EDatabaseTypeIAP,method);
CleanupStack::PushL(cdb);

   //1)Add record to OUTGOING_GPRS
   view = cdb->OpenTableLC(TPtrC(OUTGOING_GPRS));
   view->InsertRecord(gprsId);
   
   error = view->PutRecordChanges();
   
   if(!error)
   view->ReadUintL(TPtrC(COMMDB_ID), gprsId);

   view->WriteTextL(TPtrC(COMMDB_NAME), _L("ufone"));
   view->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), ETrue);
   view->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue);
   view->WriteBoolL(TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER), ETrue);
   view->WriteTextL(TPtrC(GPRS_IP_GATEWAY), _L("192.168.1.104"));
   view->WriteTextL(TPtrC(GPRS_IF_AUTH_NAME), _L(""));
   view->WriteTextL(TPtrC(GPRS_IF_AUTH_PASS),_L(""));
   view->WriteTextL(TPtrC(GPRS_APN), _L("ufone"));
   view->WriteUintL(TPtrC(GPRS_PDP_TYPE), 0);
   view->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), EFalse);
   view->WriteTextL(TPtrC(GPRS_IF_NETWORKS), _L("ip"));
   view->WriteBoolL(TPtrC(GPRS_HEADER_COMPRESSION), EFalse);
   view->WriteBoolL(TPtrC(GPRS_DATA_COMPRESSION), EFalse);
   view->WriteUintL(TPtrC(GPRS_REQ_PRECEDENCE), 0);
   view->WriteUintL(TPtrC(GPRS_REQ_DELAY), 0);
   view->WriteUintL(TPtrC(GPRS_REQ_RELIABILITY), 0);
   view->WriteUintL(TPtrC(GPRS_REQ_PEAK_THROUGHPUT), 0);
   view->WriteUintL(TPtrC(GPRS_REQ_MEAN_THROUGHPUT), 0);
   view->WriteUintL(TPtrC(GPRS_MIN_PRECEDENCE), 0);
   view->WriteUintL(TPtrC(GPRS_MIN_DELAY), 0);
   view->WriteUintL(TPtrC(GPRS_MIN_RELIABILITY), 0);
   view->WriteUintL(TPtrC(GPRS_MIN_PEAK_THROUGHPUT), 0);
   view->WriteUintL(TPtrC(GPRS_MIN_MEAN_THROUGHPUT), 0);
   view->WriteBoolL(TPtrC(GPRS_ANONYMOUS_ACCESS), EFalse);
   view->WriteBoolL(TPtrC(DEFAULT_GPRS_USE_EDGE), EFalse);
   view->WriteBoolL(TPtrC(GPRS_ENABLE_LCP_EXTENSIONS), EFalse);
   view->WriteBoolL(TPtrC(GPRS_DISABLE_PLAIN_TEXT_AUTH), EFalse);

   view->WriteUintL(TPtrC(GPRS_AP_TYPE), 0);
   view->WriteUintL(TPtrC(GPRS_QOS_WARNING_TIMEOUT), -1);
   view->WriteUintL(TPtrC(GPRS_PDP_TYPE), 0);
   view->WriteTextL(TPtrC(GPRS_PDP_ADDRESS), _L(""));
//view1->WriteTextL(TPtrC(GPRS_IF_NAME),_L("")); GPRS_IF_NAME has been    //suppressed in cdbcol.h although it is still in the sdk doc!

   view->WriteTextL(TPtrC(GPRS_IF_PARAMS), _L(""));
   view->WriteUintL(TPtrC(GPRS_IF_AUTH_RETRIES), 0);
   view->WriteTextL(TPtrC(GPRS_IP_NETMASK), _L(""));
   view->WriteTextL(TPtrC(GPRS_IP_ADDR),_L("0.0.0.0"));
   view->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER1),_L("0.0.0.0"));
   view->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER2),_L("0.0.0.0"));
   error = view->PutRecordChanges();

   CleanupStack::PopAndDestroy(view);
   CleanupStack::PopAndDestroy(cdb);

   //2)Add record to NETWORK
   TUint32 networkId;
   CCommsDatabase* cdb2=CCommsDatabase::NewL(EDatabaseTypeIAP);
   CleanupStack::PushL(cdb2);
   CCommsDbTableView* view2 = cdb2->OpenTableLC(TPtrC(NETWORK));
   view2->InsertRecord(networkId);
   view2->WriteTextL(TPtrC(COMMDB_NAME), _L("ufone"));
   error = view2->PutRecordChanges(EFalse, EFalse);
   CleanupStack::PopAndDestroy(view2);
   CleanupStack::PopAndDestroy(cdb2);

   //3)SEARCH FOR Mobile LOCATION id
   TInt result;
   TUint32 locationId;
   TUint32 mobileLocationId;
   // Open Database
   CCommsDatabase* cdb3 = CCommsDatabase::NewL(EDatabaseTypeIAP);
   CleanupStack::PushL(cdb3);
   CCommsDbTableView* view3 = cdb3->OpenTableLC(TPtrC(LOCATION));
   // Walk through records
   result = view3->GotoFirstRecord();
   TBuf<128> locationName;
   while (result == KErrNone)
   {

   view3->ReadTextL(TPtrC(COMMDB_NAME), locationName);
   
   view3->ReadUintL(TPtrC(LOCATION_MOBILE), locationId);

   if (locationName.Match(_L("Mobile"))!= KErrNotFound)
      mobileLocationId = locationId;
   
   result = view3->GotoNextRecord();

   }
   CleanupStack::PopAndDestroy(view3);
   CleanupStack::PopAndDestroy(cdb3);

   //4)Create IAP
   TUint32 iapId;
   CCommsDatabase* cdb4=CCommsDatabase::NewL(EDatabaseTypeIAP);
   CleanupStack::PushL(cdb4);
   CCommsDbTableView* view4;
   view4 = cdb4->OpenTableLC(TPtrC(IAP));
   error = view4->InsertRecord(iapId);
   view4->WriteTextL(TPtrC(COMMDB_NAME), _L("ufone"));
   view4->WriteTextL(TPtrC(IAP_SERVICE_TYPE), TPtrC(OUTGOING_GPRS));
   view4->WriteUintL(TPtrC(IAP_SERVICE), gprsId);
   view4->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0);
   view4->WriteUintL(TPtrC(IAP_NETWORK), networkId);
   view4->WriteUintL(TPtrC(IAP_BEARER), 2);
   view4->WriteTextL(TPtrC(IAP_BEARER_TYPE), TPtrC(MODEM_BEARER));
   view4->WriteUintL(TPtrC(IAP_LOCATION), mobileLocationId);
   view4->WriteUintL(TPtrC(IAP_DIALOG_PREF), iapId); //makes the app crash
   error = view4->PutRecordChanges(EFalse, EFalse);

   CleanupStack::PopAndDestroy(view4);
   CleanupStack::PopAndDestroy(cdb4);

   //5) CREATE WAP_ACCESS_POINT
   CCommsDatabase* cdb5=CCommsDatabase::NewL(EDatabaseTypeIAP);
   CleanupStack::PushL(cdb5);

   TUint32 wapId;
   CCommsDbTableView* view5 = cdb5->OpenTableLC(TPtrC(WAP_ACCESS_POINT));
   error = view5->InsertRecord(wapId);
   view5->WriteTextL(TPtrC(COMMDB_NAME), _L("ufone"));
   view5->WriteTextL(TPtrC(WAP_CURRENT_BEARER), TPtrC(WAP_IP_BEARER));
   view5->WriteTextL(TPtrC(WAP_START_PAGE), _L("http://wap.ufone.com"));
   error = view5->PutRecordChanges(EFalse, EFalse);

   CleanupStack::PopAndDestroy(view5);
   CleanupStack::PopAndDestroy(cdb5);

   //6) Create WAP_IP_BEARER
   TUint32 wapIPId;
   CCommsDatabase* cdb6=CCommsDatabase::NewL(EDatabaseTypeIAP);
   CleanupStack::PushL(cdb6);
   CCommsDbTableView* view6 = cdb6->OpenTableLC(TPtrC(WAP_IP_BEARER));
   error = view6->InsertRecord(wapIPId);
   // Has no name view6->WriteTextL(TPtrC(COMMDB_NAME), _L("ufone"));
   view6->WriteUintL(TPtrC(WAP_ACCESS_POINT_ID), wapId);
   view6->WriteTextL(TPtrC(WAP_GATEWAY_ADDRESS), _L("192.168.104.104"));
   view6->WriteUintL(TPtrC(WAP_WSP_OPTION),EWapWspOptionConnectionOriented);
   view6->WriteBoolL(TPtrC(WAP_SECURITY), EFalse);
   view6->WriteUintL(TPtrC(WAP_IAP),iapId);
   view6->WriteUintL(TPtrC(WAP_PROXY_PORT), 0);
   view6->WriteTextL(TPtrC(WAP_PROXY_LOGIN_NAME), _L(""));
   view6->WriteTextL(TPtrC(WAP_PROXY_LOGIN_PASS), _L(""));
   error = view6->PutRecordChanges(EFalse, EFalse);
   CleanupStack::PopAndDestroy(view6);
   CleanupStack::PopAndDestroy(cdb6);

Tue, 2005-07-12 14:13
chishti_hameed (not verified)
Forum posts: 2043
Re: problem with creating IAP
This piece of code (thanks to Mika Raento) creates ISP/WAP Access point but doesnt create GPRS Access point.....

------------------------------------------------
_LIT(KContextAP, "ContextBT");
_LIT(KContextModem, "ContextBTModem");
_LIT(KClassName, "CBTAPManagerImpl");
_LIT(KDefaultServiceFile, "c:\\system\\apps\\context_log\\service.obj");
_LIT(KLoginScript, "CHARMAP [windows-1252]\nLOOP 10\n{\nSEND \"CLIENT\"+<0x0d>\nWAIT 3\n{\n\"SERVER\" OK\n}\n}\nEXIT KErrNoAnswer$\n\nOK:\nEXIT\n");

#define TEST_IF_NAME _S("IfName")


CCommsDatabase * db = CCommsDatabase::NewL(EDatabaseTypeIAP);
CleanupStack::PushL(db);
db->ShowHiddenRecords();

CCommsDbTableView * table;
TInt err;
TUint32 newModemId, networkId, dialOutIspId, iapId, wapAPId, wapIpBearerId ,gprsId;

// BEARER TABLE -------------------------------------------------------------
table=db->OpenTableLC(TPtrC(MODEM));
err = table->InsertRecord(newModemId);

table->WriteTextL(TPtrC(COMMDB_NAME), KContextModem);
table->WriteTextL(TPtrC(MODEM_AGENT), _L("csd.agt"));
table->WriteTextL(TPtrC(MODEM_PORT_NAME), _L("BTCOMM::1"));
table->WriteTextL(TPtrC(MODEM_TSY_NAME), _L("PHONETSY"));
table->WriteTextL(TPtrC(MODEM_NIF_NAME), _L("PPP"));
table->WriteTextL(TPtrC(MODEM_CSY_NAME), _L("BTCOMM"));
table->WriteUintL(TPtrC(MODEM_DATA_BITS), (TUint8)3);
table->WriteUintL(TPtrC(MODEM_STOP_BITS), (TUint8)0);
table->WriteUintL(TPtrC(MODEM_PARITY), (TUint8)0);
table->WriteUintL(TPtrC(MODEM_RATE), (TUint32)15);
table->WriteUintL(TPtrC(MODEM_HANDSHAKING), (TUint32)196);
table->WriteUintL(TPtrC(MODEM_SPECIAL_RATE), (TUint32) 0);
table->WriteUintL(TPtrC(MODEM_XON_CHAR), (TUint8) 17);
table->WriteUintL(TPtrC(MODEM_XOFF_CHAR), (TUint8) 19);
table->WriteUintL(TPtrC(MODEM_FAX_CLASS_PREF), (TUint8)0);
table->WriteUintL(TPtrC(MODEM_SPEAKER_PREF), (TUint8)0);
table->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF), (TUint8) 0);
table->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING), _L8("ATZ"));
table->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING), _L8("AT"));
table->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING), _L8("AT"));
table->WriteTextL(TPtrC(MODEM_ISP_INIT_STRING), _L8(""));
table->WriteTextL(TPtrC(MODEM_DIAL_PAUSE_LENGTH), _L8("S8="));
table->WriteTextL(TPtrC(MODEM_CARRIER_TIMEOUT), _L8(""));
table->WriteTextL(TPtrC(MODEM_AUTO_ANSWER_RING_COUNT),_L8(""));
table->WriteTextL(TPtrC(MODEM_SPEAKER_ALWAYS_OFF), _L8("M0"));
table->WriteTextL(TPtrC(MODEM_SPEAKER_ALWAYS_ON), _L8("M2"));
table->WriteTextL(TPtrC(MODEM_SPEAKER_ON_AFTER_DIAL_UNTIL_CARRIER), _L8("M3"));
table->WriteTextL(TPtrC(MODEM_SPEAKER_ON_UNTIL_CARRIER), _L8("M1"));
table->WriteTextL(TPtrC(MODEM_SPEAKER_VOL_CONTROL_HIGH), _L8("L2"));
table->WriteTextL(TPtrC(MODEM_SPEAKER_VOL_CONTROL_LOW), _L8("L0"));
table->WriteTextL(TPtrC(MODEM_SPEAKER_VOL_CONTROL_MEDIUM), _L8("L1"));
table->WriteTextL(TPtrC(MODEM_DIAL_TONE_WAIT_MODIFIER), _L8("W"));
table->WriteTextL(TPtrC(MODEM_CALL_PROGRESS_1), _L8("X1"));
table->WriteTextL(TPtrC(MODEM_CALL_PROGRESS_2), _L8("X2"));
table->WriteTextL(TPtrC(MODEM_CALL_PROGRESS_3), _L8("X3"));
table->WriteTextL(TPtrC(MODEM_CALL_PROGRESS_4), _L8("X4"));
table->WriteTextL(TPtrC(MODEM_ECHO_OFF), _L8("E0"));
table->WriteTextL(TPtrC(MODEM_VERBOSE_TEXT), _L8("V1"));
table->WriteTextL(TPtrC(MODEM_QUIET_OFF), _L8("Q0"));
table->WriteTextL(TPtrC(MODEM_QUIET_ON), _L8("Q1"));
table->WriteTextL(TPtrC(MODEM_DIAL_COMMAND_STATE_MODIFIER), _L8(""));
table->WriteTextL(TPtrC(MODEM_ON_LINE), _L8("O"));
table->WriteTextL(TPtrC(MODEM_RESET_CONFIGURATION), _L8("Z"));
table->WriteTextL(TPtrC(MODEM_RETURN_TO_FACTORY_DEFS), _L8("&F"));
table->WriteTextL(TPtrC(MODEM_DCD_ON_DURING_LINK), _L8("&C1"));
table->WriteTextL(TPtrC(MODEM_DTR_HANG_UP), _L8("&D2"));
table->WriteTextL(TPtrC(MODEM_DSR_ALWAYS_ON), _L8("&S0"));
table->WriteTextL(TPtrC(MODEM_RTS_CTS_HANDSHAKE), _L8("&K3"));
table->WriteTextL(TPtrC(MODEM_XON_XOFF_HANDSHAKE), _L8("&K4"));
table->WriteTextL(TPtrC(MODEM_ESCAPE_CHARACTER), _L8("+"));
table->WriteTextL(TPtrC(MODEM_ESCAPE_GUARD_PERIOD), _L8("S12"));
table->WriteTextL(TPtrC(MODEM_FAX_CLASS_INTERROGATE), _L8(""));
table->WriteTextL(TPtrC(MODEM_FAX_CLASS), _L8(""));
table->WriteTextL(TPtrC(MODEM_NO_ANSWER), _L8("NO ANSWER"));
table->WriteTextL(TPtrC(MODEM_NO_DIAL_TONE), _L8("NO DIAL TONE"));
table->WriteTextL(TPtrC(MODEM_BUSY), _L8("BUSY"));
table->WriteTextL(TPtrC(MODEM_CARRIER), _L8("CARRIER"));
table->WriteTextL(TPtrC(MODEM_CONNECT), _L8("CONNECT"));
table->WriteTextL(TPtrC(MODEM_COMPRESSION_CLASS_5), _L8("COMPRESSION:CLASS 5"));
table->WriteTextL(TPtrC(MODEM_COMPRESSION_NONE), _L8("COMPRESSION:NONE"));
table->WriteTextL(TPtrC(MODEM_COMPRESSION_V42BIS), _L8("CONMPRESSION:V.42 bis"));
table->WriteTextL(TPtrC(MODEM_PROTOCOL_ALT), _L8("PROTOCOL:ALT"));
table->WriteTextL(TPtrC(MODEM_PROTOCOL_ALTCELLULAR), _L8("PROTOCOL:ART-CELLULAR"));
table->WriteTextL(TPtrC(MODEM_PROTOCOL_LAPD), _L8("PROTOCOL:LAPD"));
table->WriteTextL(TPtrC(MODEM_PROTOCOL_NONE), _L8("PROTOCOL:NONE"));
//table->WriteUintL(TPtrC(MODEM_MESSAGE_CENTER_NUMBER), _
//table->WriteTextL(TPtrC(MODEM_MESSAGE_DELIVERY_REPORT
//table->WriteTextL(TPtrC(MODEM_MESSAGE_VALIDITY_PERIOD),
//table->WriteTextL(TPtrC(MODEM_CHANNEL_PORT_NAME),
table->WriteUintL(TPtrC(MODEM_MIN_SIGNAL_LEVEL), (TUint)0);

table->PutRecordChanges();
CleanupStack::PopAndDestroy(table);
table = NULL;


// NETWORK TABLE -------------------------------------------------------------
table=db->OpenTableLC(TPtrC(NETWORK));
err = table->InsertRecord(networkId);

table->WriteTextL(TPtrC(COMMDB_NAME), KContextAP);

table->PutRecordChanges();
CleanupStack::PopAndDestroy(table);
table = NULL;


// LOCATION TABLE ------------------------------------------------------------
table=db->OpenTableLC(TPtrC(LOCATION));

//Find line where name = MOBILE; get id in locationId

CleanupStack::PopAndDestroy(table);
table = NULL;

Tue, 2005-07-12 14:13
chishti_hameed (not verified)
Forum posts: 2043
Re: problem with creating IAP
// TABLE DIAL_OUT_ISP ---------------------------------------------------------
table=db->OpenTableLC(TPtrC(DIAL_OUT_ISP));
err = table->InsertRecord(dialOutIspId);

table->WriteTextL(TPtrC(COMMDB_NAME), KContextAP);
table->WriteTextL(TPtrC(ISP_DESCRIPTION), KContextAP);
table->WriteUintL(TPtrC(ISP_TYPE), /*TCommsDbIspType::EIspTypeInternetAndWAP*/ 2);
table->WriteTextL(TPtrC(ISP_DEFAULT_TEL_NUM), _L(""));
table->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION), EFalse);
table->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT), ETrue);
table->WriteLongTextL(TPtrC(ISP_LOGIN_SCRIPT), KLoginScript);
table->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN), EFalse);
table->WriteTextL(TPtrC(ISP_LOGIN_NAME), _L("bt"));
table->WriteTextL(TPtrC(ISP_LOGIN_PASS), _L("bt"));
table->WriteBoolL(TPtrC(ISP_DISPLAY_PCT), EFalse);
TRAP(err, table->WriteTextL(TPtrC(TEST_IF_NAME), _L("PPP")) // FIXME : Huh ISP_IF_NAME
table->WriteTextL(TPtrC(ISP_IF_NETWORKS), _L("ip"));
table->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH), EFalse);
table->WriteTextL(TPtrC(ISP_IF_AUTH_NAME), _L("bt"));
table->WriteTextL(TPtrC(ISP_IF_AUTH_PASS), _L("bt"));
table->WriteUintL(TPtrC(ISP_IF_AUTH_RETRIES), 0 );
table->WriteBoolL(TPtrC(ISP_IF_CALLBACK_ENABLED), EFalse);
table->WriteTextL(TPtrC(ISP_IF_CALLBACK_INFO), _L8(""));
table->WriteUintL(TPtrC(ISP_IF_CALLBACK_TYPE), 1002);
table->WriteUintL(TPtrC(ISP_CALLBACK_TIMEOUT), 60000000);
table->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER), ETrue);
table->WriteTextL(TPtrC(ISP_IP_ADDR), _L("0.0.0.0"));
table->WriteTextL(TPtrC(ISP_IP_NETMASK), _L(""));
table->WriteTextL(TPtrC(ISP_IP_GATEWAY), _L("0.0.0.0"));
table->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER), ETrue);
table->WriteTextL(TPtrC(ISP_IP_NAME_SERVER1), _L("0.0.0.0"));
table->WriteTextL(TPtrC(ISP_IP_NAME_SERVER2), _L("0.0.0.0"));
table->WriteBoolL(TPtrC(ISP_ENABLE_IP_HEADER_COMP), EFalse);
table->WriteBoolL(TPtrC(ISP_ENABLE_LCP_EXTENSIONS), EFalse);
table->WriteBoolL(TPtrC(ISP_DISABLE_PLAIN_TEXT_AUTH), EFalse);
table->WriteBoolL(TPtrC(ISP_ENABLE_SW_COMP), ETrue);
table->WriteUintL(TPtrC(ISP_BEARER_CE), 2); // investigate : apparently always 2.
table->WriteUintL(TPtrC(ISP_BEARER_NAME), 0);
table->WriteUintL(TPtrC(ISP_BEARER_SPEED), 1);
//table->WriteUintL(TPtrC(ISP_INIT_STRING), NULL);
table->WriteUintL(TPtrC(ISP_BEARER_TYPE), 0);
table->WriteUintL(TPtrC(ISP_BEARER_SERVICE), 1); // investigate Huh
table->WriteUintL(TPtrC(ISP_CHANNEL_CODING), 0);
table->WriteUintL(TPtrC(ISP_AIUR), 0);
table->WriteUintL(TPtrC(ISP_REQUESTED_TIME_SLOTS), 0);
table->WriteUintL(TPtrC(ISP_MAXIMUM_TIME_SLOTS), 0);
table->WriteBoolL(TPtrC(ISP_USER_INIT_UPGRADE), EFalse);

table->PutRecordChanges();
CleanupStack::PopAndDestroy(table);
table = NULL;

// TABLE IAP --------------------------------------------------------
table=db->OpenTableLC(TPtrC(IAP));
err = table->InsertRecord(iapId);

table->WriteTextL(TPtrC(COMMDB_NAME), KContextAP);
table->WriteTextL(TPtrC(IAP_SERVICE_TYPE), TPtrC(DIAL_OUT_ISP));

table->WriteUintL(TPtrC(IAP_SERVICE), dialOutIspId); //
table->WriteUintL(TPtrC(IAP_BEARER), newModemId);

//table->WriteUintL(TPtrC(IAP_SERVICE), 3);
//table->WriteUintL(TPtrC(IAP_BEARER), 3);

table->WriteTextL(TPtrC(IAP_BEARER_TYPE), TPtrC(MODEM_BEARER));
table->WriteUintL(TPtrC(IAP_NETWORK), networkId);
table->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0);
//table->WriteUintL(TPtrC(IAP_LOCATION), locationId);
table->WriteUintL(TPtrC(IAP_LOCATION), 2); //FIXME
//table->WriteUintL(TPtrC(IAP_DIALOG_PREF), 0);

table->PutRecordChanges();
CleanupStack::PopAndDestroy(table);
table = NULL;


// TABLE WAP_ACCESS_POINT ---------------------------------------------------
table = db->OpenTableLC(TPtrC(WAP_ACCESS_POINT));

err = table->InsertRecord(wapAPId);
table->WriteTextL(TPtrC(COMMDB_NAME), KContextAP);
table->WriteTextL(TPtrC(WAP_CURRENT_BEARER), TPtrC(WAP_IP_BEARER));
table->WriteTextL(TPtrC(WAP_START_PAGE), _L("http://www.google.com/wml"));

table->PutRecordChanges();
CleanupStack::PopAndDestroy(table);
table = NULL;

// TABLE WAP_IP_BEARER -----------------------------------------------------
table = db->OpenTableLC(TPtrC(WAP_IP_BEARER));
table->InsertRecord(wapIpBearerId);

table->WriteUintL(TPtrC(WAP_ACCESS_POINT_ID), wapAPId );
table->WriteUintL(TPtrC(WAP_IAP), iapId);
table->WriteUintL(TPtrC(WAP_WSP_OPTION), 1);
table->WriteUintL(TPtrC(WAP_PROXY_PORT), 0);

table->PutRecordChanges();
CleanupStack::PopAndDestroy(table);
table = NULL;
Tue, 2005-07-12 14:14
chishti_hameed (not verified)
Forum posts: 2043
Re: problem with creating IAP
//Add record to OUTGOING_GPRS
table = db->OpenTableLC(TPtrC(OUTGOING_GPRS));
err = table->InsertRecord(gprsId);

table->WriteTextL(TPtrC(COMMDB_NAME), KContextAP);
table->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), ETrue);
table->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue);
table->WriteBoolL(TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER), ETrue);
table->WriteTextL(TPtrC(GPRS_IP_GATEWAY), _L("0.0.0.0"));
table->WriteTextL(TPtrC(GPRS_IF_AUTH_NAME), _L(""));
table->WriteTextL(TPtrC(GPRS_IF_AUTH_PASS),_L(""));
table->WriteTextL(TPtrC(GPRS_APN), KContextAP);
table->WriteUintL(TPtrC(GPRS_PDP_TYPE), 0);
table->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), EFalse);
table->WriteTextL(TPtrC(GPRS_IF_NETWORKS), _L("ip"));
table->WriteBoolL(TPtrC(GPRS_HEADER_COMPRESSION), EFalse);
table->WriteBoolL(TPtrC(GPRS_DATA_COMPRESSION), EFalse);
table->WriteUintL(TPtrC(GPRS_REQ_PRECEDENCE), 0);
table->WriteUintL(TPtrC(GPRS_REQ_DELAY), 0);
table->WriteUintL(TPtrC(GPRS_REQ_RELIABILITY), 0);
table->WriteUintL(TPtrC(GPRS_REQ_PEAK_THROUGHPUT), 0);
table->WriteUintL(TPtrC(GPRS_REQ_MEAN_THROUGHPUT), 0);
table->WriteUintL(TPtrC(GPRS_MIN_PRECEDENCE), 0);
table->WriteUintL(TPtrC(GPRS_MIN_DELAY), 0);
table->WriteUintL(TPtrC(GPRS_MIN_RELIABILITY), 0);
table->WriteUintL(TPtrC(GPRS_MIN_PEAK_THROUGHPUT), 0);
table->WriteUintL(TPtrC(GPRS_MIN_MEAN_THROUGHPUT), 0);
table->WriteBoolL(TPtrC(GPRS_ANONYMOUS_ACCESS), EFalse);
table->WriteBoolL(TPtrC(DEFAULT_GPRS_USE_EDGE), EFalse);
table->WriteBoolL(TPtrC(GPRS_ENABLE_LCP_EXTENSIONS), EFalse);
table->WriteBoolL(TPtrC(GPRS_DISABLE_PLAIN_TEXT_AUTH), EFalse);

table->WriteUintL(TPtrC(GPRS_AP_TYPE), 0);
table->WriteUintL(TPtrC(GPRS_QOS_WARNING_TIMEOUT), -1);
table->WriteUintL(TPtrC(GPRS_PDP_TYPE), 0);
table->WriteTextL(TPtrC(GPRS_PDP_ADDRESS), _L(""));
table->WriteTextL(TPtrC(TEST_IF_NAME),_L("")); //debug

table->WriteTextL(TPtrC(GPRS_IF_PARAMS), _L(""));
table->WriteUintL(TPtrC(GPRS_IF_AUTH_RETRIES), 0);
table->WriteTextL(TPtrC(GPRS_IP_NETMASK), _L(""));
table->WriteTextL(TPtrC(GPRS_IP_ADDR),_L("0.0.0.0"));
table->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER1),_L("0.0.0.0"));
table->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER2),_L("0.0.0.0"));

table->PutRecordChanges();
CleanupStack::PopAndDestroy(table);
table = NULL;

CleanupStack::PopAndDestroy(db);
Tue, 2005-07-12 15:15
Joined: 2005-05-09
Forum posts: 46
Re: problem with creating IAP
Hi Chishti,

I've never done this programmatically, but the one thing I can suggest is that you use ceddump to see if you are actually modifying the DB.

Run this command to create a clear text version of the comms db file called: cedout.cfg
Code:
C:\Symbian\7.0s\Series60_v20\epoc32\release\wins\udeb>ceddump

Here is your clear text version of the comms db file:
Code:
C:\Symbian\7.0s\Series60_v20\epoc32\wins\c>more cedout.cfg

You can translate the clear text version back to a binary version by issuing this command:
Code:
C:\Symbian\7.0s\Series60_v20\epoc32\release\wins\udeb>ced -i cedout.cfg

Does it look like your code is modifying the DB?
Wed, 2005-07-13 08:38
chishti_hameed (not verified)
Forum posts: 2043
Re: problem with creating IAP
its writting data to  "cdbv3.dat"  but i dont see any Access Point created Smiley
i can send code if anyone wanna look..................
Fri, 2005-08-26 10:03
Joined: 2005-04-08
Forum posts: 50
Re: problem with creating IAP
HI chishti_hameed , did u solved this problem

I can not create right too, my sdk is uiq 2.1.

i do like following, get error at the end:


    CCommsDatabase* cdb=CCommsDatabase::NewL(EDatabaseTypeIAP);
    CleanupStack::PushL(cdb);
   
   view = cdb->OpenTableLC(TPtrC(OUTGOING_GPRS));
    User::LeaveIfError(view->InsertRecord(gprsId));
    view->WriteTextL(TPtrC(COMMDB_NAME), aName);
    view->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), ETrue);
    view->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue);
    view->WriteBoolL(TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER), ETrue);
    view->WriteTextL(TPtrC(GPRS_IP_GATEWAY), _L("0.0.0.0"));
    view->WriteTextL(TPtrC(GPRS_IF_AUTH_NAME), _L(""));
    view->WriteTextL(TPtrC(GPRS_IF_AUTH_PASS),_L(""));
view->WriteTextL(TPtrC(GPRS_APN), _L("cmnet"));
    view->WriteUintL(TPtrC(GPRS_PDP_TYPE), 0);
    view->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), EFalse);
    view->WriteTextL(TPtrC(GPRS_IF_NETWORKS), _L("ip"));
    view->WriteBoolL(TPtrC(GPRS_HEADER_COMPRESSION), EFalse);
    view->WriteBoolL(TPtrC(GPRS_DATA_COMPRESSION), EFalse);
    view->WriteUintL(TPtrC(GPRS_REQ_PRECEDENCE), 0);
    view->WriteUintL(TPtrC(GPRS_REQ_DELAY), 0);
    view->WriteUintL(TPtrC(GPRS_REQ_RELIABILITY), 0);
    view->WriteUintL(TPtrC(GPRS_REQ_PEAK_THROUGHPUT), 0);
    view->WriteUintL(TPtrC(GPRS_REQ_MEAN_THROUGHPUT), 0);
    view->WriteUintL(TPtrC(GPRS_MIN_PRECEDENCE), 0);
    view->WriteUintL(TPtrC(GPRS_MIN_DELAY), 0);
    view->WriteUintL(TPtrC(GPRS_MIN_RELIABILITY), 0);
    view->WriteUintL(TPtrC(GPRS_MIN_PEAK_THROUGHPUT), 0);
    view->WriteUintL(TPtrC(GPRS_MIN_MEAN_THROUGHPUT), 0);
    view->WriteBoolL(TPtrC(GPRS_ANONYMOUS_ACCESS), EFalse);
    view->WriteBoolL(TPtrC(GPRS_USE_EDGE), EFalse);
    view->WriteBoolL(TPtrC(GPRS_ENABLE_LCP_EXTENSIONS), EFalse);
    view->WriteBoolL(TPtrC(GPRS_DISABLE_PLAIN_TEXT_AUTH), EFalse);
    view->WriteUintL(TPtrC(GPRS_AP_TYPE), 0);
    view->WriteUintL(TPtrC(GPRS_QOS_WARNING_TIMEOUT), 0);
    view->WriteUintL(TPtrC(GPRS_PDP_TYPE), 0);
    view->WriteTextL(TPtrC(GPRS_PDP_ADDRESS), _L(""));
    view->WriteTextL(TPtrC(GPRS_IF_PARAMS), _L(""));
    view->WriteUintL(TPtrC(GPRS_IF_AUTH_RETRIES), 0);
    view->WriteTextL(TPtrC(GPRS_IP_NETMASK), _L(""));
    view->WriteTextL(TPtrC(GPRS_IP_ADDR),_L("0.0.0.0"));
    view->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER1),_L("0.0.0.0"));
    view->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER2),_L("0.0.0.0"));
    error = view->PutRecordChanges();
   
    if(!error)
        view->ReadUintL(TPtrC(COMMDB_ID), gprsId);
    CleanupStack::PopAndDestroy(view);
    CleanupStack::PopAndDestroy(cdb);
   if (error)
   {
      CEikonEnv::Static()->InfoWinL(_L("OUTGOING_GPRS create fail"),aName);
      return ;
   }


Thanx in advance!

goready

Thu, 2007-03-15 10:20
Joined: 2007-01-14
Forum posts: 19
Re: problem with creating IAP
Hi,

I have created a my own new acceess point through code for uiq2 , but that access point is not deleting from control panel, while other existing access poits can be deleted.

So can any one help me, why my access point is not deleting?
  • Login to reply to this topic.