×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    2

    Problem with WLAN Access Point

    I'm trying to create an access point to connect two devices via an ad hoc connection, but i'm having a problem. The access point my device creates is in the commdb list, but others devices can't locate this access point.

    Code:
    	CCommsDatabase* db = CCommsDatabase::NewL();
    	CleanupStack::PushL(db);
    	TInt err = db->BeginTransaction();
    	
    	// Create a wlan AP and fill its mandatory fields.
    	CApAccessPointItem* wlanAp = CApAccessPointItem::NewLC();
    	CApAccessPointItem* wlanNewItem = CApAccessPointItem::NewLC();
    	
    	wlanAp->SetNamesL(_L("WRS_AP1"));
    	wlanAp->SetBearerTypeL(EApBearerTypeWLAN);
    	wlanAp->WriteTextL(EApWlanNetworkName, _L("WRSAP1"));  
    	// Give correct Data as per the router configuration  //L!nkSys@MdpNok!a
    	
    	//Lan network mode should be 1 for infrastructure, 0 for adhoc
    	wlanAp->WriteUint(EApWlanNetworkMode,1);
    	
    	wlanAp->WriteUint(EApWlanChannelId ,3);	
    	
    	// Setting up advanced settings for IP addressing
    	wlanAp->WriteTextL(EApWlanIpAddr ,_L("192.248.16.30"));	
    	wlanAp->WriteTextL(EApWlanIpNetMask ,_L("255.255.255.00"));
    	wlanAp->WriteTextL(EApWlanIpGateway ,_L("192.248.16.30"));
    	
    	TBool val =ETrue;
    	TUint32 newalanid;
    	
    	CApDataHandler* handler = CApDataHandler::NewLC(*db);
    	TUint32 apid;
    	apid = handler->CreateFromDataL(*wlanAp);
    	handler->UpdateAccessPointDataL(*wlanAp,val);
    	handler->AccessPointDataL(apid,*wlanNewItem); 
    	
    	CApUtils *aputil = CApUtils::NewLC(*db);
    	TUint32 wapuid = wlanAp->WapUid();
    	TInt Iap = aputil->IapIdFromWapIdL(wapuid);
    	
    	wlanNewItem->ReadUint( EApIapServiceId, newalanid );
    	TBuf<50>	ibuff;
    	wlanNewItem->ReadTextL( EApWlanNetworkName, ibuff ); 
    	TUint32 newAPId = wlanNewItem->WapUid();
    	
    	CCommsDbTableView* wLanServiceTable = db->OpenViewMatchingUintLC( TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), newalanid );
    	
    	TUint32 errorCode;
    	
    	errorCode = wLanServiceTable->GotoFirstRecord();
    	
    	TInt leaveError = 0;
    	
    	if ( errorCode == KErrNone )
    	{
    		wLanServiceTable->UpdateRecord();
    	}
    	else
    	{
    		TUint32 dummyUid( 10 );	//KUidNone
    		leaveError = User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) );
    		wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), apid );
    	}
    	
    	wLanServiceTable->PutRecordChanges();
    	err = db->CommitTransaction();
    	CleanupStack::PopAndDestroy(6);
    	
    //server is a RConnection object and connection is a RSocketServ
        TInt error;
        error = server.Connect(KESockDefaultMessageSlots);
        error = connection.Open(server, KConnectionTypeDefault);
        TCommDbConnPref prefs;
        prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
        prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
        prefs.SetIapId(Iap);
        error = connection.Start(prefs);
    What could be wrong? I'm stuck with this code for weeks and got no solution...

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

    Re: Problem with WLAN Access Point

    Read the comments in your code snippet.

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    2

    Re: Problem with WLAN Access Point

    Code:
    //Lan network mode should be 1 for infrastructure, 0 for adhoc
    wlanAp->WriteUint(EApWlanNetworkMode,1);
    I was using 1 to see if it could make any difference when other device trys to find the access point, but my biggest problem is the fact that the access point that the device creates isn't seen by any other device. It's not about being adhoc or infrastructure.

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

    Re: Problem with WLAN Access Point

    Just for verification, you could try creating the access point manually, and check if other devices happen to find it in that case (after powering up the interface with a simple "error = connection.Start();" of course).
    For setting the addresses and the channel, use the Advanced settings from the menu.

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    311

    Re: Problem with WLAN Access Point

    wlanAp->WriteTextL(EApWlanNetworkName, _L("WRSAP1"));

    may be the WRSAP1 is not exist?
    or WRSAP1 signal is very bad?

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

    Re: Problem with WLAN Access Point

    Quote Originally Posted by lmyuanhang View Post
    wlanAp->WriteTextL(EApWlanNetworkName, _L("WRSAP1"));

    may be the WRSAP1 is not exist?
    or WRSAP1 signal is very bad?
    Generally he wants to create an Ad-Hoc network, so WRSAP1 does not have to exist. The posted snippet is a broken one I assume.

Similar Threads

  1. How can I create a WLAN access point without using standart AP-selecting dialog 2009
    By olkazmin in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2009-03-25, 07:05
  2. Problem with Access point selection on N95.
    By jvinjam in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2009-02-08, 18:41
  3. Access Point Problem on Emulator
    By IlyaEck in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2004-09-06, 01:32
  4. Why is client code to CSocketEngine hanging at Access Point dialogue?
    By nawkboy in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2003-03-11, 11:16
  5. Replies: 0
    Last Post: 2003-02-24, 04:00

Posting Permissions

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