BLE在Windows 10桌面上 [英] BLE on windows 10 desktop

查看:644
本文介绍了BLE在Windows 10桌面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Windows 10桌面上编写一个应用程序,用BLE测试和开发一些嵌入式产品。我知道BLE在iOS和Android(甚至是Windows Phone)上更成熟,但我们习惯于在Visual Studio 2015中使用c#开发的Windows桌面应用程序。



我已经使用Windows 8.1开发,使用对WinRT运行时的引用,链接该框架中的蓝牙库。



Fron初步概述,似乎是Windows 10 build 1511引入了一些BLE改进,例如app中的pair / unpair。



但是......如何访问这个新的BLE API?

Windows 10推出了新的通用Windows平台,Windows 8.1 WinRT的成功。



有没有机会开发winform或WPF使用新API的应用程序?

我尝试了这条路线,我设法链接了新的API,但我停止了这个错误:



I need to write an application on Windows 10 desktop, to test and develop some embedded products with BLE. I know that BLE is more mature on iOS and Android (and even on Windows Phone), but we are used to Windows Desktop applications, developed in Visual Studio 2015, in c#.

I already developed with Windows 8.1 using a reference to WinRT runtime, to link the Bluetooth library in that framework.

Fron an initial overview, it seems that Windows 10 build 1511 has introduced some BLE improvements, for example pair/unpair from app.

But... how to access this new BLE APIs?
Windows 10 introduced the new Universal Windows Platform, the successot of Windows 8.1 WinRT.

Is there any chance to develop a winform or WPF application using the new APIs?
I tried this route, I managed to link the new APIs, but I stoppen on this error:

error CS1545: Property, indexer, or event 'BluetoothLEAdvertisementWatcher.Received' is not supported by the language; try directly calling accessor methods 'BluetoothLEAdvertisementWatcher.add_Received(TypedEventHandler<BluetoothLEAdvertisementWatcher, BluetoothLEAdvertisementReceivedEventArgs>)' or 'BluetoothLEAdvertisementWatcher.remove_Received(EventRegistrationToken)'





代码很简单:





The code is prettty basic:

_bluetoothLEAdvertisemenetWatcher = new BluetoothLEAdvertisementWatcher();
_bluetoothLEAdvertisemenetWatcher.Received += OnAdvertisemenetReceivedAsync;





或者我应该遵循UWP申请的方式?



谢谢!



Or should I follow the way of an UWP application?

Thanks!

推荐答案

更新:我找到了包含Windows 10运行时的方法。 />


添加对
Update: I found the way to include the Windows 10 runtime.

Add a reference to
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd





谢谢你们: - )



Thanks the same :-)


这篇关于BLE在Windows 10桌面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆