X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2FMViz%2FMVizC.nc;h=f62a26cbf66e2aa29ba398294b09fe2f4cd27703;hb=7bae398b43f69d024cf524349705fee97ab002ae;hp=6719d8f0fe8ae49fd1322fc9b6a213d7d1f61fd6;hpb=ec0de8e1ac425b0f6855d46f737c2726cd82df88;p=tinyos-2.x.git diff --git a/apps/MViz/MVizC.nc b/apps/MViz/MVizC.nc index 6719d8f0..f62a26cb 100644 --- a/apps/MViz/MVizC.nc +++ b/apps/MViz/MVizC.nc @@ -19,7 +19,7 @@ #include "MViz.h" -module MVizC { +module MVizC @safe(){ uses { // Interfaces for initialization: interface Boot; @@ -125,8 +125,8 @@ implementation { Receive.receive(message_t* msg, void *payload, uint8_t len) { if (uartbusy == FALSE) { mviz_msg_t* in = (mviz_msg_t*)payload; - mviz_msg_t* out = (mviz_msg_t*)call SerialSend.getPayload(&uartbuf); - if (len != sizeof(mviz_msg_t)) { + mviz_msg_t* out = (mviz_msg_t*)call SerialSend.getPayload(&uartbuf, sizeof(mviz_msg_t)); + if (out == NULL) { return msg; } else { @@ -177,7 +177,11 @@ implementation { */ event void Timer.fired() { if (!sendbusy) { - mviz_msg_t *o = (mviz_msg_t *)call Send.getPayload(&sendbuf); + mviz_msg_t *o = (mviz_msg_t *)call Send.getPayload(&sendbuf, sizeof(mviz_msg_t)); + if (o == NULL) { + fatal_problem(); + return; + } memcpy(o, &local, sizeof(local)); if (call Send.send(&sendbuf, sizeof(local)) == SUCCESS) sendbusy = TRUE; @@ -214,7 +218,7 @@ implementation { } local.reading = data; call CtpInfo.getEtx(&val); - local.link_route_value = val; + local.etx = val; call CtpInfo.getParent(&val); local.link_route_addr = val; local.link_route_value = call LinkEstimator.getLinkQuality(local.link_route_addr);