X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2Ftests%2FTestOscilloscopeLQI%2FMultihopOscilloscopeC.nc;h=ad51c6ee9e96c711bb5d1affda520d04d002cf84;hb=da0cfeda9689aa64cfce0aa209f51803dcb11c21;hp=9e9e8aae1ef07eea07c9ed8205da39d035d90ae3;hpb=594acbf436f5f78611348f7763a89c84f38ba46a;p=tinyos-2.x.git diff --git a/apps/tests/TestOscilloscopeLQI/MultihopOscilloscopeC.nc b/apps/tests/TestOscilloscopeLQI/MultihopOscilloscopeC.nc index 9e9e8aae..ad51c6ee 100644 --- a/apps/tests/TestOscilloscopeLQI/MultihopOscilloscopeC.nc +++ b/apps/tests/TestOscilloscopeLQI/MultihopOscilloscopeC.nc @@ -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;