Hi Saul,

Can you execute the "Listen" tool?????????????

 

If you can run that then it should be pretty much same. Is your TestNetworkMsg 
file generated correctly??????????? If it is not, then check that in 
"Makefile",  you need to have a TAB before "java" and "mig java"

 

Have you set up your MOTECOM environment variable?? If you have then you only 
need to give the following command:

 

java net.tinyos.tools.MsgReader TestNetworkMsg

 

It should work straight away. Also check if your serial port is connected to 
the Root of the network. But if you are able to see anything using "Listen" 
tool then there is some other problem.

 

I hope it helps.

 

Cheers,

 

Varun Jain

 

From: Saul Garcia [mailto:[email protected]] 
Sent: Thursday, 12 February 2009 12:35 AM
To: Varun Jain
Cc: [email protected]
Subject: Re: Help with the TestNework.java

 

Thank you, I have been working but there is a problem, I cannot execute the 
second command:

java net.tinyos.tools.MsgReader TestNetworkMsg

Am I missing something? I have tried adding the -comm 
serial@/dev/tty.usb......B:iris, but no luck because it appeared the message: 
s...@localhost:9002 died - exiting (java.net.ConnectException: Connection 
refused)

Kindly,

2009/2/11 Varun Jain <[email protected]>

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




-- 
Saul Garcia Huertes

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to