Saturday, March 28, 2009

The most fun I've had on a project.

I love technology. I love solving problems. I love learning new things.

One of the most enjoyable projects I've ever done involved all three of these things.

We had a customer who was using handheld barcode equipment in their remote locations, and they needed to upgrade that equipment; we were providing the new equipment and were tasked with writing code to essentially port their current functionality to the new devices. The existing devices used acoustic couplers to transmit data back to the home office. The particular setup at the home office was absolutely critical to their operations, and the customer was insistent that our work could not in any way affect their home office systems. The central office had a bank of modems to answer the data calls from the acoustic couplers deployed in the field. So we had to build a system, on new handheld barcode equipment running in their locations, which was "plug compatible" with their back office systems.

We found a hardware manufacturer who manufactured acoustic couplers for devices similar to the devices we were using, and we expected that the manufacturer would be able to write drivers and such so that we could use their couplers on the new hardware. In the meantime, I continued working on porting their application to the new platform.

We had continuous problems with the couplers. The manufacturer kept giving us new code to try, shipping us new devices, etc. Sometimes the couplers would make some noise when activated, sometimes the driver would fail. We were getting nowhere, and it was becoming more and more difficult to get status information from them. I started thinking "uh oh."

The customer used one-way acoustic couplers in their remote locations to transmit data to their central office. The acoustic coupler was essentially a speaker. I started thinking, "this thing is just making noise." Then it dawned on me that their new devices (they were Pocket-PC based) had built-in speakers, and could play WAV files, etc. I started wondering whether I could make noise with these things too. I figured the most straightforward way to do this was to write my own WAV file. So I learned about the format of the WAV file, and learned to write code to generate WAV files that would play tones of various frequencies. As a "proof of concept," I wrote code which would even generate DTMF tones, so I could put the device up to a phone's receiver and the device could dial the phone.

The challenge then was to take a file, break it into its component 0's and 1's, and then generate tones corresponding to each bit. I learned about Nyquist's Theorem, which describes how I need to build a sample to encode waves of particular frequencies. Very fun stuff. Took a while, but I figured it out. I could generate a WAV file which "sounded" like a real acoustic coupler, but my transmission wouldn't work with their host systems. It took me several days to realize that in C++, I needed to use the pow() function to raise a number to a power; I had inadvertently been using the ^ operator, I guess mixing that up from another language. When I figured this out, my transmission went through! Their system would give confirmation numbers on successful transmissions. My first confirmation number was "50." I wrote it BIG in my notebook that day.

For me, this is one of the most fun projects I've been involved in. An awful lot of fun. Very satisfying. Made the customer very pleased (they didn't need to buy hardware acoustic couplers). A great puzzle to solve.

No comments: