Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Determine the bearer type using RConnectionMonitor API

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): All (S60)
Platform(s): S60 3rd Edition
S60 5th Edition
S60 5th Edition
S60 3rd Edition (initial release)
Keywords: RConnectionMonitor, GetIntAttribute, KBearer
Created: User:Kbwiki (23 Apr 2010)
Last edited: hamishwillee (01 Aug 2012)


The RConnectionMonitor class provides methods for retrieving the bearer type of the current active network connection. The count of all active connections can be retrieved using RConnectionMonitor::GetConnectionCount(). Then, for each active connection, we can retrieve the connection ID and count of subconnections using RConnectionMonitor::GetConnectionInfo(). Once the connection ID is available we can determine the bearer type using RConnectionMonitor::GetIntAttribute () by passing the attribute KBearer for the desired connection.

Note however that the NetworkControl capability is required to retrieve this information.


Required Headers & Libraries:

 #include <rconnmon.h> // Link against connmon.lib


  RConnectionMonitor monitor;
TRequestStatus status1, status2;
TInt bearerType( 0 );
TUint connectionCount( 0 );
TUint subConnectionCount( 0 );
TUint connectionId( 0 );
monitor.ConnectL(); // Open RConnectionMonitor object
// Get connection count
monitor.GetConnectionCount( connectionCount, status1 );
User::WaitForRequest( status1 );
if ( status1.Int() != KErrNone )
// Handle errors
if ( connectionCount == 0 )
// No connection
// Get connection info of all the active connections
for ( TUint idx = 1; idx <= iConnectionCount; idx++ )
// Get the connection id
TInt error = monitor.GetConnectionInfo( idx, connectionId,
subConnectionCount );
if ( error != KErrNone )
// Handle errors
// Retrieve the bearer type - on return, bearerType will
// contain one of the values in TConnMonBearerType enumeration
monitor.GetIntAttribute( connectionId, 0, KBearer, bearerType, status2 );
User::WaitForRequest( status2 );
if ( status2.Int() != KErrNone )
// Handle errors
monitor.Close(); // Close RConnectionMonitor object

Required Capabilities: NetworkControl

This page was last modified on 1 August 2012, at 04:39.
33 page views in the last 30 days.