×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    43

    WiFi ad-hoc connection

    Hello,

    If I have two S60, WiFi enabled phones, can I set up wifi ad-hoc connection between them (to allow them to talk to each other)?
    Have anyone done that before ?

    Regards,
    K.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: WiFi ad-hoc connection

    You can find examples in the Wiki, basically the minimum set is
    Code:
        CCommsDatabase *db=CCommsDatabase::NewL();
        CleanupStack::PushL(db);
        
        CApAccessPointItem *item=CApAccessPointItem::NewLC();
        
        item->SetNamesL(_L("Amorg Ad-Hoc")); // Name of access point
        item->SetBearerTypeL(EApBearerTypeWLAN); // WLAN
        item->WriteTextL(EApWlanNetworkName,_L("AmorgNet")); // SSID
        item->WriteUint(EApWlanNetworkMode,0); // Ad-Hoc
        
        CApDataHandler *handler=CApDataHandler::NewLC(*db);
        handler->CreateFromDataL(*item);
            
        CleanupStack::PopAndDestroy(3); // handler, item, db

  3. #3
    Registered User
    Join Date
    Nov 2008
    Location
    Russia, Tomsk, GMT+6
    Posts
    40

    Re: WiFi ad-hoc connection

    Hello there,

    First of all I would like to thank wizard_hu_ for his useful answers, they really help. And here is the question.

    I used sample code from your last post in this thread to create WLan adhoc AP. But now I cannot see it's properties through "Destinations" menu (Settings -> Connectivity -> Destinations). This AP was created in "Uncategorized" group, and when I'm trying to open that group, I recieve error message "Settings: Feature is not supported (-5)". Through other apps I can see that my AP was created succesfully, but I neither see it's settings nor delete it now! Is there any suggestions about it? Of course I can try to delete or alter it programmatically, but I believe that there should be more graceful way.

    Thanks in advance.

  4. #4
    Registered User
    Join Date
    Nov 2008
    Location
    Russia, Tomsk, GMT+6
    Posts
    40

    Re: WiFi ad-hoc connection

    And I forgot to mention that after this error message Settings app become unworking (cannot see properties of other APs and even open menu or simply exit). And one more note: my phone is N97, and I use N97 SDK.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: WiFi ad-hoc connection

    Unfortunately I have no idea. In fact these CAp* API-s are subject to deprecation already - so it may easily happen that they do not set something by default. It is nice to see that they still work to some extent, but they are API-s originating before this SNAP/grouping concept has appeared.
    You should try the Wiki, if you search for combinations of creating, internet, access, point, iap, you will find many related articles (note that combinations really matter, so you may find different articles when searching for "creating access point" or "creating internet" for example).

  6. #6
    Registered User
    Join Date
    Nov 2008
    Location
    Russia, Tomsk, GMT+6
    Posts
    40

    Re: WiFi ad-hoc connection

    Hello, wizard_hu_,

    Since your answer I tried to create wifi adhoc AP using CommsDat. But I found that that way is not very simple, mostly becausy there's too little information about CommsDat database structure available (or maybe I'm searching wrong information). So the problem is as follows:

    I used sample code from SDK documentation to deal with CommsDat API. I decided first to see properties of existing wifi adhoc AP, which was created manually. But I've ran into the troubles. The main trouble is that I cannot access none of linked tables from IAP table record, as all of the iLinkedRecord members of table links are nulls. Here is my code:

    Code:
    CMDBSession* iDb = CMDBSession::NewL(CMDBSession::LatestVersion());
    
    CMDBRecordSet<CCDIAPRecord>*  ptrIapRecordSet = 
       new (ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord);
    
    ptrIapRecordSet->LoadL(*iDb);
    	    
    _LIT(KRecordName, "Record name");
    _LIT(KBearerType, "Bearer Type");
    _LIT(KServiceType, "Service Type");
    _LIT(KButt1,"Button1"); 
    _LIT(KButt2,"Button2"); 
    TInt whichbutton(-1); 
    TRequestStatus stat;
    TInt i(0);
    RNotifier notifier;
    while (i < ptrIapRecordSet->iRecords.Count())
    	{
    	CCDIAPRecord* ptrIapRecord = 
    		    static_cast<CCDIAPRecord *>(ptrIapRecordSet->iRecords[i]);
    	 
    	User::LeaveIfError(notifier.Connect()); 
    	notifier.Notify(KRecordName,ptrIapRecord->iRecordName,KButt1,KButt2,whichbutton,stat); 
    	User::WaitForRequest(stat); 		
    	notifier.Notify(KBearerType,ptrIapRecord->iBearerType,KButt1,KButt2,whichbutton,stat); 
    	User::WaitForRequest(stat);
    	notifier.Notify(KServiceType,ptrIapRecord->iServiceType,KButt1,KButt2,whichbutton,stat); 
    	User::WaitForRequest(stat);
    	
    	if (ptrIapRecord->iService.iLinkedRecord != 0) //all of these records are null
    		{//I never get here
    		_LIT(KMsg, "ptrIapRecord->iService.iLinkedRecord != 0");
    		_LIT(KHead, "iService");
    		notifier.Notify(KHead,KMsg,KButt1,KButt2,whichbutton,stat);
    		User::WaitForRequest(stat);
    		}
    	if (ptrIapRecord->iBearer.iLinkedRecord != 0) //all of these records are null
    		{//I never get here
    		_LIT(KMsg, "ptrIapRecord->iBearer.iLinkedRecord != 0");
    		_LIT(KHead, "iBearer");
    		notifier.Notify(KHead,KMsg,KButt1,KButt2,whichbutton,stat);
    		User::WaitForRequest(stat);
    		}
    	if (ptrIapRecord->iNetwork.iLinkedRecord != 0) //all of these records are null
    		{//I never get here
    		_LIT(KMsg, "ptrIapRecord->iNetwork.iLinkedRecord != 0");
    		_LIT(KHead, "iNetwork");
    		notifier.Notify(KHead,KMsg,KButt1,KButt2,whichbutton,stat);
    		User::WaitForRequest(stat);
    		}
    	if (ptrIapRecord->iLocation.iLinkedRecord != 0) //all of these records are null
    		{//I never get here
    		_LIT(KMsg, "ptrIapRecord->iLocation.iLinkedRecord != 0");
    		_LIT(KHead, "iLocation");
    		notifier.Notify(KHead,KMsg,KButt1,KButt2,whichbutton,stat);
    		User::WaitForRequest(stat);
    		}	
    	i++;
    	}
    notifier.Close(); 
    delete ptrIapRecordSet;
    As I mentioned in code comments, all of the records that link this table to other are null (iService.iLinkedRecord, iBearer.iLinkedRecord, iNetwork.iLinkedRecord and iLocation.iLinkedRecord), so I cannot traverse with them further. This happens on real device and on emulator, with all types of AP, not only of wlan. What am I doing wrong?

    Thanks in advance.

    P.S. I tried to search wiki, but I found no examples about dealing with CommsDat API, as all articles are about these deprecated CAp* API-s.

Similar Threads

  1. Wifi connection problem
    By symbiannil in forum Streaming and Video
    Replies: 1
    Last Post: 2008-07-16, 08:55
  2. E65 WIFI connection
    By vijaygopalgv in forum Wired and Wireless interfaces (Closed)
    Replies: 0
    Last Post: 2007-12-05, 12:28
  3. MMS Interruption during GPRS connection hangs the device?
    By alexhong in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2004-08-31, 18:47
  4. MMS Interruption during GPRS connection hangs the device?
    By alexhong in forum Mobile Java General
    Replies: 0
    Last Post: 2004-08-31, 18:45
  5. Replies: 5
    Last Post: 2003-02-07, 11:25

Posting Permissions

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