12

Windows 10 開発で ibeacons を使用する方法はありますか? 以前のバージョンの Windows で ibeacons を開発することはほとんど不可能に思えたので、このテクノロジをサポートする機会は今ありますか?

誰かがこのようなものを開発し始めましたか?

4

4 に答える 4

5

Rob Caplan による回答で言及されている新しい Windows 10 API に基づいて Apple iBeacons を操作する方法は次のとおりです。

  1. ビーコンの監視を開始します。

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

  1. ビーコン データの処理 - シナリオによっては、ビーコンを保存して Bluetooth アドレスを比較することでビーコンを区別する必要がある場合があることに注意してください。

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

于 2015-09-10T09:08:07.847 に答える
1

Windows 10 より前のバージョンでは、マネージ C# ライブラリWinBeaconを使用できました。ライブラリは単純な HCI レイヤーを使用し、デフォルトの Bluetooth スタックを使用する代わりにドングルと直接通信します。

于 2015-05-30T20:43:57.787 に答える