More on the Windows 8.1 HID WinRT API
We're going to keep with the Windows 8.1 HID theme with a guest post from Donn Morse
Have you ever wanted to build a simple fitness device (like a heart-rate monitor) or a security device (like a motion sensor) and connect it to your laptop? One approach you might have considered is building a device that supports the Human Interface Device (HID) protocol. In Windows, we support this protocol over the USB, Bluetooth, and I2C transports. (This means that you can connect your device with a USB cable or a Bluetooth dongle.)
Prior to Windows 8.1, if you built a HID device, you’d need to write a fairly substantial COM/Win32 desktop application to retrieve data from, or, to control your device. To get a sense of how you’d do this, Microsoft provided the HClient application. If you knew COM, Win32, and C++, this app provided the starting point you needed. However, if you were a .Net programmer or a web developer, the ramp was pretty steep.
To illustrate the simplicity and power of the HID WinRT API, we’ve created a sample end-to-end solution. This solution includes plans for building a simple motion-sensor based on the Netduino Plus. When you attach this sensor to your tablet or laptop, and run the sample app, the app “monitors” the sensor and triggers a short video-capture whenever motion is detected. The solution includes both tutorials and source code.
Here's the Build 2013 session that talks about HID...
Windows 8.1 makes it easy for you to create apps that control devices using the Human Interface Devices (HID) industry standard. This session goes deep into the design of the new Windows Runtime HID API and walks you through the API and its functionality. It also demonstrates a custom HID peripheral to show you how to write apps that discover and communicate with HID devices using input, output, and feature reports.
[This documentation is preliminary and is subject to change.]
This quickstart contains C# examples that demonstrate four common tasks acccomplished by most HID apps.
The target device for several of these examples is the SuperMUTT, a test device which you can order from JJG Technologies.
- You must be familiar with HTML, C#, and Windows.
- You must have Microsoft Visual Studio 2013 RC installed.
- You must be connected to a SuperMUTT device.
Connecting to a HID device
The following example demonstrates how a Windows Store app, built with XAML and C#, uses the HidDeviceClass.GetDeviceSelector method to create a selector for a specific HID device and then uses the HidDeviceClass.FromIdAsync method to open a connection to that device.
Now go forth and HID!
This conversation has been locked by the site admins. No new comments can be made.