2

Device with the higher intent becomes the group owner is said in the following link: http://developer.bada.com/help_2.0/index.jsp?topic=%2Fcom.osp.cppappprogramming.help%2Fhtml%2Fdev_guide%2Fnet%2Fwi-fi_direct_connectivity.htm

I tried the following in the google-demo project of wifi-direct. In the main activity class from where broadcast receiver was called I set the priority as follows while running in one device.

public void onResume() {
    super.onResume();
    receiver = new WiFiDirectBroadcastReceiver(manager, channel, this);
    intentFilter.setPriority(999);
    registerReceiver(receiver, intentFilter);
}

While running the code in next device I didn't set the priority.

public void onResume() {
    super.onResume();
    receiver = new WiFiDirectBroadcastReceiver(manager, channel, this);        
    registerReceiver(receiver, intentFilter);
}

So as per the link the device with the higher priority should have been the group owner but setting priority does not seem working. Is there a way to explicitly assign a particular device as the group owner while connection establishes between two devices ?

4

3 回答 3

5

在你的 connect 方法中设置 WifiP2pConfig 对象的 groupOwnerIntent,取值范围是 0 到 15。0 表示最小的倾向是 GO,15 表示最高的倾向是 GO:

WifiP2pConfig 配置 = 新 WifiP2pConfig();

    config.groupOwnerIntent = 0;  //Less probability to become the GO
    config.deviceAddress = service.device.deviceAddress;
    config.wps.setup = WpsInfo.PBC;
于 2013-06-10T15:32:52.170 回答
3

首先,您提供的链接是针对 bada 手机的。我对该操作系统了解不多,但分配可能会有所不同。

无论如何,您可以为您想要的任何设备手动分配意图值。例如,假设您要将单击连接按钮的用户设置为组所有者。根据定义,组所有者应该具有最高的倾向,这意味着大于 0。检查链接。

要将同级分配为组所有者,只需将其分配给 15

config.groupOwnerIntent = 15;
于 2012-11-14T19:35:25.520 回答
0

当我使用 config.groupOwnerIntent = 0 连接到远程设备时,这是否意味着我的设备将成为组所有者或远程设备将成为组所有者?

鉴于远程设备的意图值大于 0 ,您的 config.groupOwnerIntent = 0 设备应该成为客户端。如果两个设备都具有相同的意图值,那么决胜局就会出现。“intent 值越大,成为 GO 的机会越大”。我们不能简单地通过将 Intent 值设置为 zer0 来使设备充当组所有者。这也取决于其他连接设备的 Intent 值。

于 2014-10-28T10:54:08.443 回答