However, unlike Internetprotocol development, since the routing protocol application for TinyOS is justlike a standard application. We have to specify the configuration, situation,topology and so on. To achieve the goal, we must have the control of the mode,including the mote identification number, the number of messages sent for anymote, even the data information such as size, type and so on.
I add some new codes and put the code together totest the routing:
1. RoutingTest.nc
configuration RoutingTest {
}
implementation {
components Main, RoutingTestM, TimerC, LedsC, NoLeds, Photo, RandomLFSR,
GenericCommPromiscuous as Comm, Bcast, MultiHopRouter as MyRouting,QueuedSend, Sounder;
Main.StdControl -> RoutingTestM.StdControl;
Main.StdControl -> Bcast.StdControl;
Main.StdControl-> MyRouting.StdControl;
Main.StdControl -> QueuedSend.StdControl;
Main.StdControl -> TimerC;
Main.StdControl -> Comm;
RoutingTestM.Timer -> TimerC.Timer[unique("Timer")];
RoutingTestM.Leds -> LedsC; //NoLeds;
RoutingTestM.Sounder -> Sounder;
RoutingTestM.Bcast -> Bcast.Receive[AM_RoutingTestCMDMSG];
Bcast.ReceiveMsg[AM_RoutingTestCMDMSG] ->Comm.ReceiveMsg[AM_RoutingTestCMDMSG];
RoutingTestM.RouteControl -> MyRouting;
RoutingTestM.Send -> MyRouting.Send[AM_RoutingTestMSG];
MyRouting.ReceiveMsg[AM_RoutingTestMSG] ->Comm.ReceiveMsg[AM_RoutingTestMSG];
}
2. RoutingTestM.nc
module RoutingTestM {
provides {
interface StdControl;
}
uses {
interface ADC;
interface Timer;
interface Leds;
interface StdControl as Sounder;
interface Send;
interface Receive as Bcast;
interface RouteControl;
}
}
implementation {
enum {
TIMER_GETADC_COUNT = 1,
TIMER_CHIRP_COUNT = 10,
};