Hi,

Sorry for not having realized earlier that this is Java ME!

Actually, I managed to get the TinyOS Java libraries running on Java ME 
in the past (but I haven't done it for a long time). Basically, you 
don't need JNI because Java ME already supports communicating with the 
serial port. However you need to modify the standard Java library 
classes to make use of this functionality.

Attached are the libraries as I was using them. Take this as a starting 
point and look for the following lines (or look at the change dates of 
the files) to find which classes I changed:

pkgs = BuildSource.makeSerial("comm:4", 19200);
ps = BuildSource.makePhoenix(pkgs, PrintStreamMessenger.err);
mif = new MoteIF(ps);
mif.registerListener(new TestMsg(), this);

The changes are mostly very simple. Have a look at 
net.tinyos.comm.TOSSerial.

Cheers,
Urs


Michael Schippling wrote:
> I would go look for doc on how ME handles JNI.
> "We" normally run the standard Java distributions
> so there could be major differences.
> MS
> 
> 
> Nicky wrote:
>> Hi,
>>
>> I am trying to run the SerialForwarder class on the Croassbow, Stargate 
>> Platform.
>> But when calling the System.loadLibrary("toscomm") fn within the 
>> toscommloadder class,
>> an error arises... It can't find the toscomm library (libtoscomm.so).
>>
>> I have the .so located in:
>> the current directory,
>> the <jre>/lib/,
>> and the /usr/lib.
>>
>> I have also included these in the java.library.path
>>
>> I have cross-compiled libtoscomm.so on my host using the arm-linux-gcc,
>> and have compiled SerialForwarder.java and associated files for the cdc 
>> embedded device.
>>
>> The error is caught and the message (t.getMessage) gives: "no 
>> libtoscomm.so in java.library.path"
>> or just "/mnt/cf1/cdc/lib/libtoscomm.so" depending on how I call the 
>> loadLibrary fn or the System.load(<abs_path>)
>> respectively.
>>
>> --------------------------------------------------------------
>> Could the problem be related to the java version I'm running...
>>
>> java -version "J2ME Foundation 1.0.1"
>> Java(TM) 2, Micro Edition (build 1.0.1-std-b12)
>> CVM (build 1.0.1-std-b12, interpreter loop)
>> ---------------------------------------------------------------
>>
>> Any feedback would be extremley appreciated.
>>
>> -- 
>> Regards
>> Nick
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to