[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestNetwork Driver.c,
1.1.2.1, 1.1.2.2 TestNetworkAppC.nc, 1.1.2.5,
1.1.2.6 TestNetworkC.nc, 1.1.2.6, 1.1.2.7 test.py, 1.1.2.2, 1.1.2.3
Phil Levis
scipio at users.sourceforge.net
Thu Jun 8 18:47:00 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/TestNetwork
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22135
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
Driver.c TestNetworkAppC.nc TestNetworkC.nc test.py
Log Message:
App needs to start serial stack.
Index: Driver.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/TestNetwork/Attic/Driver.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** Driver.c 7 Jun 2006 21:26:08 -0000 1.1.2.1
--- Driver.c 9 Jun 2006 01:46:57 -0000 1.1.2.2
***************
*** 14,21 ****
// t->addChannel("Gain", stdout);
! t->addChannel("App", stdout);
//t->addChannel("LITest", stdout);
//t->addChannel("AM", stdout);
! t->addChannel("Forwarder", stdout);
Radio* r = t->radio();
--- 14,21 ----
// t->addChannel("Gain", stdout);
! t->addChannel("AMQueue", stdout);
//t->addChannel("LITest", stdout);
//t->addChannel("AM", stdout);
! t->addChannel("Traffic", stdout);
Radio* r = t->radio();
Index: TestNetworkAppC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/TestNetwork/Attic/TestNetworkAppC.nc,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** TestNetworkAppC.nc 2 Jun 2006 20:51:13 -0000 1.1.2.5
--- TestNetworkAppC.nc 9 Jun 2006 01:46:57 -0000 1.1.2.6
***************
*** 21,27 ****
--- 21,29 ----
components new DemoSensorC();
components new SerialAMSenderC(CL_TEST);
+ components SerialActiveMessageC;
TestNetworkC.Boot -> MainC;
TestNetworkC.RadioControl -> ActiveMessageC;
+ TestNetworkC.SerialControl -> SerialActiveMessageC;
TestNetworkC.RoutingControl -> Collector;
TestNetworkC.Leds -> LedsC;
***************
*** 33,35 ****
--- 35,38 ----
TestNetworkC.Receive -> Collector.Receive[CL_TEST];
TestNetworkC.UARTSend -> SerialAMSenderC.AMSend;
+ TestNetworkC.CollectionPacket -> Collector;
}
Index: TestNetworkC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/TestNetwork/Attic/TestNetworkC.nc,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** TestNetworkC.nc 7 Jun 2006 21:24:35 -0000 1.1.2.6
--- TestNetworkC.nc 9 Jun 2006 01:46:57 -0000 1.1.2.7
***************
*** 17,20 ****
--- 17,21 ----
uses interface Boot;
uses interface SplitControl as RadioControl;
+ uses interface SplitControl as SerialControl;
uses interface StdControl as RoutingControl;
uses interface DisseminationValue<uint16_t> as DisseminationPeriod;
***************
*** 26,29 ****
--- 27,31 ----
uses interface Receive;
uses interface AMSend as UARTSend;
+ uses interface CollectionPacket;
}
implementation {
***************
*** 31,44 ****
message_t packet;
message_t uartpacket;
uint8_t msglen;
bool busy = FALSE, uartbusy = FALSE;
event void Boot.booted() {
call RadioControl.start();
}
-
event void RadioControl.startDone(error_t err) {
if (err != SUCCESS) {
- call Leds.led0On();
call RadioControl.start();
}
--- 33,48 ----
message_t packet;
message_t uartpacket;
+ message_t* recvPtr = &uartpacket;
uint8_t msglen;
bool busy = FALSE, uartbusy = FALSE;
event void Boot.booted() {
+ call SerialControl.start();
+ }
+ event void SerialControl.startDone(error_t err) {
call RadioControl.start();
}
event void RadioControl.startDone(error_t err) {
if (err != SUCCESS) {
call RadioControl.start();
}
***************
*** 48,56 ****
call RootControl.setRoot();
}
! call Timer.startPeriodic(1000);
}
}
event void RadioControl.stopDone(error_t err) {}
event void Timer.fired() {
--- 52,61 ----
call RootControl.setRoot();
}
! call Timer.startPeriodic(128);
}
}
event void RadioControl.stopDone(error_t err) {}
+ event void SerialControl.stopDone(error_t err) {}
event void Timer.fired() {
***************
*** 83,89 ****
event void Send.sendDone(message_t* m, error_t err) {
- call Leds.led1Toggle();
if (err != SUCCESS) {
! call Leds.led0On();
}
else {
--- 88,93 ----
event void Send.sendDone(message_t* m, error_t err) {
if (err != SUCCESS) {
! // call Leds.led0On();
}
else {
***************
*** 101,111 ****
event message_t*
Receive.receive(message_t* msg, void* payload, uint8_t len) {
! call Leds.led2Toggle();
! dbg("TestNetworkC", "Received packet at %s.\n", sim_time_string());
if (!uartbusy) {
uartbusy = TRUE;
msglen = len;
- memcpy(&uartpacket, msg, sizeof(message_t));
post uartEchoTask();
}
return msg;
--- 105,118 ----
event message_t*
Receive.receive(message_t* msg, void* payload, uint8_t len) {
! dbg("TestNetworkC,Traffic", "Received packet at %s from node %hu.\n", sim_time_string(), call CollectionPacket.getOrigin(msg));
! call Leds.led1Toggle();
if (!uartbusy) {
+ message_t* tmp = recvPtr;
+ recvPtr = msg;
uartbusy = TRUE;
msglen = len;
post uartEchoTask();
+ call Leds.led2Toggle();
+ return tmp;
}
return msg;
***************
*** 113,120 ****
task void uartEchoTask() {
! call UARTSend.send(0, &uartpacket, msglen);
}
event void UARTSend.sendDone(message_t *msg, error_t error) {
}
}
--- 120,132 ----
task void uartEchoTask() {
! dbg("Traffic", "Sending packet to UART.\n");
! if (call UARTSend.send(0xffff, recvPtr, msglen) != SUCCESS) {
! uartbusy = FALSE;
! }
}
event void UARTSend.sendDone(message_t *msg, error_t error) {
+ dbg("Traffic", "UART send done.\n");
+ uartbusy = FALSE;
}
}
Index: test.py
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/TestNetwork/Attic/test.py,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** test.py 2 Jun 2006 02:05:32 -0000 1.1.2.2
--- test.py 9 Jun 2006 01:46:57 -0000 1.1.2.3
***************
*** 29,34 ****
#t.addChannel("AM", sys.stdout)
#t.addChannel("TreeRouting", sys.stdout)
! t.addChannel("TestNetworkC", sys.stdout)
! t.addChannel("PhilTest", sys.stdout)
#t.addChannel("LI", sys.stdout)
#t.addChannel("LITest", sys.stdout)
--- 29,35 ----
#t.addChannel("AM", sys.stdout)
#t.addChannel("TreeRouting", sys.stdout)
! #t.addChannel("TestNetworkC", sys.stdout)
! #t.addChannel("TestNetworkC", sys.stdout)
! t.addChannel("Traffic", sys.stdout)
#t.addChannel("LI", sys.stdout)
#t.addChannel("LITest", sys.stdout)
More information about the Tinyos-2-commits
mailing list