[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/tosthreads/lib/net CCollectionId.nc, NONE, 1.1 CCollectionP.nc, 1.3, 1.4 tosthread_collection.h, 1.3, 1.4

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/tos/lib/tosthreads/lib/net
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26250/tos/lib/tosthreads/lib/net

Modified Files:
	CCollectionP.nc tosthread_collection.h 
Added Files:
	CCollectionId.nc 
Log Message:
Allows a cthreads application to set the collection ID for a client ID


--- NEW FILE: CCollectionId.nc ---
/*
 * Copyright (c) 2008 Johns Hopkins University.
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written
 * agreement is hereby granted, provided that the above copyright
 * notice, the (updated) modification history and the author appear in
 * all copies of this source code.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
 * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
*/

/*
 * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
 */

interface CCollectionId {
  command collection_id_t fetch(uint8_t clientid);
  command error_t set(uint8_t clientid, collection_id_t collectionid);
}

Index: CCollectionP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tosthreads/lib/net/CCollectionP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CCollectionP.nc	24 Jul 2008 23:52:23 -0000	1.3
--- CCollectionP.nc	22 Aug 2008 02:38:33 -0000	1.4
***************
*** 32,35 ****
--- 32,36 ----
  /**
   * @author Kevin Klues <klueska at cs.stanford.edu>
+  * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
   */
  
***************
*** 39,46 ****
      interface BlockingReceive[collection_id_t id];
      interface BlockingReceive as BlockingSnoop[collection_id_t id];
!     interface BlockingSend[am_id_t id];
      interface Packet;
      interface CollectionPacket;
      interface RootControl;
    }
    provides {
--- 40,48 ----
      interface BlockingReceive[collection_id_t id];
      interface BlockingReceive as BlockingSnoop[collection_id_t id];
!     interface BlockingSend[uint8_t id];
      interface Packet;
      interface CollectionPacket;
      interface RootControl;
+     interface CCollectionId;
    }
    provides {
***************
*** 50,54 ****
  implementation {
    command collection_id_t CollectionId.fetch[uint8_t id]() {
!     return id;
    }
    
--- 52,60 ----
  implementation {
    command collection_id_t CollectionId.fetch[uint8_t id]() {
!     return call CCollectionId.fetch(id);
!   }
! 
!   error_t collectionSetCollectionId(uint8_t clientid, collection_id_t collectionid) @C() @spontaneous() {
!     return call CCollectionId.set(clientid, collectionid);
    }
    
***************
*** 66,70 ****
      return call BlockingSnoop.receive[id](m, timeout);
    }
!   error_t collectionSend(message_t* msg, uint8_t len, collection_id_t id) @C() @spontaneous() {
      return call BlockingSend.send[id](msg, len);
    }
--- 72,76 ----
      return call BlockingSnoop.receive[id](m, timeout);
    }
!   error_t collectionSend(message_t* msg, uint8_t len, uint8_t id) @C() @spontaneous() {
      return call BlockingSend.send[id](msg, len);
    }

Index: tosthread_collection.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tosthreads/lib/net/tosthread_collection.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tosthread_collection.h	21 Aug 2008 04:23:00 -0000	1.3
--- tosthread_collection.h	22 Aug 2008 02:38:33 -0000	1.4
***************
*** 32,35 ****
--- 32,36 ----
  /**
   * @author Kevin Klues <klueska at cs.stanford.edu>
+  * @author Chieh-Jan Mike Liang <cliang4 at cs.jhu.edu>
   */
   
***************
*** 42,45 ****
--- 43,48 ----
  extern error_t collectionRoutingStop();
  
+ extern error_t collectionSetCollectionId(uint8_t clientid, collection_id_t collectionid);
+ 
  extern error_t collectionReceive(message_t* m, uint32_t timeout, collection_id_t id);
  extern error_t collectionSnoop(message_t* m, uint32_t timeout, collection_id_t id);



More information about the Tinyos-2-commits mailing list