2017-09-06 101 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

相关问题