蓝牙 LE 广告观察器未在 HoloLens 2

问题描述

在此 question 之后,我也无法让蓝牙观察器在 HoloLens 2 上接收广告。我已经完成了示例 here,但在我的电脑上运行场景 2 时没有运气笔记本电脑和我的 HoloLens 上的场景 1。

我的 HoloLens 似乎没有触发任何接收到的事件。我试过重新启动 HoloLens 并检查更新。我目前运行的是操作系统版本 20346.1403。

非常感谢任何帮助故障排除。我已经能够让 regular BluetoothLE sample 正确运行,但是我的最终目标是让所有这些都在 Unity 应用程序中运行,并且由于某种原因,观察者没有收到任何带有常规 BluetoothLE 代码的事件来自我的 Unity 应用程序。

如果有人对 Unity 和 bluetoothLE 示例有经验,我非常想了解更多相关信息。

using TMPro;
using UnityEngine;
#if WINDOWS_UWP
using Windows.Devices.Bluetooth.Advertisement;
using System.Runtime.InteropServices.WindowsRuntime;
#endif

public class GPSReceiver : MonoBehavIoUr
{
    public TextMeshProUGUI debugText;
#if WINDOWS_UWP
    bluetoothleadvertisementwatcher watcher;
#endif
    public static ushort BEACON_ID = 1775;
    public EventProcessor eventProcessor;

void Awake()
{
#if WINDOWS_UWP
    watcher = new bluetoothleadvertisementwatcher();
    BluetoothLEManufacturerData manufacturerData = new BluetoothLEManufacturerData
    {
        CompanyId = BEACON_ID
    };
    watcher.AdvertisementFilter.Advertisement.ManufacturerData.Add(manufacturerData);
    watcher.Received += Watcher_Received;
    watcher.Start();
    debugText.text = "Watcher status: " + watcher.Status.ToString() + " " + watcher.ScanningMode.ToString();
#endif
}

#if WINDOWS_UWP
private async void Watcher_Received(bluetoothleadvertisementwatcher sender,BluetoothLEAdvertisementReceivedEventArgs args)
{
    debugText.text = "received bytes";
    ushort identifier = args.Advertisement.ManufacturerData[0].CompanyId;
    byte[] data = args.Advertisement.ManufacturerData[0].Data.ToArray();
    // Updates to Unity UI don't seem to work nicely from this callback so just store a reference to the data for later processing.
    eventProcessor.QueueData(data);
}
#endif
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)