问题描述
Windows 8 公开了一个 API 来与蓝牙低功耗(智能)设备进行通信,但该 API 在以前的 Windows 版本中不可用,那么如何在 Windows 7 上与 BLE 加密狗进行通信?
Windows 8 exposes an API to communicate to Bluetooth Low Energy (Smart) devices, but this API is not available in previous versions of Windows, so how can I communicate with a BLE dongle on Windows 7?
我目前使用的 BLE 加密狗 (BLED112) 公开了一个虚拟串行端口,您可以使用他们的自定义专有 API 通过该端口发送命令,但如果我在我的软件中实现此功能,它将无法与其他制造商的加密狗一起使用.
The BLE dongle I'm currently using (BLED112) exposes a virtual serial port, over which you can send commands using their custom proprietary API, but if I implement this in my software, it will not work with dongles from other manufacturers.
那么有没有一种方法可以在独立于制造商的 Windows 7 上与 BLE 设备进行通信?
So is there a way to communicate with BLE devices on Windows 7 which is manufacturer-independent?
推荐答案
原来有人找到了解决方法.基本上这个想法是不使用 Windows BLE API(在 Windows 7 上不起作用),而是直接与加密狗对话.您可以使用 WinUSB(用户空间 USB 驱动程序)来实现.可以使用 Zadig 安装该驱动程序.
So it turns out that some people have found a workaround. Basically the idea is to not use the Windows BLE API (which doesn't work on Windows 7) but instead to talk to the dongle directly. You can do that using WinUSB (a user-space USB driver). That driver can be installed using Zadig.
这是一个例子:
https://github.com/sandeepmistry/node-bluetooth-hci-socket#windows
它具有 C++ 代码,可让您发送 HCI 命令.还有一个关于如何将 HCI 用于更高级别 BLE 的 Node 库:
It has C++ code to let you send HCI commands. There is also a Node library of how to use HCI for higher level BLE stuff:
https://github.com/sandeepmistry/bleno
我不知道是否有任何非 JS 库可以做到这一点,但我认为无论如何将 Bleno 转换为 C++ 并不难.
I don't know if there are any non-JS libraries that do the same, but I don't think it would be hard to convert Bleno to C++ in any case.
这篇关于适用于 Windows 7.0 的蓝牙低功耗 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!