[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestNetwork
TestNetworkC.nc, 1.1.2.5, 1.1.2.6
Phil Levis
scipio at users.sourceforge.net
Wed Jun 7 14:24:37 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/TestNetwork
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22951
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
TestNetworkC.nc
Log Message:
Updates.
Index: TestNetworkC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/TestNetwork/Attic/TestNetworkC.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
*** TestNetworkC.nc 2 Jun 2006 02:05:32 -0000 1.1.2.5
--- TestNetworkC.nc 7 Jun 2006 21:24:35 -0000 1.1.2.6
***************
*** 48,52 ****
call RootControl.setRoot();
}
! call Timer.startPeriodic(10000);
}
}
--- 48,52 ----
call RootControl.setRoot();
}
! call Timer.startPeriodic(1000);
}
}
***************
*** 55,78 ****
event void Timer.fired() {
! call Leds.led1Toggle();
if (busy || call ReadSensor.read() != SUCCESS) {
! call Leds.led0On();
return;
}
- call Leds.led0Off();
dbg("TestNetworkC", "TestDisseminationC: Timer fired.\n");
busy = TRUE;
}
event void ReadSensor.readDone(error_t err, uint16_t val) {
TestNetworkMsg* msg = (TestNetworkMsg*)call Send.getPayload(&packet);
msg->data = val;
if (err != SUCCESS) {
busy = FALSE;
- call Leds.led0On();
- dbg("TestNetworkC", "Sensor sample failed.\n");
}
! else if (call Send.send(&packet, sizeof(TestNetworkMsg)) != SUCCESS) {
! busy = FALSE;
call Leds.led0On();
dbg("TestNetworkC", "Transmission failed.\n");
--- 55,80 ----
event void Timer.fired() {
! call Leds.led0Toggle();
if (busy || call ReadSensor.read() != SUCCESS) {
! signal ReadSensor.readDone(SUCCESS, 0);
return;
}
dbg("TestNetworkC", "TestDisseminationC: Timer fired.\n");
busy = TRUE;
}
+ void failedSend() {
+ dbg("App", "%s: Send failed.\n", __FUNCTION__);
+ }
+
event void ReadSensor.readDone(error_t err, uint16_t val) {
TestNetworkMsg* msg = (TestNetworkMsg*)call Send.getPayload(&packet);
msg->data = val;
if (err != SUCCESS) {
+ dbg("App", "%s: read done failed.\n", __FUNCTION__);
busy = FALSE;
}
! if (call Send.send(&packet, sizeof(TestNetworkMsg)) != SUCCESS) {
! failedSend();
call Leds.led0On();
dbg("TestNetworkC", "Transmission failed.\n");
***************
*** 81,84 ****
--- 83,87 ----
event void Send.sendDone(message_t* m, error_t err) {
+ call Leds.led1Toggle();
if (err != SUCCESS) {
call Leds.led0On();
***************
*** 96,100 ****
}
! event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len) {
dbg("TestNetworkC", "Received packet at %s.\n", sim_time_string());
if (!uartbusy) {
--- 99,105 ----
}
! 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) {
More information about the Tinyos-2-commits
mailing list