[Tinyos-2-commits] CVS: tinyos-2.x/apps/tosthreads/capps/TestCollection MultihopOscilloscope.h, 1.2, 1.3 TestCollection.c, 1.5, 1.6

Chieh-Jan Mike Liang liang_mike at users.sourceforge.net
Thu Aug 21 19:38:35 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/apps/tosthreads/capps/TestCollection
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26250/apps/tosthreads/capps/TestCollection

Modified Files:
	MultihopOscilloscope.h TestCollection.c 
Log Message:
Allows a cthreads application to set the collection ID for a client ID


Index: MultihopOscilloscope.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tosthreads/capps/TestCollection/MultihopOscilloscope.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MultihopOscilloscope.h	21 Aug 2008 04:22:07 -0000	1.2
--- MultihopOscilloscope.h	22 Aug 2008 02:38:33 -0000	1.3
***************
*** 25,29 ****
    /* Default sampling period. */
    DEFAULT_INTERVAL = 1024,
!   AM_OSCILLOSCOPE = NEW_COLLECTION_ID(),
  };
  
--- 25,29 ----
    /* Default sampling period. */
    DEFAULT_INTERVAL = 1024,
!   AM_OSCILLOSCOPE = NEW_COLLECTION_CLIENT_ID(),
  };
  

Index: TestCollection.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tosthreads/capps/TestCollection/TestCollection.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TestCollection.c	12 Jul 2008 14:11:21 -0000	1.5
--- TestCollection.c	22 Aug 2008 02:38:33 -0000	1.6
***************
*** 42,45 ****
--- 42,47 ----
  #include "MultihopOscilloscope.h"
  
+ #define MY_COLLECTION_ID 0x02
+ 
  void fatal_problem();
  void report_problem();
***************
*** 59,68 ****
    while ( amRadioStart() != SUCCESS );
    while ( collectionRoutingStart() != SUCCESS );
!  
    if (local.id % 500 == 0) {
!     while ( amSerialStart() != SUCCESS);
      collectionSetRoot();
      for (;;) {
!       if ( collectionReceive(&recvbuf, 0, AM_OSCILLOSCOPE) == SUCCESS) {
          oscilloscope_t *recv_o = (oscilloscope_t *) collectionGetPayload(&recvbuf, sizeof(oscilloscope_t));
          oscilloscope_t *send_o = (oscilloscope_t *) serialGetPayload(&sendbuf, sizeof(oscilloscope_t));
--- 61,72 ----
    while ( amRadioStart() != SUCCESS );
    while ( collectionRoutingStart() != SUCCESS );
!   
!   collectionSetCollectionId(AM_OSCILLOSCOPE, MY_COLLECTION_ID);
!   
    if (local.id % 500 == 0) {
!     while ( amSerialStart() != SUCCESS );
      collectionSetRoot();
      for (;;) {
!       if (collectionReceive(&recvbuf, 0, MY_COLLECTION_ID) == SUCCESS) {
          oscilloscope_t *recv_o = (oscilloscope_t *) collectionGetPayload(&recvbuf, sizeof(oscilloscope_t));
          oscilloscope_t *send_o = (oscilloscope_t *) serialGetPayload(&sendbuf, sizeof(oscilloscope_t));
***************
*** 74,78 ****
    } else {
      uint16_t var;
!       
      for (;;) {
        if (reading == NREADINGS) {
--- 78,82 ----
    } else {
      uint16_t var;
! 
      for (;;) {
        if (reading == NREADINGS) {
***************
*** 92,100 ****
          reading = 0;
        }
!           
        if (sinesensor_read(&var) == SUCCESS) {
          local.readings[reading++] = var;
        }
!         
        tosthread_sleep(local.interval);
      }
--- 96,104 ----
          reading = 0;
        }
!         
        if (sinesensor_read(&var) == SUCCESS) {
          local.readings[reading++] = var;
        }
!       
        tosthread_sleep(local.interval);
      }



More information about the Tinyos-2-commits mailing list