Thursday, February 08, 2007

JWiimote

About the last post, it has been going slowly but anyhow. After almost drowning myself in Windows DDK, I have succeeded to make a Java library which communicates with a Wiimote. I've already named it: JWiimote :)

Instead of using the Pascal source mentioned before, I wrote a C driver dealing with a Wiimote as a HID device, and connected it with Java by JNI. Indeed it works fine! Now it can read button presses, not the motion or IR yet. I'm now trying to enable it to read those data as well.

The virtue of JWiimote is that I, and hopefully many other people who want to develop a Java application for Wiimotes in Windows, don't need to bother themselves by seeking for any working JSR-82 implementation or rather another bluetooth dongle. (In my case, I couldn't find any working JSR-82 implementation for my bluetooth dongle.) I guess there are not many bluetooth dongles which support MS Bluetooth stack. Thus JWiimote could benefit many people if it goes well.

I'm planning to open my source in the very near future. Perhaps following LGPL. For the first step I opened a project page. Yeah!
You might find more detail about JWiimote here: http://code.google.com/p/jwiimote/

Sunday, January 28, 2007

Wiimote and Java

These few days I was trying to hack an Wiimote, the cool remote controller for Wii. If you're not familiar with this, here is a nice passionate community about it: Wiili

Anyway, my development environment consists of:

  • one wiimote
  • one bluetooth dongle (intuix) supported by BlueSoleil
  • WindowsXP SP2 (mainly) / Debian Linux (nothing done here yet)
Since I wanted to use 'processing' to play with the Wiimote, I've worked for a Java-related platform. The starting point was to find a good and preferably free implementation of Java Bluetooth stack. And I had to face the following problems
  • BlueCove: This cannot get a proper local device address of my dongle. It just says 000000000000. According to several articles,
  • avetana: This says "No supported stack installed or no dongle available". I guess it's because I couldn't put the address of my dongle correctly when I've got the free demo of avetana. The address of my dongle is 10:11:11:11:11:11(or 11:11:11:11:11:11), and with this address I cannot download avetana.
In sum, I couldn't manage to get any JSR-82 implementation working with my dongle. I was about to give up my dongle and order another dongle which supports MS Bluetooth drivers. But I couldn't. Because it still works in other programming languages!
  • I took a look at other programs at Wiili, such as DarwiinRemote(for OS X) and Wiinmote(for XP). Afterwards I found that Wiinmote, in Delphi(precisely in Pascal), uses a library named HID controller. This HID controller basically uses PnP devices. That means, this Wiinmote just considers my Wiimote as a general PnP device. And it works perfectly!
What I'm wondering now is if I can get around seeking for any JSR-82 implementation by using PnP communication, for example. Probably the easiest way is just buying a new Bluetooth dongle from a well-known brand, in the list above. But... I don't like it. :( I mean, my dongle is still working very well in other languages. Why not Java? Should I really compile the HID controller into DLL and connect it with Java by JNI?