C# Windows/.Net 中的蓝牙 API?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/144862/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 15:29:32  来源:igfitidea点击:

Bluetooth APIs in Windows/.Net?

提问by cjkarr

I am in the process of writing a Bluetooth scanner that locates and identifies mobile devices in the local vicinity. Is this something that I can accomplish using C#, or do I need to drop down into the C/C++ APIs? My application is targeting Windows XP and Vista. Pointers are appreciated.

我正在编写一个蓝牙扫描仪,用于定位和识别本地附近的移动设备。这是我可以使用 C# 完成的事情,还是我需要下拉到 C/C++ API 中?我的应用程序面向 Windows XP 和 Vista。指针表示赞赏。

Thanks!

谢谢!

采纳答案by Andrew Queisser

One problem with Bluetooth on the PC is that there are several BT stacks in use and you can never quite know which one is available on a given machine. The most common ones are Widcomm (now Broadcom) and Microsoft (appeared in XP, maybe one of the service packs). However, some BT hardware vendors package BlueSoleil and some use Toshiba. Most dongles will work with the MS stack so the .NET libs I've seen tend to use that.

PC 上蓝牙的一个问题是有多个 BT 堆栈在使用,您永远无法完全知道在给定机器上可用哪个堆栈。最常见的是 Widcomm(现在是 Broadcom)和 Microsoft(出现在 XP 中,可能是其中的一个服务包)。但是,一些 BT 硬件供应商封装 BlueSoleil,一些使用 Toshiba。大多数加密狗将与 MS 堆栈一起使用,因此我见过的 .NET 库倾向于使用它。

Each of the stacks has a totally different way of doing the discovery part where you browse for nearby devices and inquire their services.

每个堆栈都有一种完全不同的方式来执行发现部分,您可以在其中浏览附近的设备并查询它们的服务。

If I had to pick one approach today I'd probably do the discovery in C++ and add an interface for .NET.

如果我今天必须选择一种方法,我可能会在 C++ 中进行发现并为 .NET 添加一个接口。

The 32feet.net stuff worked pretty well when I tried it but didn't support the Widcomm stack.

32feet.net 的东西在我尝试时工作得很好,但不支持 Widcomm 堆栈。

回答by Kyle

There is also Peter Foot's 32feet.net

还有 Peter Foot 的 32feet.net

http://inthehand.com/content/32feet.aspx

http://inthehand.com/content/32feet.aspx

I've played around with this back when it was v1.5 and it worked well.

当它是 v1.5 时,我玩过它,它运行良好。

回答by Guge

Mike Petrichenkohas a nice BT framework. It works with BlueSoleil, Widcomm, Toshiba and Microsoft.

Mike Petrichenko有一个不错的 BT 框架。它适用于 BlueSoleil、Widcomm、Toshiba 和 Microsoft。

It is now called the Wireless Communications Library and works with Bluetooth 802.11 and Infrared. Mike named the company Soft Service Company and sells non-commercial and commercial licenses with and without source code in prices ranging between $100 and $2050.

它现在称为无线通信库,可与蓝牙 802.11 和红外线配合使用。Mike 将这家公司命名为 Soft Service Company,并以 100 美元到 2050 美元的价格出售带有和不带有源代码的非商业和商业许可证。