Hi Saul,
TestNetwork application is the best application to start with to check if your
networking is working alright, BACAUSE the application exercises the basic
networking layers, i.e collection (using CTP) and dissemination (Using DIP or
DRIP).
You will have to make two new files so that you can print all the data on the
Screen
I suggest that in the TestNetwork application you make another folder called
"java:. Make the following two new files in this folder.
1) Makefile
BUILD_EXTRA_DEPS += TestNetwork.class
CLEAN_EXTRA = *.class TestNetworkMsg.java
TestNetwork.class: $(wildcard *.java) TestNetworkMsg.java
javac *.java
TestNetworkMsg.java:
mig java -target=null -java-classname=TestNetworkMsg
../TestNetwork.h TestNetworkMsg -o $@
2) TestNetwork.java
import net.tinyos.message.*;
import net.tinyos.util.*;
import java.io.*;
public class TestNetwork implements MessageListener
{
MoteIF mote;
// Main entry point
void run() {
mote = new MoteIF(PrintStreamMessenger.err);
mote.registerListener(new TestNetworkMsg(),
this);
}
synchronized public void messageReceived(int dest_addr, Message message) {
if (message instanceof TestNetworkMsg) {
TestNetworkMsg msg = (TestNetworkMsg)message;
System.out.println("Event is happening at node
number = " + msg.get_source());
System.out.println("The message sequence for
source node = " + msg.get_seqno());
System.out.println("PARENT for the event
generating node = " + msg.get_parent());
System.out.println("Link quality with the
parent is = " + msg.get_metric());
System.out.println("Number of hops to get to
the base = " + msg.get_data());
System.out.println("Number of hops to get to
the base = " + msg.get_hopcount());
System.out.println("Number of hops to get to
the base = " + msg.get_ sendCount ());
System.out.println("Number of hops to get to
the base = " + msg.get_ sendSuccessCount ());
System.out.println(" " );
}
}
public static void main(String[] args) {
TestNetwork me = new TestNetwork();
me.run();
}
}
Now if you go to this java directory, you should type "make". This should
automatically create all .class files and TestNetworkMsg.java file.
Now you can run the following two tests at this point. If your Root Node is
attached to the serial port/PC then you run the following command:
java net.tinyos.tools.Listen -comm serial@/dev/ttySn:micaz ---------à Put the
correct number in place of 'n' and correct mote
AND
java net.tinyos.tools.MsgReader TestNetworkMsg
You should be seeing loys of data coming in like "the source", "the parent",
etc.... I hope this helps.................
Cheers,
Varun Jain
From: Saul Garcia [mailto:[email protected]]
Sent: Wednesday, 11 February 2009 2:33 AM
To: Varun Jain
Subject: Help with the TestNework.java
Hi,
I have been reading the tinyos mailing-list since I am working with it for my
Master Thesis. I have to make modify the TestNetwork application, but for now I
would like to understand what it does exactly. Then, I wonder if you could
resend me the java applications to print out all the data in the screen. I read
on the mailing-list that you attached them in June, but I haven't found them. I
would really appreciate your help.
Bests,
--
Saul Garcia Huertes
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help