Programming with Connected Devices
A major emphasis of WinRT 8.1 is the ability to control devices over HID, Bluetooth, and USB interfaces. These devices range from toys and gadgets to Point of Sale (POS) hardware to powerful 3D printers.
For standardized hardware, six “Device Scenario APIs” are offered:
- Fingerprints replace passwords
- Read barcodes and magnetic strips
- Use Geofence to trigger events
- Manage virtual smart cards
- Print to 3D printers
- Scan documents and images
For custom hardware WinRT developers can fall back on the new “Device Protocol APIs” for HID, USB, and Bluetooth.
Hardware developers are encouraged to release device specific SDKs. These SDKs will usually be expressed as a Windows Runtime Component that wraps the underlying Device Protocol API. For example, a SDK for a robotic arm would translate methods such as MoveUp, MoveDown, Open/Close Hand into the binary messages that the hardware expects.
Launch on Connect
Hardware developers can opt-in to Autiplay functionality. Once they do that, WinRT apps can register themselves as a Launch on Connect handler for the device. Like file type and URL protocol handlers, the user will be prompted if multiple applications are registered for the same device.
This is paired with Device Background Tasks, which allow apps to run for up to ten minutes. Device Background Tasks are primarily used for synchronizing data between the computer and device.
In addition to the Autoplay support, devices can expose metadata packages that includes device icons, application auto-install information, other crucial information. To make this easier, a new device metadata editor is being offered. This tool first asks what your scenario is. Options include:
- Device and App (i.e. matching Windows Store app)
- Device-only (used for legacy device)
- Broadband Device
The tool then validates the metadata package against the scenario using the same tests that Microsoft’s compatibility labs use. When errors are detected, links to MSDN are offered. If the tests are successful, the tool will emit a device data file to be included in the Windows Store app.
Daniel Bryant, Arian Adair, Michael Hendricks Jul 31, 2015
A. Falck, M. Rezaei, E. Pederson, B. Brodie Jul 31, 2015