×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Creating a connection via WLAN Ad-Hoc Mode

    Hi All,

    I have created an Access point for WLAN Ad-Hoc Mode in my phone (E65 and E61i). But I cant detect that access point using the other phone. How can I do that ? I want to connect two phones using WiFi Ad-Hoc mode.

    How can i do that ?

    Regards and Thanks
    Primal

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

    Re: Creating a connection via WLAN Ad-Hoc Mode

    If you change Network Status to Public, other devices will be able to see your Ad-hoc WLAN. However they will not be able to connect - at least I have no success with that.
    So you have to configure the "access point" on both devices (manually as a first try).
    The client will ask you what to do when you issue RSocket::Connect.
    The server is a bit harder, you have to explicitly join the network with RConnection::Start, then
    - you can either configure a fix IP address in Advanced settings (in the access point configuration) - if you choose this one, it is preferably done on the client-side too
    - or detect the automatically negotiated IP address as described in the (currently) neighboring thread http://discussion.forum.nokia.com/fo...d.php?t=125171 for example

  3. #3
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Thanx a lot wizard_hu,

    I've got another problem, when i executed the following code, nothing happned. I mean, the created access point should appear in Access points tab in connections in tools.

    CApAccessPointItem *wlan = CApAccessPointItem::NewLC();
    wlan->SetNamesL(_L("myWLAN_IAP"));
    wlan->SetBearerTypeL(EApBearerTypeWLAN);
    wlan->WriteTextL(EApWlanNetworkName, _L("mySSID"));
    // Store it into CommDb
    CCommsDatabase *db = CCommsDatabase::NewL();
    CleanupStack::PushL(db);
    CApDataHandler *handler = CApDataHandler::NewLC(*db);
    TUint32 apId = handler->CreateFromDataL(*wlan);

    What could be the reason ?

    Regards n Thanx,
    primal

  4. #4
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Re: Creating a connection via WLAN Ad-Hoc Mode

    As it is mentioned, When we create an Ad Hoc mode access point we have specifically create a connection to it...

    Quote Originally Posted by wizard_hu_ View Post
    The server is a bit harder, you have to explicitly join the network with RConnection::Start, then
    - you can either configure a fix IP address in Advanced settings (in the access point configuration) - if you choose this one, it is preferably done on the client-side too
    But how we can get the access point ID and network ID to create the connection to it ? When I create an Ad Hoc mode access point, it is not detected by the phone ...

    Regards,
    Primal

  5. #5
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Bangalore, India
    Posts
    122

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Quote Originally Posted by primal View Post
    Thanx a lot wizard_hu,

    I've got another problem, when i executed the following code, nothing happned. I mean, the created access point should appear in Access points tab in connections in tools.

    CApAccessPointItem *wlan = CApAccessPointItem::NewLC();
    wlan->SetNamesL(_L("myWLAN_IAP"));
    wlan->SetBearerTypeL(EApBearerTypeWLAN);
    wlan->WriteTextL(EApWlanNetworkName, _L("mySSID"));
    // Store it into CommDb
    CCommsDatabase *db = CCommsDatabase::NewL();
    CleanupStack::PushL(db);
    CApDataHandler *handler = CApDataHandler::NewLC(*db);
    TUint32 apId = handler->CreateFromDataL(*wlan);

    What could be the reason ?

    Regards n Thanx,
    primal
    you may have to add an extra line for that:

    Code:
    handler->UpdateAccessPointDataL(*wlan,ETrue);
    regards.
    - Raj -

  6. #6
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Thanx Raj,

    But there is another problem when it is executing
    Code:
    TUint32 apId = handler->CreateFromDataL(*wlan);
    in the above code it gives the error "System error (-1)" in emulator and when it runs in the phone nothing happened even with the
    Code:
    handler->UpdateAccessPointDataL(*wlan,ETrue);
    . What could be the reason ?

    How can I specifically say that the new access point that I am creating should be in the Ad-Hoc mode not in the infrastructure mode ?

  7. #7
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Bangalore, India
    Posts
    122

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Then I beleive that u are not updating the comms data base, that will bring your created AP to the list. Well here is a sample code. This will create the APN for you.

    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("MyApn"));
    	wlanAp->SetBearerTypeL(EApBearerTypeWLAN);
    	wlanAp->WriteTextL(EApWlanNetworkName, _L("MySSid"));  // Give corrct Data as per the router configuration  //L!nkSys@MdpNok!a
    
    	//Lan network mode should be 1 for infrastructure, 0 for adhoc
    	wlanAp->WriteUint(EApWlanNetworkMode,0);
    	TBool val =ETrue;
    	TUint32 newalanid;
    
    	CApDataHandler* handler = CApDataHandler::NewLC(*db);
    	TUint32 apid;
    	apid = handler->CreateFromDataL(*wlanAp);
    	handler->UpdateAccessPointDataL(*wlanAp,val);
    	handler->AccessPointDataL(apid,*wlanNewItem); 
    	wlanNewItem->ReadUint( EApIapServiceId, newalanid );
    	TBuf<50>	ibuff;
    	wlanNewItem->ReadTextL( EApWlanNetworkName, ibuff ); 
    
    	CCommsDbTableView* wLanServiceTable = db->OpenViewMatchingUintLC( TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), newalanid );
    	errorCode = wLanServiceTable->GotoFirstRecord();
        
    	if ( errorCode == KErrNone )
    	{
    		wLanServiceTable->UpdateRecord();
    	}
    	else
    	{
    		TUint32 dummyUid( 10 );	//KUidNone
    		User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) );
    		wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), apid );
    	}
    
    	wLanServiceTable->PutRecordChanges();
    	err = db->CommitTransaction();
    	CleanupStack::PopAndDestroy(5);
    Regards,
    - Raj -

  8. #8
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Hey Thanx Raj,

    If I am not mistaken, by using "newalanid" in the below code, I can create a connection to the ad hoc access point that created and open a socket connection. Is it possible ?

    Can we assign a IPv4 for this access point using the code ?

    Regards,
    Primal

  9. #9
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Bangalore, India
    Posts
    122

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Yes you can provide those values also to the created AP. But whether your AP is now comming in the APN list or not. And if yes, whether it the setting required by you(that is Ad-hoc).

    Well to provide Ipv4 and proxy related values to the AP you can use the CommsDb for updating those fields.It has a big list to be updated.

    Regards
    - Raj -

  10. #10
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Thanx Raj,

    If I create it successfully, is it possible to connect to it using sockets ? And if another phone wants to connect to that AP, Can it be done using the provided IP in AP ?

    Regards,
    Primal

  11. #11
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Bangalore, India
    Posts
    122

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Hi,

    Sorry but I am not sure for that. I have never tried this. But sounds like you cna do so.
    If you succed then please let us also know that.

    Regards,
    - Raj -

  12. #12
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Sure I will share it with you all,

    But I have another issue, when creating an access point, in the WiKi example for creating an access point it has mentioned
    For Symbian OS v9.1 necessary to use capability 'WriteDeviceData', else CreateFromDataL() generate leave KErrAbort (-39).
    I am using Symbian 9.1. Can any one say how you can use "WriteDeviceData" instead of "CreateFromDataL()". I too have experienced this problem and coz of this I cant move forward. Can any propose a workaround for this ?

    Regards,
    Primal

  13. #13
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Access Denied when creating an access point

    Hi,

    In creating an access point, I added the capability "WriteDeviceData" to the application unless CreateFromDataL() generate leave KErrAbort (-39).

    But when I install it in the phone (E65) it gave me the error "Required application access not granted". I am using a self signed certificate.

    What could be the reason ? How can I overcome it ?

    Regards,
    Primal

  14. #14
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Moratuwa, Sri Lanka
    Posts
    86

    Re: Creating a connection via WLAN Ad-Hoc Mode

    Hi All,

    To use the "WriteDeviceData" capability, do you need a developer certificate ? Can't I do it with the self signed certificate? I need this to create an access point via the code.

    Regards,
    Primal

Similar Threads

  1. Problem in build with S60 1FP
    By Manuelito_ in forum Symbian Tools & SDKs
    Replies: 14
    Last Post: 2007-09-18, 12:08
  2. creating socket over WLAN network, question
    By tomasz.florczak in forum Wired and Wireless interfaces (Closed)
    Replies: 3
    Last Post: 2007-06-28, 06:47
  3. UDP Socket connection on E61 with WLan
    By inguvaseshu in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2006-10-03, 10:14
  4. Park Mode and Connection
    By dolphinche in forum Bluetooth Technology
    Replies: 0
    Last Post: 2005-07-19, 10:14
  5. Creating a secure WTLS connection
    By MaverickUk in forum Mobile Commerce
    Replies: 1
    Last Post: 2002-11-25, 06:56

Posting Permissions

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