4

I am working on a project on Android where I want to connect and communicate between my Android device and a Wii Remote / Balance Board. Currently I am trying to use the motej library and the bluecove library to accomplish this. I know that these two libraries can work together underneath Android to get a device connected because I have a test app set up that is connecting correctly (and can send data, I can make the remote rumble and set any of the LEDs on or off) but it unexpectedly closes a moment after the connection is made. I am not sure why its ending like this yet. I am very new to bluetooth development so I thought going this route with the libraries would get me up and running without having to understand much of the nitty gritty about the connection. But since I am having some problems with my current test app I am starting to wonder if I should be even bothering with these libraries at all or if it might be mroe effective to work under the Android bluetooth API to get the devices connected and communicating. So my questions are:

  1. Is it possible to connect and send/receive the data that I would need to in order to get all of the functionality of the wii remote under the standard Android Bluetooth API or am I going to have to use something like the bluecove library that I have now?
  2. If it is possible to do this without a 3rd party bluetooth library am I going to be better off modifying something like the motej library to work with the Android Bluetooth API instead of how it does now with javax.bluetooth? Or is it going to require so much change that I might as well just scrap that and start work on my own new library?
  3. Does anyone have any clue that might point me in the right direction for getting it test app as I have it now fixed? My log output is below, I am making it through the connection fine but a second afterward my app closes without a force close dialog or anything.
  4. Does anyone know of a library that aims to give access to a Wii remote with bluetooth that is actually built to work with Android instead of just java?

INFO/System.out(31264): Found mote: 00191D652A6B

INFO/WiiMoteTest1(31264): 00191D652A6B        

WARN/System.err(31264): 14821 [DeviceInquiryThread-0] INFO motej.MoteFinder - found device: TOSHIBA-USER - 00037AB338F7 - 256:12 - 1835008        

ERROR/BluetoothEventLoop.cpp(9154): event_filter: Received signal org.bluez.Adapter:DeviceFound from /org/bluez/30823/hci0

DEBUG/BluetoothService(9154): updateDeviceServiceChannelCache(00:03:7A:B3:38:F7)


ERROR/BluetoothEventLoop.cpp(9154): event_filter: Received signal org.bluez.Adapter:DeviceFound from /org/bluez/30823/hci0

DEBUG/BluetoothService(9154): updateDeviceServiceChannelCache(00:03:7A:B3:38:F7)

WARN/System.err(31264): 17470 [DeviceInquiryThread-0] INFO motej.MoteFinder - inquiry completed

DEBUG/dalvikvm(30209): GC_EXPLICIT freed 93 objects / 4464 bytes in 80ms


DEBUG/dalvikvm(31264): Debugger has detached; object registry had 0 entries

WARN/dalvikvm(31264): ReferenceTable overflow (max=512)

WARN/dalvikvm(31264): Last 10 entries in JNI local reference table:

WARN/dalvikvm(31264):   502: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264):   503: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264):   504: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264):   505: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264):   506: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264):   507: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264):   508: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264):   509: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264):   510: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264):   511: 0x44d3a8b8 cls=Ljava/lang/Class; 'Lcom/intel/bluetooth/BluetoothStackBlueZ;' (164 bytes)

WARN/dalvikvm(31264): JNI local reference table summary (512 entries):

WARN/dalvikvm(31264):   512 of Ljava/lang/Class; 164B (1 unique)

WARN/dalvikvm(31264): Memory held directly by tracked refs is 164 bytes

ERROR/dalvikvm(31264): Failed adding to JNI local ref table (has 512 entries)

INFO/dalvikvm(31264): "in:00191D652A6B" prio=5 tid=12 RUNNABLE

INFO/dalvikvm(31264):   | group="main" sCount=0 dsCount=0 s=N obj=0x44d59738 self=0x2501b8

INFO/dalvikvm(31264):   | sysTid=31283 nice=0 sched=0/0 cgrp=default handle=2425592

INFO/dalvikvm(31264):   | schedstat=( 49835206 61798099 541 )

INFO/dalvikvm(31264):   at com.intel.bluetooth.BluetoothStackBlueZ.l2Receive(Native Method)

INFO/dalvikvm(31264):   at com.intel.bluetooth.BluetoothL2CAPConnection.receive(BluetoothL2CAPConnection.java:117)

INFO/dalvikvm(31264):   at motej.IncomingThread.run(IncomingThread.java:260)

ERROR/dalvikvm(31264): VM aborting
FoamyGuy
  • 46,603
  • 18
  • 125
  • 156
  • I found this answer useful: [Is it possible for an android device to read information from the wii controller and nunchuck?](http://stackoverflow.com/a/9669315/383414) (quoted below with thanks to @Ben Mordue) > Have a look at this open source project: > http://code.google.com/p/android-bluez-ime/ I have not looked at the source code yet, but have installed the APK file on Galaxy Nexus and it works. – Richard Le Mesurier Feb 08 '13 at 20:51

0 Answers0