×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    10

    Question How to Add WLAN Configuration to my Phone and Connect to it

    Hi,

    i use below given code to add a wlan configuration in my phone and connect to it, but it does not work.
    any pointer to fix this ?

    TInt error;
    CApAccessPointItem *wlan = CApAccessPointItem::NewLC();
    wlan->SetNamesL(_L("NewAP"));
    wlan->SetBearerTypeL(EApBearerTypeWLAN);
    wlan->WriteTextL(EApWlanNetworkName, _L("MyWlan"));
    wlan->WriteUint(EApWlanSecurityMode,EWep);
    // security mode 2 refers to WEP.
    wlan->WriteUint(EApWlanNetworkMode,1);
    // network mode refers to whether its AdHoc or Infrastructure mode.

    CCommsDatabase *commDb = CCommsDatabase::NewL();
    CleanupStack::PushL(commDb);
    CApDataHandler *handler = CApDataHandler::NewLC(*commDb);
    TInt err = commDb->BeginTransaction();
    TUint32 newApId = handler->CreateFromDataL(*wlan);
    CleanupStack::PopAndDestroy(3); // handler, commDb, wlan

    CApAccessPointItem *wlanNew1 = CApAccessPointItem::NewLC();
    handler->AccessPointDataL(newApId,*wlanNew1);
    //wlanNew1 is an object of CApAccessPointItem
    TUint32 newalanid;
    wlanNew1->ReadUint( EApIapServiceId, newalanid );

    // we need to get the IAP id to manupulate the security settings.


    iKeyData.Copy(_L("*************"));
    //Should be the same value to which the WLAN router is configured
    iKeyFormat=EAscii; // TWEPKeyFormat
    iAuthentication=EAuthShared; // TWEPAuthentication
    iKeyInUse=EKeyNumber1; // TWEPKeyInUse

    CCommsDbTableView *wLanServiceTable = commDb->OpenViewMatchingUintLC(
    TPtrC( WLAN_SERVICE ),
    TPtrC( WLAN_SERVICE_ID ),
    newalanid
    );
    // Give the corresponding IAP ID

    TInt 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_Key1 ),
    iKeyData )
    )

    // Save the format of the key (Hexadecimal or Ascii)
    wLanServiceTable->WriteUintL(
    TPtrC( WLAN_WEP_KEY1_FORMAT ),
    ( TUint32& ) iKeyFormat
    );
    wLanServiceTable->PutRecordChanges();
    err = commDb->CommitTransaction();
    CleanupStack::PopAndDestroy(wLanServiceTable);
    Last edited by @Rainier; 2010-12-07 at 08:24.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: How to Add WLAN Configuration to my Phone and Connect to it

    How does not it work? What happens?
    Have you added the necessary capabilities to your project?

  3. #3
    Registered User
    Join Date
    Dec 2010
    Posts
    10

    Question Re: How to Add WLAN Configuration to my Phone and Connect to it

    Quote Originally Posted by wizard_hu_ View Post
    How does not it work? What happens?
    Have you added the necessary capabilities to your project?

    Yes, added necessary capabilities.
    its crashing @ handler->AccessPointDataL(newApId,*wlanNew1)

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: How to Add WLAN Configuration to my Phone and Connect to it

    Try to get the actual error message: http://wiki.forum.nokia.com/index.ph...ded_panic_code

  5. #5
    Registered User
    Join Date
    Dec 2010
    Posts
    10

    Re: How to Add WLAN Configuration to my Phone and Connect to it

    EExcDataAbort=23

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: How to Add WLAN Configuration to my Phone and Connect to it

    If that comes from Panic Observer or something, try the simpler way and install that ErrRd file (described in the Note boxes).

  7. #7
    Registered User
    Join Date
    Dec 2010
    Posts
    10

    Re: How to Add WLAN Configuration to my Phone and Connect to it

    Quote Originally Posted by wizard_hu_ View Post
    If that comes from Panic Observer or something, try the simpler way and install that ErrRd file (described in the Note boxes).
    Yaa, i tried with ErrRd .

    it says KERN-EXEC 3

  8. #8
    Registered User
    Join Date
    Dec 2010
    Posts
    10

    Question Re: How to Add WLAN Configuration to my Phone and Connect to it

    hi,I've been able to create a WLAN access point now , Thank you.
    but WEP key is created as 64-bit ascii,my router's configuration as 128-bit ascii. how to format WEP key correctly.

Similar Threads

  1. WLAN access point configuration sms
    By juliaf in forum OMA DM/DS/CP
    Replies: 3
    Last Post: 2009-08-26, 16:10
  2. Wlan configuration through Python?
    By nadavaha in forum Symbian
    Replies: 1
    Last Post: 2009-03-06, 04:35
  3. Add WLAN AP
    By nmnir in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-12-20, 09:40
  4. Add WLAN AP
    By nmnir in forum Symbian
    Replies: 3
    Last Post: 2007-12-12, 07:46
  5. WLAN Configuration on N80 / Symbian 9.1
    By hmleung in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-06-10, 04:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×