×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    51

    How to get the active connection connection type

    Hi All,

    How to get the active connection connection type(I.e WLAN or GPRS).
    In my application by using the below code i am trying to connect with the default active access point.
    It is working fine. But my doubt is when more then one active connection are there(e.g, Two GPRS and one WLAN Connection) means how i will get connection type.And in my application i want to use WLAN connection only.
    Here is my code.


    //Open a session with the socket server
    RSocketServ socketServer;

    TInt err (KErrNone);
    err = socketServer.Connect ();

    if ( err != KErrNone)
    {
    return;
    }

    LOGTXT( "Socket opened successfully" );

    //Open a subsession with the socket server for the RConnectionT
    RConnection myConnection;
    err = myConnection.Open (socketServer);

    if ( err != KErrNone)
    {
    return;
    }



    TUint connectionCount;
    //Enumerate currently active connections across all socket servers
    User::LeaveIfError (myConnection.EnumerateConnections (connectionCount));


    if ( connectionCount)
    {
    TPckgBuf<TConnectionInfoV2> connectionInfo;
    for (TUint i = 1; i <= connectionCount; ++i)
    {
    myConnection.GetConnectionInfo (i, connectionInfo);
    TInt iAccessPointId;
    iAccessPointId = connectionInfo ().iIapId;

    }
    }

    And i tried to get the connection type by using this code:
    _LIT( KIAPNetworkType, "IAP\\IAPNetworkType");
    TBuf<100> name;
    myConnection.GetDesSetting(KIAPNetworkType,name );

    But i did get any thing form this code.
    Can any body please help me on this issue.

    Thanks,
    kumarkk.

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: How to get the active connection connection type

    The below article shows you a link to establish WLAN connection API.

    WLAN

    Compare your code with the given code in the article...

  3. #3
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    51

    Re: How to get the active connection connection type

    Hi,

    Thanks for your reply.
    I already checked the link ,this is used to detect wlan indicator is there are not and to get device default mac address.
    and how i will use this code in my application. But my dough is how to know connection type of active connection.
    can any body suggest sample code please.

    Thanks,
    karteeka.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: How to get the active connection connection type

    RConnectionMonitor can tell you the parameters of active connections. GetIntAttribute+KBearer in particular.

  5. #5
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    51

    Re: How to get the active connection connection type

    I tried the code by using RConnectionMonitor,d here is my code
    /////////////////////////////////////////////////////////////////////
    RConnectionMonitor iConnMonitor;
    iConnMonitor.ConnectL ();
    //Open a session with the socket server
    RSocketServ socketServer;

    TInt err (KErrNone);
    err = socketServer.Connect ();

    if ( err != KErrNone)
    {
    return;
    }

    LOGTXT( "Socket opened successfully" );

    //Open a subsession with the socket server for the RConnectionT
    RConnection myConnection;
    err = myConnection.Open (socketServer);

    if ( err != KErrNone)
    {
    return;
    }



    TUint connectionCount;
    //Enumerate currently active connections across all socket servers
    User::LeaveIfError (myConnection.EnumerateConnections (connectionCount));


    if ( connectionCount)
    {
    TPckgBuf<TConnectionInfoV2> connectionInfo;
    for (TUint i = 1; i <= connectionCount; ++i)
    {
    myConnection.GetConnectionInfo (i, connectionInfo);
    TInt iAccessPointId;
    iAccessPointId = connectionInfo ().iIapId;
    TRequestStatus status;
    TConnMonBearerType iConnectionType;
    iConnMonitor.GetIntAttribute(iAccessPointId,0,KBearer,(TInt&)iConnectionType,status);
    LOGARG("iConnectionType value in rconnection::%d",iConnectionType);

    }
    }
    iConnMonitor.Close ();
    /////////////////////////////////////////////////////////////////////////////////////////////
    And here iConnectionType value i am getting is 7429123.So how to compare iConnectionType
    with TConnMonBearerType values(they are in 0,1,2,3,4,5,6,7,8).
    So can plz u suggest how compare the values.

    Thanks,
    kumarkk.

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to get the active connection connection type

    just bumbing here to give a link to a wiki exmaple that migth help: http://wiki.forum.nokia.com/index.ph...on_Example.zip

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: How to get the active connection connection type

    Do not mix RConnection and RConnectionMonitor, they work independently.
    Use RConnectionMonitor::GetConnectionCount+RConnectionMonitor::GetConnectionInfo in order to find out the first argument for GetXyAttribute.

  8. #8
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    51

    Re: How to get the active connection connection type

    hi,
    As u said i changed the code and tried like this .here is my code.

    RConnectionMonitor Monitor;
    TInt iAccessPointId ;
    Monitor.ConnectL ();
    // get number of active connections
    TUint count;
    TRequestStatus status;

    Monitor.GetConnectionCount( count, status );
    LOGARG("GetConnectionCount value in rconnection::%d",count);
    User::WaitForRequest( status );
    if ( status.Int() != KErrNone )
    {
    // error
    }
    TUint ID;
    TUint aSubConnectionCount;
    Monitor.GetConnectionInfo(1,ID,aSubConnectionCount);
    LOGARG("GetConnectionInfo value in rconnection::%d",ID);
    iAccessPointId = ID;
    TInt iConnectionType;
    Monitor.GetIntAttribute(ID,0,KBearer,iConnectionType,status);
    LOGARG("GetIntAttribute value in rconnection::%d",iConnectionType);
    Monitor.Close ();
    and the output iam getting like this
    GetConnectionCount value in rconnection::-120152383
    GetConnectionInfo value in rconnection::1
    GetIntAttribute value in rconnection::7382596.
    How i will compare this value with EBearerWLAN.
    can u pls tell me.

    Thanks,
    kumarkkk.

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: How to get the active connection connection type

    Remember that GetIntAttribute is an asynchronous service.

  10. #10
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    51

    Re: How to get the active connection connection type

    Hi,


    So any body have solution for this problem( I.e how to get the connection type of active connection).
    Is there any other way to get connection type.
    please suggest .


    Thanks,
    kumarkk.

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: How to get the active connection connection type

    I have suggested already.
    Quote Originally Posted by kumarkkk View Post
    Monitor.GetIntAttribute(ID,0,KBearer,iConnectionType,status);
    User::WaitForRequest(status);
    LOGARG("GetIntAttribute value in rconnection::%d",iConnectionType);

  12. #12
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    51

    Re: How to get the active connection connection type

    Hi,
    Thanks for u reply i got the solution.

    Thanks,
    kumarkk.

Similar Threads

  1. Replies: 1
    Last Post: 2009-04-01, 23:48
  2. Active connection recognition by MAC address.
    By ramis55 in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2008-07-10, 14:01
  3. Flash Lite and active connection
    By jappit in forum [Archived] Flash Lite on Nokia Devices
    Replies: 1
    Last Post: 2008-03-31, 10:24
  4. Replies: 6
    Last Post: 2007-08-03, 04:04
  5. How Check if a Bluetooth connection is active
    By AGiuliani in forum Bluetooth Technology
    Replies: 1
    Last Post: 2007-05-22, 09:16

Posting Permissions

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