24

Like here: Automatic authentication for Android WiFi Direct I want to create a mobile ad-hoc Wifi network with Android devices. But unlike the linked question above I want to use the official Android WiFi Direct API which is availabe since Android 4.0.

So is there a way to not only connect 2 devices via WiFi Direct but also three or more? So messages could be passed from one device to another using several other devices in between (therefore spanning a larger distance between the sender and receiver)?

The Wifi Direct demo only works for pairing two devices and I could not find a way to do anything else.

Thanks!

Community
  • 1
  • 1
florian h
  • 1,162
  • 1
  • 10
  • 24

4 Answers4

28

Is there a way to not only connect 2 devices via WiFi Direct but also three or more?

Yes, the Wi-Fi Direct specifications explain it is possible to create a 1 to many connection. One of the devices will act as a group owner (think it as an access point). I have been able to create a Wi-Fi Direct network with 3 devices during some tests.

As all the devices have to be in the range of the group owner, you are sure that your message will arrive to the second client. 1st client -> group owner -> 2nd client

Fabien Demangeat
  • 935
  • 8
  • 12
  • 2
    Fabien, would you be able to explain how you did this? I've successfully connected 2 peers for an application I'm working on but none of the developer guides online seem to explain how I then go about connecting an additional peer. – Chucky Feb 25 '13 at 14:30
  • 2
    Hi Chucky, considering the 2 devices are connected, one of them is a Group Owner (GO). On your 3rd device, you should do a "requestPeers". When the list of peers is available, you can send a "connect" request to one of the devices. If it fails you should identify the GO and send the connection request to this particular device. – Fabien Demangeat Feb 25 '13 at 14:50
  • Fabien, I did what you suggested, but it fails when trying to connect to the group owner giving me this error: failed to connect to /192.168.49.1 (port 8988) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused), do you have any idea how can I solve this? – Silvia H Dec 21 '14 at 12:45
  • 1
    I need to connect to multiple devices (around 40+), do you have any sample code reference or solution where I can start? I have tested using two devices, its working for me but unable to work through more than 2. – Bette Devine May 12 '15 at 05:04
  • @BetteDevine I think this can't be happen on more than 5 devices as I read it on web. – David Sep 24 '15 at 10:04
  • Wifi DIrect is not a true P2P network. OP specifically mentioned message passing, which is not supported by WFD, but in theory can be achieved with a simpler ad-hoc standard. Unfortunately I think most wifi devices prefer not to work like that. – jiggunjer Apr 19 '16 at 03:29
  • 1
    Anyone, please provide a demo link for connection with multiple devices. – Aarti verma Aug 26 '16 at 07:14
6

Yes,there are no limits as such. We have experimented with 5-6 devices - beyond that, it wont scale very well at the moment.

Here is a video of tapestry on JellyBean - http://www.youtube.com/watch?v=6emgRvH4mTo&list=UUQmz9albYeqArJvmpmaQpGQ&index=1&feature=plcp

Irfan
  • 138
  • 3
  • Irfan, I also want to connect multiple devices making groups. I am done with the simple one to one sending. Can you guide me how to make groups in wifi-direct ? It would be great help. – Hardik Trivedi Aug 31 '12 at 04:10
1

You can do so using Java NIO (Non Blocking IO) There is also an option in Wifi Direct to create group, using that group, group own will be used as a server and can broadcast message. Using multiple clients and a Server, all devices can communicate with each other by utilizing group.

-1

To connect another device to p2p group: on GO device type:

sudo wpa_cli wps_pbc

and on the new device u want to join:

sudo wpa_cli p2p_connect <GO-MAC-address> pbc join

following this site: http://processors.wiki.ti.com/index.php/OMAP_Wireless_Connectivity_NLCP_WiFi_Direct_Configuration_Scripts#Connect_in_pbc_.28Push_button_Control.29