]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/tests/TestMultihopLqi/MultihopOscilloscopeC.nc
The big interface switchover for Packet, Send, Receive, and AMSend.
[tinyos-2.x.git] / apps / tests / TestMultihopLqi / MultihopOscilloscopeC.nc
index 55351c5207936726babb6fb34cd5700020ac2085..aed5a437752e7f584b622876e5987174bd93eb2d 100644 (file)
@@ -136,8 +136,8 @@ implementation {
       dbg_clear("App", "\n");
     }
     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 (out == NULL || call Packet.payloadLength(&uartbuf) != sizeof(oscilloscope_t)) {
        return msg;
       }
       else {
@@ -156,7 +156,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;
+      }
       memcpy(out, in, sizeof(oscilloscope_t));
 
       if (call UARTQueue.enqueue(newmsg) != SUCCESS) {
@@ -232,7 +235,10 @@ implementation {
   event void Timer.fired() {
     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) {
           dbg("App", "Sending a packet.\n");