Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 5.0 / 5
(5.0 / 5 - 1 vote cast)

This page was last modified 10:42, 24 August 2007.

TSS000418 - Creating, deleting, editing, and listing WLAN access points

From Forum Nokia Wiki


Subject:

Creating, deleting, editing, and listing WLAN access points TSS000418

 

Platform(s): Device(s), SW version(s):
S60 3rd Edition  

Category:

Symbian C++

Subcategory:

Networking
CommDB

Description:

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:
#include <commdb.h>          // link against commdb.lib
#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->SetNamesL(_L("NewAP"));
wlan->SetBearerTypeL(EApBearerTypeWLAN);
wlan->WriteTextL(EApWlanNetworkName, _L("WlanAP"));
// Store it into the CommsDb
CCommsDatabase *commDb = CCommsDatabase::NewL();
CleanupStack::PushL(db);
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);
CleanupStack::PushL(commDb);
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++)
    {
    accessPoints.AppendFormat(
        KAPInfoTxtFormat,
        select->Uid(),
        &select->Name());
    ok = select->MoveNext();       
    }
CleanupStack::PopAndDestroy(2); // select, commDb
// accessPoints descriptor now contains WLAN AP IDs + names

Creation date:

September 21, 2006

Last modified:

-
Related Discussions
Thread Thread Starter Forum Replies Last Post
S60 3rd WLAN airmax Mobile Java Networking & Messaging & Security 2 2006-05-04 13:07
n80 WLAN authorization manjax Wired and Wireless interfaces 0 2006-12-19 11:57
syncml setting for 6230 hsinyee OMA DM/DS/CP 2 2005-08-25 07:33
S40 3rd FP2 File API and directory mariosas Mobile Java General 14 2007-11-22 08:19
Using File Transfer with Nokia 3650 vkulesh Bluetooth Technology 1 2003-07-14 08:55
 
Powered by MediaWiki