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.

Retrieving currently active access point using Symbian C++

From Wiki
Jump to: navigation, search
Article Metadata
Platform(s): S60 2nd Edition, S60 2nd Edition FP1, FP2, and FP3
S60 3rd Edition, S60 3rd Edition FP1
S60 3rd Edition FP1
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
Created: User:Technical writer 2 (22 Nov 2006)
Last edited: hamishwillee (15 Jun 2012)


This article shows how to get the current active access point.


There are several instances where the system will prompt the user with an access point selection dialog. For example,

  • Initiating an HTTP connection
  • Downloading a file with Download Manager API
  • Opening a URL in Browser Control API
    It is possible to reuse the active access point.

A common use case would be opening an HTTP connection and starting a file download with Download Manager API. Reusing the access point prevents the AP selection dialog from being shown twice.


MConnectionMonitorObserver is an observer class that is provided to receive any event notifications like creation or deletion of a connection, IAP availability change etc. The client application must implement this interface in order to receive notifications. The steps involved are:

  1. Derive the MConnectionMonitorObserver mixin class and implement the callback function EventL():
  1. class CMyHTTPEngine : public MConnectionMonitorObserver
    // from MConnectionObserver
    void EventL(const CConMonEvenBase& aConnEvent);
    RConnectionMonitor iConnMon;
  2. Register to get notifications on events before allowing the user to make an HTTP connection
  1.     TInt err = iConnMon.ConnectL();
    iConnMon.NotifyEventL( *this );
    // … proceed to open HTTP connection
  2. Handle received events and detect the ID of the active IAP
  1.  CMyHTTPEngine::EventL(const CConMonEvenBase& aConnEvent)
    TInt event = aConnEvent.EventType();
    TUint connId = aConnEvent.ConnectionId();
    TUint iapId;
    TRequestStatus status;
    switch ( event )
    case EConnMonCreateConnection: // New connection created
    iConnMon.GetUintAttribute(connId, 0, KIAPId, iapId, status);
    // Cast aConnEvent to CConnMonCreateConnection if needed
    // GetStringAttribute(connId, 0, KIAPName, ...)
    User::WaitForRequest( status );
    case EConnMonCreateSubConnection: // Subconnection to an existing AP
    TUint subConnId;
    const CConnMonCreateSubConnection
    subConnEvent = (CConnMonCreateSubConnection)aConnEvent;
    subConnId = subConnEvent.SubConnectionId();
    iConnMon.GetUintAttribute(connId, subConnId, KIAPId, iapId, status);
    // Name of AP can be retrieved with
    // GetStringAttribute(connId, subConnId, KIAPName, ...)
    User::WaitForRequest( status );
    // Close the monitor when event notifications are no longer required
    // iConnMon.Close();

The observer can also be used for notifications on events like change in accessibility of an access point, deletion of an existing connection and changes in connection status.

This page was last modified on 15 June 2012, at 05:09.
46 page views in the last 30 days.