X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=apps%2Ftosthreads%2Fapps%2FTestCollection%2FTestCollectionC.nc;h=e49640ba994a4c4acc64070cb96bce5bfebcbc13;hb=ea002ecd1bf3ec3937310352ede53480cea89485;hp=e401fc0537d78c10426b9a84c54cae21db16ee01;hpb=054553520509ec36889269674d9b92890e2cb9cb;p=tinyos-2.x.git diff --git a/apps/tosthreads/apps/TestCollection/TestCollectionC.nc b/apps/tosthreads/apps/TestCollection/TestCollectionC.nc index e401fc05..e49640ba 100644 --- a/apps/tosthreads/apps/TestCollection/TestCollectionC.nc +++ b/apps/tosthreads/apps/TestCollection/TestCollectionC.nc @@ -73,7 +73,10 @@ implementation { call RootControl.setRoot(); for (;;) { if (call BlockingReceive.receive(&recvbuf, 0) == SUCCESS) { - call SerialBlockingSend.send(AM_BROADCAST_ADDR, &recvbuf, sizeof(local)); + oscilloscope_t *recv_o = (oscilloscope_t *) call BlockingReceive.getPayload(&recvbuf, sizeof(oscilloscope_t)); + oscilloscope_t *send_o = (oscilloscope_t *) call SerialBlockingSend.getPayload(&sendbuf, sizeof(oscilloscope_t)); + memcpy(send_o, recv_o, sizeof(oscilloscope_t)); + call SerialBlockingSend.send(AM_BROADCAST_ADDR, &sendbuf, sizeof(oscilloscope_t)); report_received(); } } @@ -82,14 +85,13 @@ implementation { for (;;) { if (reading == NREADINGS) { - oscilloscope_t *o = o; - o = (oscilloscope_t *)call BlockingSend.getPayload(&sendbuf, sizeof(oscilloscope_t)); + oscilloscope_t *o = (oscilloscope_t *) call BlockingSend.getPayload(&sendbuf, sizeof(oscilloscope_t)); if (o == NULL) { fatal_problem(); return; } - memcpy(o, &local, sizeof(local)); - if (call BlockingSend.send(&sendbuf, sizeof(local)) == SUCCESS) { + memcpy(o, &local, sizeof(oscilloscope_t)); + if (call BlockingSend.send(&sendbuf, sizeof(oscilloscope_t)) == SUCCESS) { report_sent(); } else { report_problem();