Windows 10中的信标技术

13

有没有办法在Windows 10开发中使用iBeacons? 由于以前版本的Windows与iBeacons的开发似乎几乎不可能,现在我们是否有机会支持这项技术?

是否有人开始开发类似的东西?

4个回答

8

我需要在Xamarin中构建UWP应用程序,该应用程序使用iBeacons(或类似技术)来检测和与启用iBeacons的其他移动设备进行通信,例如iPhone,Android手机等,而不是iBeacons gimbels。这在今天的2016年11月是否可行?因此,基本上要在设备之间查找猴子,包括UWP设备。 - King Wilder

5

以下是在Rob Caplan的答案中提到的基于Windows 10 API与苹果iBeacon一起使用的方法:

  1. 开始监听Beacons:

BluetoothLEAdvertisementWatcher watcher = new BluetoothLEAdvertisementWatcher { ScanningMode = BluetoothLEScanningMode.Active };
watcher.Received += WatcherOnReceived;

  1. 处理信标数据 - 注意根据您的场景,您可能需要通过存储和比较蓝牙地址来区分信标。

private void WatcherOnReceived(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs btAdv)
{
    // Optional: distinguish beacons based on the Bluetooth address (btAdv.BluetoothAddress)
    // Check if it's a beacon by Apple
    if (btAdv.Advertisement.ManufacturerData.Any())
    {
        foreach (var manufacturerData in btAdv.Advertisement.ManufacturerData)
        {
            // 0x4C is the ID assigned to Apple by the Bluetooth SIG
            if (manufacturerData.CompanyId == 0x4C)
            {
                // Parse the beacon data according to the Apple iBeacon specification
                // Access it through: var manufacturerDataArry = manufacturerData.Data.ToArray();
            }
        }
    }
}

这也是我在开源的 Universal Beacon Library 中实现它的方式,其中包含完整的示例代码和一个应用程序以供测试:https://github.com/andijakl/universal-beacon


3
微软此前已表示将支持在Windows 10中为蓝牙LE设备进行应用程序控制扫描。这是Windows 8.x移动和桌面版都缺失的基本功能。更多信息请参见此处:https://dev59.com/-4Tba4cB1Zd3GeqP0gkZ#26234432 发表的Windows 10预览API至今未公开此功能。如果以后公开,这些API将有可能构建一个库来检测蓝牙LE信标。
编辑:该功能现在已经在新的BluetoothLeAdvertisementWatcher类中提供。为了预见这个功能,我们已经开始开发一个开源的Windows Beacon Library,最终将专为在Windows 10上使用而设计。这项工作只是初步阶段。目前,它只能在Windows 8.x设备上与可附加的蓝牙扫描适配器一起使用,以便将其扫描结果传递给库进行解析。
如果您有兴趣协助这一努力,请通过上述GitHub项目发送一条消息。

1

对于 Windows 10 之前的版本,您可以使用托管 C# 库 WinBeacon。该库使用简单的 HCI 层并直接与 dongle 进行通信,而不是使用默认的蓝牙堆栈。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接