[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/tosthreads/lib/net/lqi CCollectionIdP.nc, NONE, 1.1 CCollectionC.nc, 1.2, 1.3 ccollection.h, 1.1, 1.2

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

Modified Files:
	CCollectionC.nc ccollection.h 
Added Files:
	CCollectionIdP.nc 
Log Message:
Allows a cthreads application to set the collection ID for a client ID


--- NEW FILE: CCollectionIdP.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>
 */

module CCollectionIdP
{
  provides {
    interface CCollectionId;
  }
}

implementation {
  collection_id_t clientCollectionIds[uniqueCount(UQ_LQI_CLIENT)];
  
  command collection_id_t CCollectionId.fetch(uint8_t clientid)
  {
    return clientCollectionIds[clientid];
  }
  
  command error_t CCollectionId.set(uint8_t clientid, collection_id_t collectionid)
  {
    if (clientid < uniqueCount(UQ_LQI_CLIENT)) {
      clientCollectionIds[clientid] = collectionid;
      
      return SUCCESS;
    }
    
    return FAIL;
  }
}

Index: CCollectionC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tosthreads/lib/net/lqi/CCollectionC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CCollectionC.nc	21 Aug 2008 04:23:00 -0000	1.2
--- CCollectionC.nc	22 Aug 2008 02:38:33 -0000	1.3
***************
*** 45,48 ****
--- 45,49 ----
    components BlockingCollectionSenderP;
    components BlockingCollectionControlC;
+   components CCollectionIdP;
    
    CCP.BlockingReceive -> BlockingCollectionReceiverP;
***************
*** 50,53 ****
--- 51,55 ----
    CCP.BlockingSend -> BlockingCollectionSenderP;
    CCP.RoutingControl -> BlockingCollectionControlC;
+   CCP.CCollectionId -> CCollectionIdP;
    
    components CollectionC;

Index: ccollection.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tosthreads/lib/net/lqi/ccollection.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ccollection.h	21 Aug 2008 04:23:00 -0000	1.1
--- ccollection.h	22 Aug 2008 02:38:33 -0000	1.2
***************
*** 42,46 ****
  #include "MultiHopLqi.h"
  
! #define  NEW_COLLECTION_ID() ((collection_id_t)unique(UQ_LQI_CLIENT))
  
  #endif //CCOLLECTION_H
--- 42,46 ----
  #include "MultiHopLqi.h"
  
! #define  NEW_COLLECTION_CLIENT_ID() ((uint8_t)unique(UQ_LQI_CLIENT))
  
  #endif //CCOLLECTION_H



More information about the Tinyos-2-commits mailing list