将单个设备上的多个传感器暴露给 Windows Sensor API [英] Exposing multiple sensors on a single device to Windows Sensor API
问题描述
Windows 引入了传感器 API,因此您可以创建一个 HID 设备,为其 18 种支持的传感器类型之一提供数据.我正在创建一个板上有许多传感器的设备,但阅读文档并不清楚如何将它与来自一个 USB 设备的多个传感器一起使用.我能想到的唯一解决方案是让我的设备成为复合 USB 设备",并模拟 18 种不同的 HID 设备.
Windows introduced the Sensor API so you can create a HID device that provides data for one of their 18 supported type of sensors. I'm creating a device that has many of those sensors on-board, but reading through the documentation it's not clear how to use it with a multiple sensors coming from one USB device. The only solution I can think of would be to let my device be a 'composite USB device', and simulate 18 different HID devices.
是否有更好的方法来支持多个传感器?
Is there a better way to support multiple sensors?
推荐答案
您将支持传感器的 HID 协议,并返回由多个传感器组成的顶级集合.
You would support the HID protocol for sensors, and return a top level collection that comprises of multiple sensors.
有关详细信息,请参阅此白皮书:http://msdn.microsoft.com/en-us/library/windows/hardware/br259128.aspx
See this whitepaper for details: http://msdn.microsoft.com/en-us/library/windows/hardware/br259128.aspx
请注意,虽然白皮书提到了示例 HID 传感器类驱动程序,但如果您使用的是 Windows 8,则不必为传感器实现 HID 驱动程序 - Windows 8 附带 HID 传感器类驱动程序.
Note that while the whitepaper refers to a sample HID sensors class driver, you don't have to implement a HID driver for sensors if you are on Windows 8 - Windows 8 ships with a HID sensors class driver.
这篇关于将单个设备上的多个传感器暴露给 Windows Sensor API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!