使用 Peerfinder 是否需要 NFC? [英] Is NFC necessary to use Peerfinder?

查看:21
本文介绍了使用 Peerfinder 是否需要 NFC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 应用商店应用程序中,我尝试使用 PeerFinder 类来定位我周围的蓝牙设备,但每次调用 Peerfinder.FindAllPeersAsync() 时我都会收到一个通用异常:

In a Windows Store application, I am attempting to use the PeerFinder class to locate the Bluetooth enabled devices around me, but I get an generic exception every time I call Peerfinder.FindAllPeersAsync():

One or more errors occurred while processing the request. (Exception from HRESULT: 0x80070306)

我认为问题在于 Peerfinder.SupportedDiscoveryTypes == PeerDiscoveryTypes.None,但我不确定这是为什么.我的电脑没有 NFC 无线电,但它有蓝牙.我原以为这会让 Peerfinder.SupportedDiscoveryTypes == PeerDiscoveryTypes.Browse.是否需要 NFC 才能工作?

I think the issue is what Peerfinder.SupportedDiscoveryTypes == PeerDiscoveryTypes.None, but I'm not sure why this is. My computer does not have an NFC radio, but it does have Bluetooth. I would have thought this would make Peerfinder.SupportedDiscoveryTypes == PeerDiscoveryTypes.Browse. Is NFC required for this to work?

我已经在 Windows Phone 8 中编写了几乎相同的代码,但它确实具有 NFC(尽管我只需要在第一次连接设备时使用它;之后它们每次都会记住彼此).

I have made almost identical code work in Windows Phone 8, but that does have NFC (though I only need to use it the first time to devices are connecting; they remember each other every time after that).

更新:

以下是人们在评论中要求的更多信息:

Here is some more info that people were asking for in the comments:

1) 允许蓝牙 == 真.
2) 蓝牙已启用(我通过蓝牙将某些东西连接到 PC 只是为了向自己证明无线电正在工作).
3) 添加了 Proximity 和 Networking 功能.

1) AllowBluetooth == true.
2) Bluetooth is enabled (and I connected something to the PC via Bluetooth just to prove to myself that the radio is working).
3) Both the Proximity and the Networking capabilities have been added.

推荐答案

有一个关于如何使用这个的扩展示例 此处.看起来您可以在某些设备上使用 WiFi,但如果 SupportedDiscoveryTypes == PeerDiscovertyTypes.None 则以上都不可用.有关如何使用 FindAllPeers 的更多说明,请参见此处.

There is an extended example of how to use this here. It appears you can use WiFi on some devices, but if SupportedDiscoveryTypes == PeerDiscovertyTypes.None then none of the above is available. See here for more notes on how to use FindAllPeers.

您可以使用 SupportedDiscoveryTypes 属性来确定当前的 PC 有工作的近距离设备或 Wi-Fi设备支持 Wifi-Direct 浏览.

You can use the SupportedDiscoveryTypes property to determine whether the current PC has a working proximity device or whether the Wi-Fi device supports Wifi-Direct browsing.

来自链接的示例检查:

if ((Windows.Networking.Proximity.PeerFinder.SupportedDiscoveryTypes &
     Windows.Networking.Proximity.PeerDiscoveryTypes.Browse) !=
     Windows.Networking.Proximity.PeerDiscoveryTypes.Browse)
{
    WriteMessageText("Peer discovery using Wifi-Direct is not supported.\n");
    return;
}

这篇关于使用 Peerfinder 是否需要 NFC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆