我正在尝试从 BLE 设备读取传感器数据,但对 Unity / C# / HoloLens / UWP 来说是全新的。
我使用的 UWP 命名空间:
#if NETFX_CORE
using System;
using Windows.Devices.Bluetooth.Advertisement;
using Windows.Devices.Bluetooth;
#endif
这是 BluetoothLEAdvertisementWatcher.Received 的事件处理程序:
#if NETFX_CORE
private async void Watcher_Received(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)
{
Debug.Log("=Received Advertisement=");
ulong bluetoothAddress = args.BluetoothAddress;
Debug.Log(" BT_ADDR: " + bluetoothAddress);
Debug.Log(" Local name: " + args.Advertisement.LocalName);
Debug.Log(" advertisement type: " + args.AdvertisementType.ToString());
// Throws 'System.IO.FileNotFoundException' in System.Private.CoreLib.ni.dll
BluetoothLEDevice device = await BluetoothLEDevice.FromBluetoothAddressAsync(bluetoothAddress);
}
#endif
我在堆栈跟踪中看到的所有内容都是:
抛出异常:System.Private.CoreLib.ni.dll 中的“System.IO.FileNotFoundException”系统找不到指定的文件。(来自 HRESULT 的异常:0x80070002)
我不知道如何进一步调试这个,或者一般有什么问题。
森栏
相关分类