Windows 10中的信标

men*_*.pt 12 windows ibeacon windows-10

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

有没有人开始开发这样的东西?

Rob*_*SFT 8

是的,Windows 10中的Windows应用程序通过Windows.Devices.Bluetooth.Advertisement命名空间支持Beacons

有关详细信息,请参阅Windows 10中的Build talk Building Compelling Bluetooth Apps以及Bluetooth Advertisement Watcher and Publisher示例.


And*_*akl 5

这是基于Rob Caplan回答中提到的新Windows 10 API的Apple iBeacons工作方式:

  1. 开始观察信标:

BluetoothLEAdvertisementWatcher watcher = new BluetoothLEAdvertisementWatcher { ScanningMode = BluetoothLEScanningMode.Active };
watcher.Received += WatcherOnReceived;
Run Code Online (Sandbox Code Playgroud)

  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();
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这也是我在开源通用信标库中实现它的方式,该库随附完整的示例代码和一个可以试用的应用程序:https : //github.com/andijakl/universal-beacon