×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    9

    How to set default access point for wap browser

    Hi,

    I can launch Wap Browser using this code:

    //----------------------------------------------------------------------------
    void StartBrowser(const TDesC& aUrl)
    {

    HBufC* param = HBufC::NewLC( 256 );
    param->Des().Format( _L( "4 %S" ),&aUrl );

    // Wap Browser's constants UId
    const TInt KWmlBrowserUid = 0x10008D39;
    TUid id( TUid::Uid( KWmlBrowserUid ) );

    TApaTaskList taskList(
    CEikonEnv::Static()->WsSession() );
    TApaTask task = taskList.FindApp( id );
    if ( task.Exists() )
    {
    HBufC8* param8 = HBufC8::NewLC( param->Length() );
    param8->Des().Append( *param );
    task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used
    CleanupStack::PopAndDestroy(); // param8
    }
    else
    {
    RApaLsSession appArcSession;
    User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server
    TThreadId id;
    appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid ), id );
    appArcSession.Close();
    }
    CleanupStack::PopAndDestroy(); // param
    }
    //----------------------------------------------------------------------------

    This works well. It connects using its Default Access Point defined in its Setting menu.

    For some URLs I need to change Default Access Point defined in Wap Browser. At least, I need to ask user to select one.

    Is this possible?

    Using this code:
    //----------------------------------------------------------------------------
    CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeIAP);
    CleanupStack::PushL(db);
    db->SetGlobalSettingL( TPtrC(ASK_USER_BEFORE_DIAL), ETrue );
    CleanupStack::PopAndDestroy(1);
    //----------------------------------------------------------------------------
    I can enable to prompt APN selection dialog. It will ask an APN but this does not effect Wap Browser.


    Please some hints!

    Thank you in advance.

    Bsekerci

  2. #2
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122
    Try putting the IAP ID as a third parameter in the browser command line, i.e. "4 <url> <iap_id>".

    Lauri

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    9
    Hi Lauri,

    Thank you for your reply.

    It works only there is no active connection in Wap Browser.

    Now, I have to check if Wap Browser is connected or not. If it is connected and APN is different I need to disconnect it.

    I couldn't find how to do these.

    I found only this solution. I find the Wap Browser task, end it and wait for a while it is disconnected.

    This is not a good solution.

    Can you give me good starting point for this also.

    Thank you again.

    BSekerci

  4. #4
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    121

    Re: How to set default access point for wap browser

    Hello!

    With the following code, you will be able to close existing connections.
    The pending problem is that you must discover the connection that is being used by the S60 Browser.

    Check RConnection Documentation for more details.

    ---------------------------------------------------------------

    //Open a session with the socket server
    RSocketServ socketServer;
    TInt err(KErrNone);
    err = socketServer.Connect();
    if(err != KErrNone) return err;

    //Open a subsession with the socket server for the RConnection

    err = myConnection.Open(socketServer);
    if(err != KErrNone) return err;

    //Start or attach the RConnection to an interface on the server
    TUint connectionCount;
    //Enumerate currently active connections across all socket servers
    err = myConnection.EnumerateConnections(connectionCount);
    if(err != KErrNone) return err;

    VDebug::singleton()->dataFormat(VLIT("S60IPManager::startConnection(): connectionCount = %d"), connectionCount);

    if(connectionCount == 0) // if no connections are started
    {
    VDebug::singleton()->dataFormat(VLIT("S60IPManager::startConnection(): connectionCount == 0"));
    }
    else
    {

    TPckgBuf<TConnectionInfoV2> connectionInfo;
    err = myConnection.GetConnectionInfo(1, connectionInfo); // 1 = first active connection

    VDebug::singleton()->dataFormat(VLIT("S60IPManager::startConnection(): myConnection.GetConnectionInfo - err = %d "), err);

    if(err!=KErrNone) return err;

    existingConnectionApnId = connectionInfo().iIapId;


    existingConnection = true;

    // ---------------------------------
    // Close Existing Connection First

    TCommDbConnPref prefCloseConnection;

    prefCloseConnection.SetIapId(existingConnectionApnId); // IAP ID for connection to be used

    prefCloseConnection.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );

    prefCloseConnection.SetDirection( ECommDbConnectionDirectionOutgoing );

    myConnection.Start(prefCloseConnection);

    VDebug::singleton()->dataFormat(VLIT("S60IPManager::startConnection(): Going to Stop ... "));

    myConnection.Stop(myConnection.EStopAuthoritative);

    VDebug::singleton()->dataFormat(VLIT("S60IPManager::startConnection(): Stopped "));

    // ------------------

    --------------------------------------------------------------------

Posting Permissions

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