Revision as of 08:29, 14 June 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:How can I create a WLAN access point and automatically connect to it?

From Nokia Developer 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
Platform(s): S60 3rd Edition
S60 3rd Edition (initial release)
Created: User:Technical writer 2 (05 Oct 2006)
Last edited: hamishwillee (14 Jun 2012)


How can I create a WLAN access point and automatically connect to it?


Below is a code snippet for creating a WLAN access point and automatically connecting to it with RConnection.
    // Create a WLAN AP and fill in its mandatory fields.
    CApAccessPointItem *wlan = CApAccessPointItem::NewLC();
    wlan->WriteTextL(EApWlanNetworkName, _L("mySSID"));
    // Store it into CommDb
    CCommsDatabase *db = CCommsDatabase::NewL();
    CApDataHandler *handler = CApDataHandler::NewLC(*db);
    TUint32 apId = handler->CreateFromDataL(*wlan);

    CApUtils *aputil = CApUtils::NewLC(*db);
    TUint32 wapuid = wlan->WapUid();
    TInt Iap = aputil->IapIdFromWapIdL(wapuid);

    // Remove the comments below to run the AP settings dialog,
    // in case the AP needs to have WEP setting etc. entered
    CApSettingsHandler *settings =
            EApSettingsSelMenuNormal, 0, 0, 0);
    settings->RunSettingsL(apId, apId);
    CleanupStack::PopAndDestroy(4); // (5) if CApSettingsHandler is used
    // Create an RConnection using a defined IAP
    RSocketServ server;
    RConnection connection;
    TInt error;
    error = server.Connect(KESockDefaultMessageSlots);
    error = connection.Open(server, KConnectionTypeDefault);
    TCommDbConnPref prefs;
    error = connection.Start(prefs);


    // Close connection / server
    // connection.Close();
    // server.Close();

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