Hi, On Tue, 2006-04-04 at 11:46 -0700, Cory Sharp wrote: > Take a look at the TinyOS Tutorial Lesson 6 if you haven't already. > http://www.tinyos.net/tinyos-1.x/doc/tutorial/lesson6.html > > I recommend you study the TinyOS Java classes MoteIF, BuildSource, and > PhoenixSource. You basically want to do something like this > > source = BuildSource.makePhoenix( motecomstr, PrintStreamMessenger.err ); > mote = new MoteIF( source, groupid ); > > and do that for each connection you want to open.
First of all, thanks for pointing me out to those classes, they clarified my problem a lot So what you are saying is, I can create PhoenixSources and use them to create a new MoteIF object which I should be able to use as usual to send/receive packets, so, for example, if I want to open three USB connections I can do that creating 3 PhoenixSources and 3 MoteIFs, and I wouldn't need to use SerialForwarder. My initial idea was to have a program which would create the PhoenixSource objects and keep them open, a la SerialForwarder, and have other programs create MoteIF objects to send and receive messages as necessary. I couldn't find a way to make this work, though; usually, MoteIF objects always connect to the serial forwarder using the default MOTECOM setting, and so they are always created with MoteIF((Messenger)null), and I can't create it with MoteIF(source5) if source5 is a variable from another program which is already running independently... Anyway, to simplify things a bit, I tried to make it all in the same program and use just one connection to simplify things, to see how it'd work without using SerialForwarder. To do this, I made a little program which should send a message to a Mote and get an answer from it. To establish the connection, I have tried with: try { source = BuildSource.makePhoenix( "serial@/dev/ttyUSB3:telos", PrintStreamMessenger.err ); m = new MoteIF(source); m.registerListener(new DimmerControlMSG(), this); } But it fails to work. It apparently gets stalled on m = new MoteIF(source); the message I get on the console is: getenv JNI library not found. Env.getenv will not work (please consult installation directions in tinyos-1.x/tools/java/net/tinyos/util/Env.INSTALL) Experimental: JNI_OnLoad called. Devel Library ========================================= Native lib Version = RXTX-2.1-7pre20 Java lib Version = RXTX-2.1-7pre20 RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyUSB2 I have no idea why this could be happening since I think I am doing it the "proper" way, and I don't think it's related to JNI. Any suggestions would be greatly appreciated. Thank you, - Jose. _______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help