Functional Bluetooth and Rewritten iWRAP Library

The Bluetooth system has been one of those lingering features that I couldn’t quite manage to nail down for one reason or another. Well, no more! It’s working now. I’ve got a robust connection and data management system in place, built around the Bluegiga WT12 Bluetooth module and its powerful iWRAP firmware.

The solution to this longstanding problem involved some yak shaving, within the overall context of Keyglove development. Here’s a brilliant and hilarious explanation of yak-shaving in animating GIF format:

In short, I totally rewrote the iWRAP parser library that I began years ago in order to make it function properly and fit nicely with the Keyglove API structure. The end result of that effort is a cleaner and much more intuitive interface that I and anyone else can use to talk to Bluegiga’s classic Bluetooth modules, like the WT12 that I have in the Keyglove. While it technically stands on its own and isn’t part of the Keyglove firmware, it dovetails perfectly between both the Keyglove and my day job at Bluegiga, and it has already been useful for other people in other applications.

In short, the new iWRAP code cleaned up one of the messiest and most complex parts of the Keyglove firmware source, and is now both much easier to understand and much easier to maintain (not to mention the more important fact that it actually works).


With the right configuration, the Keyglove can now automatically reconnect to one or more previously paired devices, even going so far as supporting simultaneous connections. This means, for instance, that you could connect to your PC and your smartphone at the same time, and have one set of touches trigger behavior on the PC while a different set controls the media functionality on your phone. Yep, it’s that flexible.

  1. Good article, thanks.

  2. Hey Jeff,

    Is the library compatible with iWRAP 5.5.x, too? Or only with iWRAP 5.0.x?

    • There may be a few minor incompatibilities with iWRAP 5.5, but I can’t think of any off-hand. I’ve been using this with a 5.5 build for a while.

      • Great! And thanks for quick feedback. That’s what I assumed, too.
        The only differences in the command interface the iWRAP documentation mentions are:
        *Shorter friendly_name in SET BT NAME (140 chars vs. 255 chars in v5.0.x)
        *One additional optional parameter in SET BT MTU
        *One additional optional parameter in SET CONTROL PIO

Leave a Reply