从 Wii 平衡板读取数据
我正在尝试从 Wii Fit(平衡板)获取输出。我可以通过 C++ 蓝牙枚举器找到该设备,但尝试通过 Windows 套接字连接失败。
我想知道是否有人在这个方向(C++,Windows)取得了成功,我很想听听你是如何做到的。
Im trying to get the output from a Wii Fit (balance board). I can find the device via the C++ Bluetooth enumerators but attempts to connect via a windows socket are failing.
Im wondering if anyone has had success in such a direction (C++, windows) I'd love to hear how you did it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Wii 平衡板是一种 HID 设备。要了解与平衡板的通信,您需要了解一些有关蓝牙 HID 的知识。 WiiBrew 上有关于 Wiimote 和 的详细信息Wii 平衡板。
我认为您不能使用 Windows Sockets 连接到 HID 设备。 Windows Socket 蓝牙接口仅允许您连接到基于 RFCOMM 的服务。 HID 基于 L2CAP,它位于蓝牙协议栈的更下方。 MSDN 上有一些有关该限制的信息。
如果您只是想尝试一下,您可以尝试 Bluecove for Java。您也许可以使用另一个堆栈(例如 Widcomm)执行某些操作。如果您受限于 Windows 和 C++,您可能需要考虑为平衡板编写自定义 HID 驱动程序。
The Wii Balance Board is a HID device. To understand communications with the Balance Board, you need to know a little bit about Bluetooth HID. There's good information on WiiBrew about the Wiimote and the Wii Balance Board.
I don't think you can use Windows Sockets to connect to a HID device. The Windows Socket Bluetooth interface only allows you to connect to RFCOMM-based services. HID is based on L2CAP which is further down the Bluetooth protocol stack. There's some information at MSDN about that limitation.
If you're just looking to hack around with it, you can try Bluecove for Java. You may be able to do something using another stack (for example, Widcomm). If you're locked in to Windows and C++, you may have to look into writing an custom HID driver for the Balance Board.
正如 pwc 所说,MS 蓝牙 API 存在限制,因此对于套接字,除了 RFCOMM 之外你不能有其他东西,但这并不意味着你不能深入 L2CAP 层。您要做的就是实现客户端配置文件驱动程序,您可以使用 MSDN 中的一篇文章作为起点: 创建到远程设备的 L2CAP 客户端连接,反之亦然:在蓝牙配置文件驱动程序中接受 L2CAP 连接
接下来当然,正如 pwc 所说,您必须研究蓝牙 HID 和 WiiBrew 的通信协议。
蓝牙无线技术常见问题解答 - 2010 也是一个值得阅读的好文档其中明确指出可以与 Microsoft 蓝牙堆栈驱动程序建立 L2CAP 连接。当然不是用插座。
As pwc said there is a limitation in the MS Bluetooth API, so with sockets you cannot have something else except RFCOMM, but this doesn't mean you cannot go down at L2CAP layer. What you have to do is to implement a client profile driver and you can use as starting point an article from MSDN: Creating a L2CAP Client Connection to a Remote Device and vice-versa: Accepting L2CAP Connections in a Bluetooth Profile Driver
Next of course as pwc said you have to study Bluetooth HID and WiiBrew for the communication protocol.
Also a good document to read is Bluetooth Wireless Technology FAQ - 2010 which states clear that it is possible to have L2CAP connections with Microsoft Bluetooth stack driver. Of course not with sockets.
在蓝牙设备上使用 HID 时,通常不需要直接创建 L2CAP 连接。 Win32 上的所有蓝牙堆栈都支持蓝牙 HID,并通过本机 Windows HID API 提供对 HID 流/控制的访问。不需要(直接)L2CAP! :-)
在 WinCE 上也内置了对蓝牙 HID 的支持,但我不确定是否有办法访问 HID API。
这就是 Brian Peek 的 wiimore 库的工作原理——它使用 HID API。这样做的好处是,人们可以通过这种方式获得对所有(?)蓝牙堆栈的支持——它们都通过 Windows HID API 支持 HID 设备,而要直接使用 L2CAP,则必须支持每个堆栈的 API。 ..(如果他们有的话!据我所知,BlueSoleil 没有 L2CAP API)。
因此,在 Win32 上,只需与设备配对,并检查其蓝牙服务控制面板选项卡上的 HID 复选框是否已选中(无论使用哪个蓝牙堆栈)。在我的 32feet.NET 库中,可以发现设备,然后确保为其启用 HID:(
这应该适用于 MSFT 和 BlueSoleil;据我所知,Widcomm 上没有用于该功能的 API——尽管配对时它可能会自动启用)。
一种可能的例外情况是,显然某些设备不完全符合蓝牙/HID 规范,我听说 PS3 蓝光控制器就是这样。然后,人们可能想直接尝试 L2CAP 连接——但是堆栈对 HID 的支持很可能会干扰试图提供相同服务的第三方应用程序......
When using HID on a Bluetooth device there is generally no need to create a L2CAP connection directly. All(???) of the Bluetooth stacks on Win32 have support for Bluetooth HID and provide access to the HID stream/control through the native Windows HID API. No (direct) L2CAP required! :-)
On WinCE there is built-in support for Bluetooth HID also, but I'm not sure there's a way to access a HID API.
That's how Brian Peek's wiimore library works -- it uses the HID API. The good thing about that is that one gets supports for all(?) the Bluetooth stacks that way -- they each support HID devices via the Windows HID API, whereas to use L2CAP directly one would have to support each of the stacks' APIs... (That's if they have one! BlueSoleil has no L2CAP API as far as I can see).
So, on Win32 one should just pair with the device and check that the HID checkbox is checked on its Bluetooth Service control panel tab (whichever Bluetooth stack is in use). In my 32feet.NET library one can discover the device and then ensure that HID is enabled for it with:
(That should work on MSFT and BlueSoleil; there's no API for that on Widcomm AFAIK -- although when paired it might be automatically enabled anyway).
The one possible exception case is that apparently some devices are not fully compliant with the Bluetooth/HID specs, I'm told the PS3 blu-ray controller is like that. Then one might want to try L2CAP connections directly -- however its likely that the stack's support for HID will interfere with third-party applications trying to provide the same service...