]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/tests/TestOscilloscopeLQI/MultihopOscilloscopeC.nc
The big interface switchover for Packet, Send, Receive, and AMSend.
[tinyos-2.x.git] / apps / tests / TestOscilloscopeLQI / MultihopOscilloscopeC.nc
index 9e9e8aae1ef07eea07c9ed8205da39d035d90ae3..ad51c6ee9e96c711bb5d1affda520d04d002cf84 100644 (file)
@@ -129,8 +129,8 @@ implementation {
     oscilloscope_t* out;
     call Leds.led1Toggle();
     if (uartbusy == FALSE) {
-      out = (oscilloscope_t*)call SerialSend.getPayload(&uartbuf);
-      if (len != sizeof(oscilloscope_t)) {
+      out = (oscilloscope_t*)call SerialSend.getPayload(&uartbuf, sizeof(oscilloscope_t));
+      if (call Packet.payloadLength(msg) != sizeof(oscilloscope_t)) {
        return msg;
       }
       else {
@@ -149,7 +149,10 @@ implementation {
       }
 
       //Prepare message to be sent over the uart
-      out = (oscilloscope_t*)call SerialSend.getPayload(newmsg);
+      out = (oscilloscope_t*)call SerialSend.getPayload(newmsg, sizeof(oscilloscope_t));
+      if (out == NULL) {
+       return msg;
+      }
       memcpy(out, in, sizeof(oscilloscope_t));
 
       if (call UARTQueue.enqueue(newmsg) != SUCCESS) {
@@ -226,7 +229,10 @@ implementation {
     if (TOS_NODE_ID % 500 == 0) {return;}
     if (reading == NREADINGS) {
       if (!sendbusy) {
-       oscilloscope_t *o = (oscilloscope_t *)call Send.getPayload(&sendbuf);
+       oscilloscope_t *o = (oscilloscope_t *)call Send.getPayload(&sendbuf, sizeof(oscilloscope_t));
+       if (o == NULL) {
+         return;
+       }
        memcpy(o, &local, sizeof(local));
        if (call Send.send(&sendbuf, sizeof(local)) == SUCCESS)
          sendbusy = TRUE;