Namespaces

Variants
Actions

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 over the next few weeks. Thanks for all your past and future contributions.

Archived:Retrieving the list of applications using an active connection using Symbian C++

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): S60 (All)
Compatibility
Platform(s): S60 3rd Edition
S60 5th Edition
S60 3rd Edition (initial release)
Article
Keywords: RConnectionMonitor, KClientInfo
Created: User:Kbwiki (23 Nov 2009)
Last edited: hamishwillee (14 Jun 2012)

Description

The RConnectionMonitor class provides methods for resolving the UIDs of applications which are using a specific connection. The list of application UIDs is retrieved by passing a valid connection of an existing connection ID and a KClientInfo attribute for the RConnectionMonitor::GetPckgAttribute() method. The results are obtained through a package from which the UIDs can be read.

Solution

Required Headers & Libraries:

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

Code:

 RConnectionMonitor monitor;
TRequestStatus status1, status2;
TUint connectionCount( 0 );
TUint subConnectionCount( 0 );
TUint connectionId( 0 );<br>
monitor.ConnectL(); // Open RConnectionMonitor object<br>
// Get connection count
monitor.GetConnectionCount( connectionCount, status1 );
User::WaitForRequest( status1 );<br>
if ( status1.Int() != KErrNone )
{
// Handle errors
}
if ( connectionCount == 0 )
{
// No connection
}
 
// Get connection info of the 1st connection
TInt error = monitor.GetConnectionInfo( 1, connectionId, subConnectionCount );
if ( error != KErrNone )
{
// Handle errors
}
 
// Get connection client info
TConnMonClientEnumBuf buf;
monitor.GetPckgAttribute( connectionId, 0, KClientInfo, buf, status2 );
User::WaitForRequest( status2 );
if ( status2.Int() != KErrNone )
{
// Handle errors
}
TUint clientCount = buf().iCount; //number of clients
for ( TInt i = 0; i < clientCount; i++ )
{
TUid uid = buf().iUid[i]; //UID of the client
//...
}
 
monitor.Close(); // Close RConnectionMonitor object

Required Capabilities: NetworkControl

This page was last modified on 14 June 2012, at 07:29.
78 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×