]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Update to TestCollection apps for tosthreads to send correct payload for displaying...
authorklueska <klueska>
Wed, 18 Jun 2008 14:48:56 +0000 (14:48 +0000)
committerklueska <klueska>
Wed, 18 Jun 2008 14:48:56 +0000 (14:48 +0000)
apps/tosthreads/apps/TestBasicsbSensors/Makefile
apps/tosthreads/apps/TestCollection/TestCollectionC.nc
apps/tosthreads/capps/TestCollection/TestCollection.c

index 7580f0d4dcf4572bc12a92e0d81c4d293e1cdae9..eca2a88d88c7c2a4d21a16d5513b35fd7ce4dc13 100644 (file)
@@ -2,4 +2,12 @@ COMPONENT=TestBasicsbSensorsAppC
 CFLAGS += -I$(TOSDIR)/sensorboards/basicsb
 CFLAGS += -I$(TOSDIR)/lib/tosthreads/sensorboards/basicsb
 
-include $(MAKERULES)
+ifneq ($(filter mica2 micaz clean,$(MAKECMDGOALS)),)
+  include $(MAKERULES)
+else
+%:
+       @echo "    Sorry, this application is only written to work with mica based motes and the basicsb sensorboards.."
+threads:
+       @:
+endif
+
index e401fc0537d78c10426b9a84c54cae21db16ee01..e49640ba994a4c4acc64070cb96bce5bfebcbc13 100644 (file)
@@ -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();
index f0b417fbf97b92fc6ee344a3aeab823bb8396fc4..75da72871f886ef6b17fb27fc3fc351e041b1276 100644 (file)
@@ -64,7 +64,10 @@ void tosthread_main(void* arg) {
     collectionSetRoot();
     for (;;) {
       if ( collectionReceive(&recvbuf, 0, AM_OSCILLOSCOPE) == SUCCESS) {
-        amSerialSend(AM_BROADCAST_ADDR, &recvbuf, sizeof(local), AM_OSCILLOSCOPE);
+        oscilloscope_t *recv_o = (oscilloscope_t *) collectionGetPayload(&recvbuf, sizeof(oscilloscope_t));
+        oscilloscope_t *send_o = (oscilloscope_t *) serialGetPayload(&sendbuf, sizeof(oscilloscope_t));
+        memcpy(send_o, recv_o, sizeof(oscilloscope_t));
+        amSerialSend(AM_BROADCAST_ADDR, &sendbuf, sizeof(local), AM_OSCILLOSCOPE);
         report_received();
       }
     }