亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

帶有 Unity 的 Hololens 上的 BluetoothLEDevice

帶有 Unity 的 Hololens 上的 BluetoothLEDevice

C#
炎炎設計 2022-01-09 16:15:44
我正在嘗試從 BLE 設備讀取傳感器數據,但對 Unity / C# / HoloLens / UWP 來說是全新的。我使用的 UWP 命名空間:#if NETFX_COREusing System;using Windows.Devices.Bluetooth.Advertisement;using Windows.Devices.Bluetooth;#endif這是 BluetoothLEAdvertisementWatcher.Received 的事件處理程序:#if NETFX_COREprivate 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)我不知道如何進一步調試這個,或者一般有什么問題。
查看完整描述

1 回答

?
森欄

TA貢獻1810條經驗 獲得超5個贊

在我的特殊情況下,轉到系統 - > 設備(HOLOLENS)并刪除所有以前配對的藍牙設備可以解決問題。

就我而言,我在設備列表中只有 Hololens 的“Clicker”。刪除它后

System.IO.FileNotFoundException

不再拋出,并且

BluetoothLEDevice.FromBluetoothAddressAsync

似乎工作。答題器不在附近或在任何地方,只是之前(幾周前)配對。

這個錯誤總是可以通過以下方式重現:

  • 配對答題器

  • 配對其他 Gatt 設備

在調用 BluetoothLEDevice.FromBluetoothAddressAsync 時,System.IO.FileNotFoundException 再次被拋出,即使點擊器未配對。當我從設備列表中刪除答題器時,它又可以工作了。


查看完整回答
反對 回復 2022-01-09
  • 1 回答
  • 0 關注
  • 702 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號