2017-09-06 100 views
0

我正在編寫一個WPF應用程序(不是UWP),我需要運行BluetoothLE。c#:WPF中的BluetoothLe:找不到某些類/方法

我加入了藍牙usings:

using Windows.Devices.Bluetooth; 
using Windows.Devices.Bluetooth.GenericAttributeProfile; 

,我加入到C中的參考文獻:\程序文件(x86)\參考大會\微軟\ Framework.NETCore \ V4.5 \ System.Runtime .WindowsRuntime.dllC:\ Program Files(x86)\ Windows Kits \ 10 \ UnionMetadata \ Facade \ Windows.WinMD

但現在兩個錯誤occure:

var gattServicesResult = await device.GetGattServicesForUuidAsync(new Guid(RX_SERVICE_UUID)); 

給出了錯誤「BluetoothLedevice」不包含「GetGattServicesForUuidAsync」的定義[...](是否缺少using指令或程序集引用? )

GattWriteResult result = 
       await characteristic.WriteClientCharacteristicConfigurationDescriptorWithResultAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify); 

給出了錯誤類型或namesp ace name'GattWriteResult'找不到(您是否缺少使用指令或程序集引用?)

我也嘗試了UwpDesktop。

任何想法什麼是什麼?任何幫助感謝!

回答

-1

嘗試添加到特定版本的引用,例如

C:\ Program Files文件(x86)的\的Windows套件\ 10 \ UnionMetadata \ 10.0.16299.0 \ Windows.winmd

我不知道這是否是解決此問題的正確方法,但它應該起作用。

+0

這不提供問題的答案。一旦你有足夠的[聲譽](https://stackoverflow.com/help/whats-reputation),你將可以[對任何帖子發表評論](https://stackoverflow.com/help/privileges/comment);相反,[提供不需要提問者澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-c​​an- I-DO-代替)。 - [來自評論](/評論/低質量帖/ 17901071) – Jodocus

+0

你是對的,但我沒有足夠的聲譽。順便說一下,我解決了同樣的問題 – nikname

相關問題