×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    51

    update commdb IAP table

    Hi,

    I want to create a new entry in the IAP table.
    Does anyone know which columns I have to set (mandatory) ?
    My code works fine for the emulator and on P800 BUT FAILS on Nokia 6600.

    PutRecordChanged returns a -1 (KErrNotFound) error. It seems that the database expects some mandatory field which is not set by the code below. Creating an entry in the outgoing GPRS works fine.

    TUint32 iapId;
    error = view->InsertRecord(iapId);
    view->WriteTextL(TPtrC(COMMDB_NAME),_L("SoneraC"));
    view->WriteTextL(TPtrC(IAP_SERVICE_TYPE), TPtrC(OUTGOING_GPRS));
    view->WriteUintL(TPtrC(IAP_SERVICE), gprsId);
    error = view->PutRecordChanges();

  2. #2
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    51
    I finally managed to get it work.
    it's pretty sick:

    first of all it seems that that although the 6600 is a symbian 7.0 phone it uses the old communication database scheme.

    second, you have to fill in every single column, otherwise it wount work.

    third, which is really stupid, you have to create an entry in the WAP tables even if you only want to create a GPRS account. otherwise it will not show up in your account list.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Location
    Leh, Ladhak.
    Posts
    41

    update iap

    Hi,
    I am not able to do it even after following your code. Infact my commdb becomes locked. What are the values you are putting in. my code is as:
    void CIAPTestAppUi::SetNewIap(TDesC8& iapName){

    TUint32 iapId=8;
    TInt error;
    TInt gprsId=0;
    TInt nId=0;
    //iapName.Copy(_L("vfinternet"));
    CCommsDatabase* comDB=CCommsDatabase::NewL(EDatabaseTypeIAP);
    CleanupStack::PushL(comDB);
    CCommsDbTableView* view;
    view = comDB->OpenTableLC(TPtrC(IAP));
    error = view->InsertRecord(iapId);
    view->WriteTextL(TPtrC(COMMDB_NAME), iapName);
    view->WriteTextL(TPtrC(IAP_SERVICE_TYPE), TPtrC(OUTGOING_GPRS));
    view->WriteUintL(TPtrC(IAP_SERVICE), gprsId);
    view->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0);
    view->WriteUintL(TPtrC(IAP_NETWORK), nId);
    view->WriteUintL(TPtrC(IAP_BEARER), 0);
    view->WriteTextL(TPtrC(IAP_BEARER_TYPE), TPtrC(MODEM_BEARER));
    view->WriteUintL(TPtrC(IAP_LOCATION), 2);
    error = view->PutRecordChanges(EFalse, EFalse);


    CleanupStack::Pop(1);
    delete view;
    delete comDB;
    }

  4. #4
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    51
    Hi,

    I am not sure If this can ever work because (correct me if I have to clean my glasses) you put two things on the cleanup stack:
    - comDb
    - view
    but you pop only one thing. Maybe this is the reason for the lock ?

    Sometimes it may be better to code things like this
    CleanupStack::PushL(comDB)

    CleanupStack::PopAndDestroy(comDB)

    then your application will panic immediately if you pop off the wrong things ...

  5. #5
    Registered User
    Join Date
    Mar 2003
    Location
    Leh, Ladhak.
    Posts
    41

    commdb

    Thanks for that suggestion on push/pop - yes you are right but fixing that still does not solve my problem.
    On sdk 2.0 of symbian 7 this line
    view = comDB->OpenTableLC(TPtrC(IAP));
    throws an error, on debugging it goes into assemply int 3. The documnetation shows that OpenTableLC is no longer supported. I am confused. Did you compile your app on version 6.1 of Symbian?
    Any help will be much appreciated.
    Rgds

  6. #6
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    51
    I compiled it for sdk 2.0. What exactly tells you that OpenTableLC is not supported anymore.

    >>throws an error, on debugging it goes into assemply int 3. The >>documnetation shows that OpenTableLC is no longer supported ...

    ... confuses me a bit

    For sdk 1.2 you better use something like

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

    CApDataHandler* dh = CApDataHandler::NewLC(*cdb);
    CApAccessPointItem *ap = CApAccessPointItem::NewLC();

    ap->SetNamesL(iapName->Des());
    ap->SetBearerTypeL(EApBearerTypeGPRS);

    ap->WriteLongTextL(EApGprsAccessPointName, _L("..."));
    ap->WriteTextL(EApIspIfAuthName, gprsIfAuthName->Des());
    ap->WriteTextL(EApIspIfAuthPass, gprsIfAuthPass->Des());

    ap->WriteBool(EApGprsDisablePlainTextAuth, EFalse);


    TRAP(error, id = dh->CreateFromDataL((CApAccessPointItem&) (*ap)));
    buf.Format(_L("new access point id %d error %d"), id, error);
    LOG_DEBUG(buf);

    CleanupStack::PopAndDestroy(accesspointitem); CleanupStack::PopAndDestroy(datahandler);
    ...

  7. #7
    Registered User
    Join Date
    Mar 2003
    Location
    Leh, Ladhak.
    Posts
    41

    commdb

    Thanks for your help all through and for reference on 6.1. The problem I have with Symbian 7.0 sdk 2.0 and 6600.

    The code compiles without any problems but when it executes it crashes immediately on executing the following:
    view = comDB->OpenTableLC(TPtrC(IAP));

    Also what did you mean by making an entry in WAP table to make it visible.
    Can you read through this code and tell me where I am commiting the unthinkable:


    void CIAPTestAppUi::SetNewIap(TDesC8& iapName){

    TUint32 iapId=8;
    TInt error;
    TInt gprsId=0;
    TInt nId=0;
    //iapName.Copy(_L("vfinternetau"));
    TCommDbOpeningMethod method;
    static CCommsDatabase* comDB=CCommsDatabase::NewL(EDatabaseTypeIAP,method);
    CleanupStack::PushL(comDB);


    CCommsDbTableView* view ;

    view = comDB->OpenTableLC(TPtrC(IAP));
    CleanupStack::PushL(view);
    error = view->InsertRecord(iapId);
    view->WriteTextL(TPtrC(COMMDB_NAME), iapName);
    view->WriteTextL(TPtrC(IAP_SERVICE_TYPE), TPtrC(OUTGOING_GPRS));
    view->WriteUintL(TPtrC(IAP_SERVICE), gprsId);
    view->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0);
    view->WriteUintL(TPtrC(IAP_NETWORK), nId);
    view->WriteUintL(TPtrC(IAP_BEARER), 0);
    view->WriteTextL(TPtrC(IAP_BEARER_TYPE), TPtrC(MODEM_BEARER));
    view->WriteUintL(TPtrC(IAP_LOCATION), 2);

    error = view->PutRecordChanges(EFalse, EFalse);

    CleanupStack::Pop(comDB);
    CleanupStack::Pop(view);
    delete view;
    delete comDB;
    }

  8. #8
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    94
    Hi,

    I did what josefaichhorn suggested, and still nothing. The APN is added to the commdb, but it doesn't appear in the Settings of the phone. Also, in the emulator, after I run my program, if I choose the Access Points in the settings, it makes the emulator crash.

    I've added records in the following tables (all columns are filled):

    - OUTGOING_GPRS
    - NETWORK
    - checked the LOCATION table for "Mobile"
    - IAP
    - WAP_ACCESS_POINT
    - WAP_IP_BEARER

    There are some other tables that I need to fill up? I've noticed also that there is a table, WAP_SMS_BEARER. I should fill this one up too?

    Thanks in advance for any advice!

    Regards,
    Stelian I.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×