//BUILD/ Conference: Pipe Dream

September 14, 2011

Conferences, Nerd, Xaml, XML

I want to understand how to create/extend a badge scanner listener from a device that reads like a USB Keyboard Wedge.

Since 2005, I’ve used a WinForms app, combined with a programmed barcode scanner, to listen for the key I programmed into the USB barcode scanners that read like a keyboard wedges.

In my WinForms App, I was able to solve this by programming the scanner to “bookend” scans with certain characters, and checking the (int)KeyChar value from my Controller’s KeyPress event’s KeyPressEventArgs. If it gets the programmed starting char, it listens for X seconds for the ending char. If received, it parses the data. If not, it sends notification that the scan was problematic.

In a nutshell, this app really does nothing more than:

  1. Listens for & parses the badge scan
  2. Sends scanned, parsed, xml-serialized badge info to the Flash swf hosted inside the app
  3. Listens for & processes calls made by the Flash swf back to the WinForms shell to write data from swf to DB (after deserializing & parsing)

It’s Worked Great for Years, Why Change It?

Most of the backend was written in .NET 1.1 (still uses strongly-typed datasets), and I’d like to update it & get it out of WinForms.

For a long time, I envisioned it being rearchitected using either WPF or Silverlight so I could work with my objects without having to serialize, deserialize & parse xml to communicate with the UI (Flash swf).

As wonderful as that could be, our designers are on Macs so XAML adoption by our Flash team isn’t on the table.

SO… a Flash UI is immutable (for now), but the Windows 8 support of JavaScript on the system makes me wonder: Might it be possible to listen for the badge scanner on the system level, then throw a JavaScript event that can be received by a Flash exe running on the machine without the need for the middle WInForms layer? The Flash could then call the WCF service directly for its interactions with the business layer. If that’s not an option, then could I create a WinRT HTML Metro App to host the swf that can receive JavaScript notifications from the badge scanner (utility? driver extension?)?

The problem is, I don’t know how to approach this.

According to this article, every USB device has a unique device id. We have full control over the systems & own the scanners, so those could live in a static config file.

Here are a couple of the models of barcodes scanners we use for non-magnetic swipe cards.
DS6707
DS6708

As of June 2011, there is now even a Scanner SDK for Windows.

DS6708-SR20001ZZR Motorola DS6708 2D Barcode Scanner

In Conclusion, this is what I need to do with the Scanner:

1. Listen for a scan by the device

2. Parse the data (to verify the scan is what we were expecting for the app)

3. Send data to Flash (either exe or swf, preferably exe), serialized as XML (through JavaScript on the system, now that WIN8 supports it?)

THAT’S REALLY IT. So how do I get that functionality out of my WinForms Controller? If you have any ideas, PLEASE feel free to comment (or find me if you’re at //BUILD/ – I’d love to discuss!)

————————-

p.s. I’m pretty sure the other type of badge scanner we use is the MiniMag from ID Tech. It also reads as a keyboard wedge by default.

Photo of ID Tech MiniMag 2

The MiniMag swipe scanner can be ignored for now (I’ll cross that bridge if I figure out the one that DOES already have an SDK).

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: