X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2Ftests%2FTestMultihopLqi%2FMultihopOscilloscopeC.nc;h=aed5a437752e7f584b622876e5987174bd93eb2d;hb=da0cfeda9689aa64cfce0aa209f51803dcb11c21;hp=55351c5207936726babb6fb34cd5700020ac2085;hpb=594acbf436f5f78611348f7763a89c84f38ba46a;p=tinyos-2.x.git diff --git a/apps/tests/TestMultihopLqi/MultihopOscilloscopeC.nc b/apps/tests/TestMultihopLqi/MultihopOscilloscopeC.nc index 55351c52..aed5a437 100644 --- a/apps/tests/TestMultihopLqi/MultihopOscilloscopeC.nc +++ b/apps/tests/TestMultihopLqi/MultihopOscilloscopeC.nc @@ -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");