Tuesday, December 25, 2007

Still alive 2

Still alive..

The the site from Johnny Chung Lee inspired me to get on with the project.
See http://www.cs.cmu.edu/~johnny/ and check the Wii stuff.

3 comments:

Eiki said...

Hey I agree Johnny's stuff is awesome and I want to use Java also to talk to the wiimote. Where your code man, no files on sourceforge yet?

I'm especially interested in seeing if it is possible to send ir codes from the wiimote by issuing a bluetooth command so I can bluetooth to IR control my Robosapien robot...

Nemno said...

That would not be possible. The wiimote has not can see IR with it's camera. The sensor bar is not really a sensor bar... it got two infra red leds in it.

Unknown said...

Hi Nemno, i am a java developer trying to make work the wiiremotej chaos library through avetana. It looks like it works pretty good, i have compiled the avetana source, and then i added the generated 'avetanaBT.jar' to my project.
When i start my application the 'WiiRemoteJ.findRemotes(this)' waits until i turn on the wii remote, and it recognizes it perfectly.
My application is just a system mouse replacement (i created the project just to test how wiiremotej works).

Ok, until now everything is perfect, the mouse moves (really slow, but it moves). But in a moment it starts to move faster (like a real mouse), and then the application crash with the following exception:

Caused by: java.io.IOException: de.avetana.bluetooth.stack.BlueZException: Java_de_avetana_bluetooth_stack_BlueZ_openL2CAPNative: Unable to establish connection!

Investigating i found that it's necessary to modify the BlueZ java file to add the following:

int receiveMTU=-1, transmitMTU=-1;

I did that, but it's still crashing.
Investigating a little more, i found that the exception is being thrown in the file BlueZ.cpp inside the method Java_de_avetana_bluetooth_stack_BlueZ_openL2CAPNative, in the following block of code:

// Connect with the remote BT device
if (connect(s, (struct sockaddr *)&rem_addr, sizeof(rem_addr)) < 0 ) {
printf("Can't connect. %s(%d)", strerror(errno), errno);
close(s);
throwException(env, "Java_de_avetana_bluetooth_stack_BlueZ_openL2CAPNative: Unable to establish connection!");
return NULL;
}

I dont really know c++, i never have programmed it, but i am sure the exception is being thrown there.
I am not sure why it happens, maybe you can help me with this.

I am using Ubuntu 8.04.1, and i have an usb bluetooth dongle TBW-102UB (trendnet).

If you know how to resolve this, you will help me a lot.

Thx in advance!

Pablo