Windows 8.1, HID and a Missile Launcher (Oh my)

Description

Today's Hardware Friday post continues in our Windows 8.1 HID theme (more on that next week too). Today, Lewis Benge takes us to a place where every geek cube dweller dreams of going, a Missile Enabled cube...

Connecting the Dream Cheeky Thunder Missile Launcher to Windows 8.1

Ever since the 2013 BUILD conference, a huge amount of people have attempted to integrate peripherals into their modern applications – and of all the devices we can plug into our computers only one has stood out as the prized device people want to connect?

The Dream Cheeky Thunder Missile Launcher is a $35 novelty toy available from various retailers around the world. The Thunder is simple in its constructions – its a USB based air-powered missile launcher that allows you to sight and fire foam darts at unsuspecting people hovering in your immediate vicinity. The device has been so popular with geeks globally that it has even featured in the Big Bang theory. 

Modern apps –> HID Device

Aside from its creditability with those of us that frequent code, one of the other exciting features of the Thunder is its driver stack. Instead of using a proprietary driver in a similar fashion to the OWI-535 robotic arm the device itself actually leverages an existing Windows standard as a HID (Human interface device) in much the same way as a keyboard and mouse. So why would this be existing for us a developers? Firstly because we don’t need to do anything with the OS to install or configure the device, and also as it uses a standard Windows driver which has been ported to the ARM stack the device will also work on a Windows RT device such as a Surface too!

Plugging in the device and Windows recognizing it is only a small part of our solution. As app developers we want to leverage this device from our modern application, and allow our users to start shooting each other. Luckily Windows 8.1 provides us with the support for such a dilemma by introducing the Windows.Device.HumanInterfaceDevices namespace. So lets spend a few minutes looking at the code required to start firing our missiles. 

Windows.Device.HumanInterfaceDevice

As with any modern application that wants to go beyond some standard UI prompts, we need to ask permission from our user to access the device. This is a security feature that prevents apps from becoming malware.  In Windows 8.1, as per Windows 8 we do this via the package.appxmanifest file, and we leverage the namespace extensions that allows us to reference the new 8.1 capabilities. Currently Visual Studio manifest editor doesn’t support these changes, so open up your file in a text editor and add the following lines: 

...

And that is it! Using those few lines of code we have an active connection to the USB Thunder missile launcher and can start sending commands.

Here is how we would toggle the LED on:

var LED_ON = new byte[] { 0, 3, 1, 0, 0, 0, 0, 0, 0 }; await SendOutputMessage(LED_ON);  

In the meantime have fun with your hardware hacking!

Okay, so maybe there's still more that needs to be done to get it actually firing and all that, but hey, what fun would it be if the author did ALL the work for you?  Smiley

The Discussion

  • User profile image
    Durval

    It´s only a small part of our solution we want to leverage this knowledge for develop modern application in mobile device.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.