×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Regular Contributor
    Join Date
    Jan 2006
    Posts
    174

    Can app get default IAP of device's browser?

    I want my http client to use the same network configuration as browser, can I do it?

  2. #2
    Registered User
    Join Date
    Jun 2007
    Posts
    50

    Re: Can app get default IAP of device's browser?

    Refer RConnection for access point listings and how to avoid prompting IAP list to user. Explicitly set one IAP ID based on your requirement. I guess (even I may be wrong), If any application already using Internet and if that application keep the socket open, then the same connection is used for any other applications, as it maintains the same IP address for both the applications .

  3. #3
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Can app get default IAP of device's browser?

    this code will pick the default (last used by browser) and use it without prompting

    // open the IAP communications database
    CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
    CleanupStack::PushL(commDB);

    // initialize a view
    CCommsDbConnectionPrefTableView* commDBView =
    commDB->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionUnknown);

    // go to the first record
    User::LeaveIfError(commDBView->GotoFirstRecord());

    // Declare a prefTableView Object.
    CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;

    // read the connection preferences
    commDBView->ReadConnectionPreferenceL(pref);

    TUint32 iapID = pref.iBearer.iIapId;

    // pop and destroy the IAP View
    CleanupStack::PopAndDestroy(commDBView);

    // pop and destroy the database object
    CleanupStack::PopAndDestroy(commDB);

    // Now we have the iap Id. Use it to connect for the connection.
    // setup preferences
    connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    connectPref.SetDirection(ECommDbConnectionDirectionUnknown);
    connectPref.SetBearerSet(ECommDbBearerGPRS);

    //Sets the CommDb ID of the IAP to use for this connection
    connectPref.SetIapId(iapID);

    User::LeaveIfError(iConnection.Start(connectPref));
    hope this helps !
    Amit Kankani
    Nokia Developer Champion

  4. #4
    Regular Contributor
    Join Date
    Jan 2006
    Posts
    174

    Re: Can app get default IAP of device's browser?

    "this code will pick the default (last used by browser) and use it without prompting"----This statement is not correct. I changed used IAP of browser, but the iap got by your code was not changed.

    what changes the rank of "OpenConnectionPrefTableInRankOrderLC"?

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    30

    Re: Can app get default IAP of device's browser?

    Amit,

    Where did you get the code from? Its largely redundat and in some places even wrong.

    First of all, getting the first IAP in the connection preferences table isn't going to help at all. The preferred IAP change as applications update it, its NOT just the browser.

    Secondly, there's no reason why you'll need to do such an elaborate connection preferences setup!

    // Now we have the iap Id. Use it to connect for the connection.
    // setup preferences
    connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    connectPref.SetDirection(ECommDbConnectionDirectionUnknown);
    connectPref.SetBearerSet(ECommDbBearerGPRS);

    //Sets the CommDb ID of the IAP to use for this connection
    connectPref.SetIapId(iapID);

    Just
    connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    connectPref.SetIapId(iapID);

    Should do. In fact by calling connectPref.SetBearerSet(ECommDbBearerGPRS); you are actually restricting the IAP selection to bearers of type GPRS only! What happens if the IAP is WLAN? Anyway, setting the bearer set won't have any effect in this case as an explicit IAP has already been specified.

    Sigh...

    Quote Originally Posted by amitkankani View Post
    hope this helps !

  6. #6
    Registered User
    Join Date
    May 2006
    Posts
    30

    Re: Can app get default IAP of device's browser?

    daveice,

    There two scenarios to consider for using the IAP being used by the browser.

    First of all, the browser UI lets the user to specify an IAP OR prompt for an IAP every time the users connect.

    In the latter case, how will you determine which IAP to use, since its already user selection dependent.

    In the former case, there might be hope... the browser application just might store the IAP in use to some common location, which you might be able to retrive, however, I don't know enough about S60 to know that :-(

  7. #7
    Regular Contributor
    Join Date
    Jan 2006
    Posts
    174

    Re: Can app get default IAP of device's browser?

    Hi maxxxpayne,

    I just want to have the same configuration as local browser, if the browser setting changes, the IAP my app uses will change too.

    The reason is that I don't want to write a dedicated UI to configure IAP in my app.

  8. #8
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Can app get default IAP of device's browser?

    hey thanks for throwing some light on redundancies in the code

    well may be this link can throw some more light:

    http://wiki.forum.nokia.com/index.php/Default_iap

    Well the logic written will pick the last IAP the user has selected when prompt by any other connection by any other app...

    not too sure to read browser specific settings, but in most cases picking up default IAP is the best way. otherwise you got the ask for selection of IAP in your application and remember this selection in you app (one time ask) and also provide for settings to change this at a later point of time. This is what many apps do to avoid any conflict.

    also this link from wiki may be of some help if you want to implement this:
    http://wiki.forum.nokia.com/index.ph...oint_%28IAP%29


    do correct me if wrong... after all, we all are here to learn
    Last edited by amitkankani; 2008-05-01 at 04:57.
    Amit Kankani
    Nokia Developer Champion

  9. #9
    Regular Contributor
    Join Date
    Jan 2006
    Posts
    174

    Re: Can app get default IAP of device's browser?

    Quote Originally Posted by daveice View Post
    "this code will pick the default (last used by browser) and use it without prompting"----This statement is not correct. I changed used IAP of browser, but the iap got by your code was not changed.

    what changes the rank of "OpenConnectionPrefTableInRankOrderLC"?
    Still the same question, I dont know what changes the rank?

    I did an interesting experiment: using amitkankani's code to get IAP of rank 1(in first record), say it is MyIAP1. Then I removed MyIAP1 from connection settings. Run the code again, it still get MyIAP1 in first record!! Obviously, it is not a valid one, connection establishing will fail and IAP selection dialog will pops up...

  10. #10
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Can app get default IAP of device's browser?

    interesting !!!

    well can you try another thing:
    1. Go to browser and select an access point and make sure you are able to browse.
    2. Now close the browser
    3. Now delete this access point from the settings
    4. Now open the browser and try to open the same page (probably after clearing the cache if needed)...

    and let know the happenings...
    Amit Kankani
    Nokia Developer Champion

  11. #11
    Super Contributor
    Join Date
    Jul 2007
    Posts
    596

    Thumbs down Re: Can app get default IAP of device's browser?

    hello amit,

    can i control the APN dialog in a simple HTTP connection
    without using any RSocket element.

    Actually here i am making a simple get request (http)as in http client example in sdk.here i have not used any socket.
    now i want to save apn id only showing the dialog once at first time. Then after i want to use the saved value.

    Any one please suggest.

    Thanks

  12. #12
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Can app get default IAP of device's browser?

    definitely you can, and that is what the code can help do.

    The code mentioned in the above posts, with some minor modifications, (see the wiki links mentioned above to get the IAPs and also show selection dialog, next time onwards, you can simply use that IAP ID in the set Connection preference, and use the flag ECommDbDialogPrefDoNotPrompt)

    I have done this in my code, and with HTTP only (no socket) and one time ask only and it is working fine ...
    Amit Kankani
    Nokia Developer Champion

  13. #13
    Super Contributor
    Join Date
    Jul 2007
    Posts
    596

    Arrow Re: Can app get default IAP of device's browser?

    Quote Originally Posted by amitkankani View Post
    definitely you can, and that is what the code can help do.

    The code mentioned in the above posts, with some minor modifications, (see the wiki links mentioned above to get the IAPs and also show selection dialog, next time onwards, you can simply use that IAP ID in the set Connection preference, and use the flag ECommDbDialogPrefDoNotPrompt)

    I have done this in my code, and with HTTP only (no socket) and one time ask only and it is working fine ...
    Thanks for response. ok now i am able show the acess point dialog

    using this link http://wiki.forum.nokia.com/index.ph...oint_%28IAP%29

    but at this link http://wiki.forum.nokia.com/index.php/Default_iapi
    get the code for setting connection properties
    they use Rsocketserver . so how will i do this in my code.

    actually after getting APNID iset the property as below

    TCommDbConnPref connectPref;
    connectPref.SetDirection(ECommDbConnectionDirectionUnknown);
    connectPref.SetBearerSet(ECommDbBearerUnknown);
    connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    connectPref.SetIapId(selectedIap);

    after that what should i do.

    I mean how can i replace the following code

    RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
    connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketServ,
    RHTTPSession::GetTable() ), THTTPHdrVal (isockServ.Handle()) );
    TInt connPtr = REINTERPRET_CAST(TInt, &iconnection);
    connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketConnection,
    RHTTPSession::GetTable() ), THTTPHdrVal (connPtr) );


    Thanks

  14. #14
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Can app get default IAP of device's browser?

    I mean how can i replace the following code

    RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
    connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketServ,
    RHTTPSession::GetTable() ), THTTPHdrVal (isockServ.Handle()) );
    TInt connPtr = REINTERPRET_CAST(TInt, &iconnection);
    connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketConnection,
    RHTTPSession::GetTable() ), THTTPHdrVal (connPtr) );
    Well I am not sure if you need to do this. HTTP will also at some point use sockets (it is actually a wrapper over the sockets(TCP in case of symbian HTTP class, not sure if UDP could be ), as sockets is a transport layer entity and http is an presentation layer entity)

    So if u want to use HTTP, the code mentioned is just right.
    I have verified this in India with Airtel live, where socket connections are blocked, however, with HTTP it seems to work !

    well correct me if i am wrong... !!!
    Amit Kankani
    Nokia Developer Champion

  15. #15
    Super Contributor
    Join Date
    Jul 2007
    Posts
    596

    Arrow Re: Can app get default IAP of device's browser?

    Quote Originally Posted by amitkankani View Post
    Well I am not sure if you need to do this. HTTP will also at some point use sockets (it is actually a wrapper over the sockets(TCP in case of symbian HTTP class, not sure if UDP could be ), as sockets is a transport layer entity and http is an presentation layer entity)

    So if u want to use HTTP, the code mentioned is just right.
    I have verified this in India with Airtel live, where socket connections are blocked, however, with HTTP it seems to work !

    well correct me if i am wrong... !!!
    I also have tested this code, this works fine.

    but my question is now can we say this is a http request.
    beacuse here we are using RSocketServ.....

    Another question is why we are using this piece of code

    // The CApUtils API is deprecated/removed, the following code can be
    // used
    // to convert the WapAP Id to IAP Id

    if (selectedIap)
    {
    CCommsDatabase* db = CCommsDatabase::NewL();
    CleanupStack::PushL(db);

    CCommsDbTableView* wapTable;
    wapTable = db->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),
    TPtrC(COMMDB_ID), selectedIap );
    User::LeaveIfError( wapTable->GotoFirstRecord() );

    TBuf<100> wapBearer;
    wapTable->ReadTextL(TPtrC(WAP_CURRENT_BEARER), wapBearer);

    if ( wapBearer == TPtrC(WAP_IP_BEARER) )
    {
    CCommsDbTableView* bearerTable;
    bearerTable = db->OpenViewMatchingUintLC( TPtrC(wapBearer),
    TPtrC(WAP_ACCESS_POINT_ID),
    selectedIap );
    User::LeaveIfError( bearerTable->GotoFirstRecord() );
    bearerTable->ReadUintL(TPtrC(WAP_IAP), iIap );
    CleanupStack::PopAndDestroy( bearerTable ); // bearerTable
    }
    else
    {
    User::Leave( KErrInvalidBearerType );
    }
    CleanupStack::PopAndDestroy(2); // db, wapTable,
    }

    Thanks

Similar Threads

  1. N80 Start Web Browser with specified IAP
    By hmleung in forum Symbian
    Replies: 4
    Last Post: 2007-08-07, 03:23
  2. Upgrading default s60v3 browser in 5500
    By ireks in forum General Development Questions
    Replies: 4
    Last Post: 2007-02-15, 08:21
  3. symbian signed testing problem.
    By anglina in forum Symbian
    Replies: 0
    Last Post: 2007-02-01, 10:15
  4. Default IAP problem
    By Dexterp37 in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2005-10-17, 15:35
  5. Web browser as a control in my C++ App
    By natocm in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-03-03, 16:38

Posting Permissions

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