Example Application: Mnp
MNP (Multi-hop Network Programming) is a multi-hop
reprogramming service that is targeted to Mica-2 motes.
The goal of multihop reprogramming is to provide a service
that all the sensor nodes in a connected network are
reprogrammed with a new binary image.
#include "gen/cMnpBlink_TinyOSModule.h" #include "gen/cMnpBlink_Main.h" cMnpBlink_Main *m = new cMnpBlink_Main(this,main,"Main",getIndex()); m->StdControl_init(); m->StdControl_start(); |
NesCT is going to build all the classes in gen directory.
Replace "cp" with "copy" and slash (/) with backslash (\) for
windows operating system at the following instructions.
[root@sinan tictoc]# cd components/
[root@sinan components]# cp MnpBlink.nc
../Application.nc
[root@sinan components]# cd ..
[root@sinan tictoc]# ./nesct.exe Application.nc
done.
Type makemake.bat/makemake.sh to create new Makefile for Win32/Linux.Type "make" to build the binary.
[root@sinan tictoc]# make
g++ -c -g -fpermissive -fPIC -DWITH_NETBUILDER -w
-DTOSNODES=1000 -DLINUX -DPLATFORM_OMNETPP -I./include
-I/root/projects/tinyos-1.x/tos/interfaces -I./include_tos
-I/opt/omnetpp-3.2/include simstart.cc
g++ tictoc1_n.o debug.o simstart.o tinyos.o tinyosmain.o
tossim.o txc1.o -g -L/opt/omnetpp-3.2/lib -lenvir -lcmdenv
-lsim_std -lnedxml -lxml2 -ldl -lstdc++ -lpthread -o tictoc
echo>.tstamp
The simulation screen should like this.
[root@sinan tictoc]# export DBG=usr1,usr2
[root@sinan tictoc]# ./tictoc
[0] 0:0:36.78505050: time 0:0:36.78505050
[0] 0:0:36.78505050: SendAdv Seg 2
[0] 0:0:36.90614425: Send start forward of Seg 2
[0] 0:0:36.96864425: Send start forward of Seg 2
[0] 0:0:37.03114425: Send start forward of Seg 2
[0] 0:0:37.09572625: FORWARD 1 of Seg 2
[0] 0:0:37.09572625: send done...
[0] 0:0:37.09780825: FORWARD 2 of Seg 2
[0] 0:0:37.09780825: send done...
[0] 0:0:37.09989025: FORWARD 3 of Seg 2
[0] 0:0:37.09989025: send done...
[0] 0:0:37.10197225: FORWARD 4 of Seg 2
[0] 0:0:37.10197225: send done...
[0] 0:0:37.10405425: FORWARD 5 of Seg 2
[0] 0:0:37.10405425: send done...
[0] 0:0:37.10613625: FORWARD 6 of Seg 2
[0] 0:0:37.10613625: send done...
[0] 0:0:37.10821825: FORWARD 7 of Seg 2
[0] 0:0:37.10821825: send done...
[0] 0:0:37.11030025: FORWARD 8 of Seg 2
[0] 0:0:37.11030025: send done...
[0] 0:0:37.11238225: FORWARD 9 of Seg 2
[0] 0:0:37.11238225: send
done...