WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wiimote via Java
Goto page 1, 2, 3 ... 29, 30, 31  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> WiiremoteJ
View previous topic :: View next topic  
Author Message
mik



Joined: 10 Jan 2007
Posts: 26

Digg It
PostPosted: Wed Jan 10, 2007 10:33 am    Post subject: Wiimote via Java

Hello,
anyone tried to use Java to connect to Wiimote trying a JSR-82 implementation like avetanaBluetooth?

I'm facing some problems, not really sure what channel I should use in the URI ( "btl2cap://xxxxxxxxxxxx:?) to connect and send/read data. Any suggestions? I succesfully connect to channel 1, but nothing happens whe i send data.

My code looks something like:

Code:

String uri = "btl2cap://00191D927C87:1";
L2CAPConnection con = (L2CAPConnection) Connector.open(uri);

byte[] data =  {0x52,0x12,0x00,0x31};
con.send(data);
read = con.receive(data);


Is the approach right?

Thanks,
mik
Back to top
View user's profile Send private message
togikun



Joined: 03 Jan 2007
Posts: 63

Digg It
PostPosted: Wed Jan 10, 2007 12:32 pm    Post subject:

I haven't tried the java bluetooth libs, they seemed too messy. Maybe you should look for a HID class?
Back to top
View user's profile Send private message
mik



Joined: 10 Jan 2007
Posts: 26

Digg It
PostPosted: Wed Jan 10, 2007 1:22 pm    Post subject:

Thanks for your answer. Have you got something in mind? I can't find anything usefull supprting BT HID in Java. That's why I tried to send the data directly via L2CAP, if only i could connect to right channel.

I am working on a Mac, i should add.

mik
Back to top
View user's profile Send private message
mikey



Joined: 25 Dec 2006
Posts: 56

Digg It
PostPosted: Wed Jan 10, 2007 5:43 pm    Post subject:

HID is pretty abstract whether the connection is via bluetooth or usb. just find a java api for sending and receiving HID reports.
Back to top
View user's profile Send private message Visit poster's website
mik



Joined: 10 Jan 2007
Posts: 26

Digg It
PostPosted: Wed Jan 10, 2007 7:55 pm    Post subject:

OK, so there seems to be none. At least not a free and finished one.
The Problem is, for using BT in JAVA you need also already need a lib implementing the suggested API (JSR-82) and bridging this to the underlying system. For MACs the only one is avetana which is based on BlueZ.

A BT HID lib for Java now base relay on JSR-82. As far as I can see, there is no such thing, except some not ready HID2go API and a Linux based USB HID.

I had a quick look at the Python script here at wiili, and it looked like it is just opening 2 connections to Channel 0x11 and 0x13 and is sending byte arrays over those connections. I'm just wondering if there has to be some handshaking before, in order to open this connections, as i only can connect to channel 1.

Maybe the BT lib I'm using has a bug. Or maybe I am doing things completley wrong. Dunno.

But thanks for your help.

cu mik
Back to top
View user's profile Send private message
Cadex



Joined: 25 Dec 2006
Posts: 9

Digg It
PostPosted: Thu Jan 11, 2007 8:45 am    Post subject:

I have done this, exactly the way you planned to do it: using the avetana JSR-82 implementation.

I switched over to using Python instead, as only very few people seem to have a JSR-82 implementation on their J2SE system. But using Java definitely works, just the way you said: By opening two connections on channel 0x11 and 0x13 - one for sending, one for receiving data.

If you don't manage to figure it out yourself, I can post the code in a few days. I just reinstalled my OS on a new hard drive, and I currently can't copy my old files to the new hard drive as I only have one SATA cable so far. Evil or Very Mad
Back to top
View user's profile Send private message
mik



Joined: 10 Jan 2007
Posts: 26

Digg It
PostPosted: Thu Jan 11, 2007 12:09 pm    Post subject:

Wow, that would be to awesome. Surprised
Maybe avetana is a little wobbly on the Mac?
Or I have some bug in my code.
Anyhow, if you had it running, that would
exclude all possibility of doubt if I
could test your code. Thanks.

Anyway, good luck with your system.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> WiiremoteJ All times are GMT
Goto page 1, 2, 3 ... 29, 30, 31  Next
Page 1 of 31

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group