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.

Creating, deleting, editing, and listing WLAN access points 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}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Platform(s): S60 3rd Edition
S60 3rd Edition (initial release)
Created: User:Technical writer 2 (21 Sep 2006)
Last edited: lpvalente (11 Jun 2014)



Creating, deleting, editing, and listing WLAN access points


Sometimes S60 3rd-party applications may want to provide the functionality for managing access points through their UI. It is possible for applications to programmatically create, edit, and delete access points. To create, delete, edit, and list WLAN APs, the following headers / libraries are used:

MMP File

This snippet requires the following libraries:

LIBRARY commdb.lib
LIBRARY apengine.lib


#include <commdb.h>  // link against 
#include <apselect.h> // link against apengine.lib
#include <aplistitem.h>
#include <apdatahandler.h>
#include <apaccesspointitem.h>
#include <aputils.h>

A short example for each type of operation:

Creating an access point:

CApAccessPointItem *wlan = CApAccessPointItem::NewLC();
wlan->WriteTextL(EApWlanNetworkName, _L("WlanAP"));
// Store it into the CommsDb
CCommsDatabase *commDb = CCommsDatabase::NewL();
CApDataHandler *handler = CApDataHandler::NewLC(*commDb);
TUint32 newApId = handler->CreateFromDataL(*wlan);
CleanupStack::PopAndDestroy(3); // handler, commDb, wlan

Removing an access point:

handler->RemoveAPL(myUid); // myUid: ID of an AP to remove

Editing an access point:

handler->AccessPointDataL(myUid, *wlan); // myUid: ID of an AP to edit
TInt err;
err = wlan->WriteTextL(EApWlanNetworkName, _L("NewName"));
// EApWlanNetworkName is the column to edit.
// Other columns are listed in ApAccessPointItem.h
TBool nameChanged;
handler->UpdateAccessPointDataL(*iaccessPoint, nameChanged);

Getting the UID of the access points:

// The UIDs of access points can be retrieved as follows: 
CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
CApSelect* select = CApSelect::NewLC(*commDb, KEApIspTypeAll, EApBearerTypeWLAN, /* use EApBearerTypeAll for all types */KEApSortUidAscending);
TBuf<256> accessPoints; _LIT(KAPInfoTxtFormat, "[%d]%S ");
TBool ok = select->MoveToFirst();
for(TInt i = 0; ok && (i < select->Count()); i++)
ok = select->MoveNext();
CleanupStack::PopAndDestroy(2); // select, commDb
// accessPoints descriptor now contains WLAN AP IDs + names
This page was last modified on 11 June 2014, at 17:15.
73 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.