具有多个 (3+) 设备的 WiFi Direct (Android 4.0)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11251610/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:31:05  来源:igfitidea点击:

WiFi Direct (Android 4.0) with multiple (3+) devices

androidwifi-direct

提问by florian h

Like here: Automatic authentication for Android WiFi DirectI 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.

像这里:Android WiFi Direct 的自动身份验证我想使用 Android 设备创建一个移动临时 Wifi 网络。但与上面链接的问题不同,我想使用自 Android 4.0 以来可用的官方 Android WiFi Direct API。

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)?

那么有没有一种方法不仅可以通过 WiFi Direct 连接 2 个设备,还可以连接三个或更多设备?那么消息可以从一个设备传递到另一个设备之间使用几个其他设备(因此在发送方和接收方之间跨越更大的距离)?

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

wifi直连演示仅适用于配对两个设备,我无法找到一种方法,做任何事情。

Thanks!

谢谢!

回答by Fabien Demangeat

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

有没有办法不仅通过 WiFi Direct 连接 2 个设备,还可以连接三个或更多设备?

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.

是的,Wi-Fi Direct 规范说明可以创建一对多连接。其中一台设备将充当组所有者(将其视为接入点)。在一些测试中,我已经能够使用 3 个设备创建一个 Wi-Fi Direct 网络。

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

由于所有设备都必须在组所有者的范围内,因此您确信您的消息将到达第二个客户端。第一个客户 -> 群组所有者 -> 第二个客户

回答by Irfan

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

是的,没有任何限制。我们已经试验了 5-6 台设备——除此之外,目前它不会很好地扩展。

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

这是 JellyBean 上的挂毯视频 - http://www.youtube.com/watch?v=6emgRvH4mTo&list=UUQmz9albYeqArJvmpmaQpGQ&index=1&feature=plcp

回答by shahbaz.atta

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.

您可以使用 Java NIO (Non Blocking IO) 来做到这一点 Wifi Direct 中还有一个选项可以创建组,使用该组,组自己将用作服务器并可以广播消息。使用多个客户端和一个服务器,所有设备可以通过组相互通信。

回答by stanley783

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

将另一台设备连接到 p2p 组:on GO 设备类型:

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

关注本网站:http: //processors.wiki.ti.com/index.php/OMAP_Wireless_Connectivity_NLCP_WiFi_Direct_Configuration_Scripts#Connect_in_pbc_.28Push_button_Control.29