[Tinyos-2-commits] CVS: tinyos-2.x/apps/MultihopOscilloscope MultihopOscilloscopeC.nc, 1.1.2.2, 1.1.2.3

Phil Levis scipio at users.sourceforge.net
Thu Jun 29 12:12:51 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/apps/MultihopOscilloscope
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv31511/MultihopOscilloscope

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	MultihopOscilloscopeC.nc 
Log Message:
Edits for proper buffer movement (eliding the network header).


Index: MultihopOscilloscopeC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/MultihopOscilloscope/Attic/MultihopOscilloscopeC.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** MultihopOscilloscopeC.nc	29 Jun 2006 08:22:31 -0000	1.1.2.2
--- MultihopOscilloscopeC.nc	29 Jun 2006 19:12:49 -0000	1.1.2.3
***************
*** 33,36 ****
--- 33,37 ----
      interface Receive;
      interface AMSend as SerialSend;
+     interface CollectionPacket;
      interface RootControl;
  
***************
*** 121,127 ****
    Receive.receive(message_t* msg, void *payload, uint8_t len) {
      if (uartbusy == FALSE) {
        uartbusy = TRUE;
!       uartlen = len;
!       memcpy(&uartbuf, msg, sizeof(message_t));
        post uartSendTask();
      }
--- 122,135 ----
    Receive.receive(message_t* msg, void *payload, uint8_t len) {
      if (uartbusy == FALSE) {
+       oscilloscope_t* in = (oscilloscope_t*)payload;
+       oscilloscope_t* out = (oscilloscope_t*)call SerialSend.getPayload(&uartbuf);
+       if (len != sizeof(oscilloscope_t)) {
+ 	return msg;
+       }
+       else {
+ 	memcpy(out, in, sizeof(oscilloscope_t));
+       }
        uartbusy = TRUE;
!       uartlen = sizeof(oscilloscope_t);
        post uartSendTask();
      }
***************
*** 167,179 ****
    event void Timer.fired() {
      if (reading == NREADINGS) {
! 	    if (!sendbusy) {
!         oscilloscope_t *o = (oscilloscope_t *)call Send.getPayload(&sendbuf);
! 	      memcpy(o, &local, sizeof(local));
! 	      if (call Send.send(&sendbuf, sizeof(local)) == SUCCESS)
! 	        sendbusy = TRUE;
          else
            report_problem();
! 	    }
! 
        reading = 0;
        /* Part 2 of cheap "time sync": increment our count if we didn't
--- 175,187 ----
    event void Timer.fired() {
      if (reading == NREADINGS) {
!       if (!sendbusy) {
! 	oscilloscope_t *o = (oscilloscope_t *)call Send.getPayload(&sendbuf);
! 	memcpy(o, &local, sizeof(local));
! 	if (call Send.send(&sendbuf, sizeof(local)) == SUCCESS)
! 	  sendbusy = TRUE;
          else
            report_problem();
!       }
!       
        reading = 0;
        /* Part 2 of cheap "time sync": increment our count if we didn't



More information about the Tinyos-2-commits mailing list