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

This page was last modified 11:01, 2 February 2008.

WLAN Settings UI API

From Forum Nokia Wiki

Note!
This API is not part of the public SDK. It can be found in the SDK API Plug-in.


Purpose

WLAN settings UI API provides necessary functionality for launching a WLAN settings view.

It also gives the Comms Db column names to set the security settings of WLAN access point.

Use cases

To create a WLAN access point.

Example code

For example lets see how to create a WLAN access point with WEP security settings:

Headers and Libraries required

#include <commdb.h>        // link against commdb.lib
#include <apselect.h>      // link against apengine.lib
#include <aplistitem.h>
#include <apdatahandler.h>
#include <apaccesspointitem.h>
#include <wlancdbcols.h>   // for security settings
CApAccessPointItem *wlan = CApAccessPointItem::NewLC();
wlan->SetNamesL(_L("NewAP"));
wlan->SetBearerTypeL(EApBearerTypeWLAN);
wlan->WriteTextL(EApWlanNetworkName, _L("WlanAP"));
wlan->WriteUint(EApWlanSecurityMode,2); // security mode 2 refers to WEP. 
wlan->WriteUint(EApWlanNetworkMode,1); 
// network mode refers to whether its AdHoc or Infrastructure mode.
 
// Store it into the CommsDb
CCommsDatabase *commDb = CCommsDatabase::NewL();
CleanupStack::PushL(db);
CApDataHandler *handler = CApDataHandler::NewLC(*commDb);
TInt err = commDb ->BeginTransaction();
TUint32 newApId = handler->CreateFromDataL(*wlan);
CleanupStack::PopAndDestroy(3); // handler, commDb, wlan
 
//Setting the security settings:
 
enum TWEPKeyFormat
    {
    EAscii,                 // Ascii format
    EHexadecimal            // Hex format
    };
    
    enum TWEPKeyInUse
    {
    EKeyNumber1,            // Key number 1
    EKeyNumber2,            // Key number 2
    EKeyNumber3,            // Key number 3
    EKeyNumber4             // Key number 4
    };
 
enum TWEPAuthentication
    {
    EAuthOpen,              // Open authentication
    EAuthShared             // Shared authentication
    };
 
handler->AccessPointDataL(newApId,*wlanNew1); 
//wlanNew1 is an object of CApAccessPointItem 
wlanNew1->ReadUint( EApIapServiceId, newalanid );
// we need to get the IAP id to manupulate the security settings.
					
iKeyData.Copy(_L("626ABB616A"));
//Should be the same value to which the WLAN router is configured
 
iKeyFormat=EAscii;           // TWEPKeyFormat
iAuthentication=EAuthShared; // TWEPAuthentication
iKeyInUse=EKeyNumber3;       // TWEPKeyInUse
 
wLanServiceTable = db->OpenViewMatchingUintLC( TPtrC( WLAN_SERVICE ), 
TPtrC( WLAN_SERVICE_ID ), newalanid );  // Give the corresponding IAP ID
        
errorCode = wLanServiceTable->GotoFirstRecord();
 
TBool ival =ETrue;
	if ( errorCode == KErrNone )
        {
        wLanServiceTable->UpdateRecord();
      			
        }
   	else
        {
        TUint32 dummyUid( KUidNone );
        User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) );
        // Save link to LAN service
	wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), newApId);
        }
 
// Save index of key in use (1,2,3 or 4)
TRAP(error,wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_INDEX ),
( TUint32& ) iKeyInUse ));
					 
// Save the authentication type (shared or Open)
TRAP(error,wLanServiceTable->WriteUintL( TPtrC( WLAN_AUTHENTICATION_MODE ),
( TUint32& )iAuthentication ));
					 
// save the correct keydata corresponding to the router configuration
TRAP(error,wLanServiceTable->WriteTextL( TPtrC( WLAN_WEP_KEY3 ), iKeyData ));
					 
// Save the format of the key (Hexadecimal or Ascii)
wLanServiceTable->WriteUintL( TPtrC( LAN_WEP_KEY3_FORMAT ),
( TUint32& ) iKeyFormat );
 
wLanServiceTable->PutRecordChanges();
 
err = db->CommitTransaction();    
// End a transaction. Call after `InsertRecord()` or `UpdateRecord()`.

NOTE: The Key In Use, the Key format and the Key data should be the same as the WLAN router or else the connection will not be established.

Example project

Example application

Related Discussions
Thread Thread Starter Forum Replies Last Post
Leaf updation not working for CA certificate in EAP plug-in settings lal.rajan OMA DM/DS/CP 0 2008-01-22 07:04
N80 and WLAN security mechanism whatsthis Symbian Signing, Certification and Security 7 2006-08-31 08:22
WEP key of WLAN IAP? chishti_hameed Symbian Networking & Messaging 5 2006-10-23 21:03
WLAN /GSM switch and SIP stack jcaradec Symbian Networking & Messaging 0 2007-01-31 08:49
Using SCCP over VPN on a e61i woepkes VoIP 0 2007-10-30 20:30
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZconnectivityQ
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtopicQUqfnTopicZwlanQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX