Java Native Interface?

2007-03-10
2013-05-23
  • This is a fantastic library -- thanks!!!  Now, a quick question:

    Would it be possible to create a Java interface to the DarwiinRemote library as suggested by this documentation:

    http://developer.apple.com/java/jniuniversal.html

    Although I was able to get DarwiinRemote to build thanks to the discussion in the Help forum, I'm not familiar with Xcode -- kind of daunted by it -- and the linked instructions look very complicated to my newbish eyes. =) 

    It seems to me that we would want to be able to set event listeners to be called by the functions like "buttonChanged" and  "irPointMovedX", etc.  There probably are other possibilities for interfacing as well.

    So (1) is this possible with Xcode?, and (2) is anyone up for trying it?

    Best,
    -P

     
    • Jasen Jacobsen
      Jasen Jacobsen
      2007-03-10

      Over at Wiili (http://www.wiili.org/forum/wiimote-via-java-t983-s80.html) there is a guy working on a Java library.  Looks like it doesn't quite work on the Mac, but he is working with the BT library provider.  The idea of doing a JNI bridge to the WiiRemote Framework is intriguing.  Maybe go add it to the feature request list.  I do mostly Java at work, so I'd be interested, but there's a few other things on my list right now - Mii support being next.

      - Jasen.

       
    • Jasen,

      First -- thanks for contributing to this project and forum. 

      I did see that Wiili forum thread as well...  unfortunately there's little way to determine that developer's progress. Also he seems to be an anti-open source control freak =)  For both of these reasons, I'm not really holding my breath for a usable library, but perhaps I'll be pleasantly surprised!

      I'll see if I can get this on the feature request list.  Regardless of when it gets done, do you think that events/listeners would be the way to go? 

      Alternatively, do you think that a more generic idea of a Wiimote TCP/IP server might be preferable?

      Best,
      -P

       
    • OSC (open sound control) would be a good alternative to wiimote tcp/ip server.

      oscpack (http://www.audiomulch.com/~rossb/code/oscpack) is a nice platform independent c++ library. if i only knew how to use the framework. i already did some modifications for darwiinremote. but i am programming java and not cocoa...

       
    • mattea
      mattea
      2007-06-25

      I'm trying to write a JNI wrapper to the WiiFramework, but I haven't programmed in objective c before, and I'm having trouble using the WiiRemoteDiscovery class, (I can create a WiiRemoteDiscovery object and start it, but nothing happens). 

      Does anyone have a very simple test program for WiiRemoteDiscovery that I could look at?  Something along the lines of the one below (but that works?):

      @interface AWiiDelegate : NSObject{}
      @end

      @implementation AWiiDelegate
          - (void) WiiRemoteDiscovered:(WiiRemote*)wiimote{
              printf("DISCOVERED!!! \n");   
          }   
          - (void) WiiRemoteDiscoveryError:(int)code{
              printf("DISCOVERED ERROR!!! \n");
          }
      @end

      -(void) someTestFunction(){
          WiiRemoteDiscovery * discovery = [[WiiRemoteDiscovery alloc] init];
          AWiiDelegate * delegate = [[AWiiDelegate alloc] init];   
          [discovery setDelegate: delegate];
          [discovery start];
      }

       
    • mattea
      mattea
      2007-06-26

      An ugly, (but working) test program if others have the same need...

      #import <WiiRemote/WiiRemote.h>
      #import <WiiRemote/WiiRemoteDiscovery.h>

      @interface Dely : NSObject
      @end

      @implementation Dely
      - (void) WiiRemoteDiscovered:(WiiRemote*)wiimote{
          printf("dude!\n");
      }

      - (void) WiiRemoteDiscoveryError:(int)code{
          printf("dude\n");
      }

      @end

      int main(int argc, char *argv[])
      {
          NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
         
          WiiRemoteDiscovery * _discovery = [[WiiRemoteDiscovery alloc] init];
          Dely * dely = [[Dely alloc] init];
          [_discovery setDelegate: dely];
          [_discovery start];
         
          CFRunLoopRun();
         
          [pool release];
      }