[Tinyos-2-commits] CVS: tinyos-2.x/tos/system ActiveMessageAddressC.nc, 1.4, 1.5

dmm rincon at users.sourceforge.net
Wed Jun 13 13:45:31 PDT 2007


Update of /cvsroot/tinyos/tinyos-2.x/tos/system
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8406/system

Modified Files:
	ActiveMessageAddressC.nc 
Log Message:
Added the ActiveMessageAddress interface, letting components know when address and group id information changes.

Index: ActiveMessageAddressC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/ActiveMessageAddressC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ActiveMessageAddressC.nc	12 Dec 2006 18:23:47 -0000	1.4
--- ActiveMessageAddressC.nc	13 Jun 2007 20:45:29 -0000	1.5
***************
*** 33,52 ****
  
  /**
!  * Component that stores the node's active message address.
   *
   * @author Philip Levis
!  * @date June 19 2005
   */
  
  module ActiveMessageAddressC  {
!   provides async command am_addr_t amAddress();
!   provides async command void setAmAddress(am_addr_t a);
  }
  implementation {
    am_addr_t addr = TOS_AM_ADDRESS;
  
    /**
     * Get the node's default AM address.
     * @return address
     */
    async command am_addr_t amAddress() {
--- 33,96 ----
  
  /**
!  * Component that stores the node's active message address and group ID.
   *
   * @author Philip Levis
!  * @author David Moss
   */
  
  module ActiveMessageAddressC  {
!   provides {
!     interface ActiveMessageAddress;
!     async command am_addr_t amAddress();
!     async command void setAmAddress(am_addr_t a);
!   }
  }
  implementation {
+ 
+   /** Node address */
    am_addr_t addr = TOS_AM_ADDRESS;
  
+   /** Group address */
+   am_group_t group = TOS_AM_GROUP;
+  
+   
+   /***************** ActiveMessageAddress Commands ****************/
+   /**
+    * @return the active message address of this node
+    */
+   async command am_addr_t ActiveMessageAddress.amAddress() {
+     return call amAddress();
+   }
+   
+   /**
+    * Set the active message address of this node
+    * @param a The target active message address
+    */
+   async command void ActiveMessageAddress.setAmAddress(am_addr_t a) {
+     call setAmAddress(a);
+   }
+   
+     
+   /**
+    * @return the group address of this node
+    */
+   async command am_group_t ActiveMessageAddress.amGroup() {
+     return group;
+   }
+   
+   /**
+    * Set the group address of this node
+    * @param group The group address
+    */
+   async command void ActiveMessageAddress.setAmGroup(am_group_t myGroup) {
+     group = myGroup;
+     signal ActiveMessageAddress.changed();
+   }
+ 
+   /***************** Deprecated Commands ****************/
    /**
     * Get the node's default AM address.
     * @return address
+    * @deprecated Use ActiveMessageAddress.amAddress() instead
     */
    async command am_addr_t amAddress() {
***************
*** 58,64 ****
--- 102,119 ----
     *
     * @param a - the address.
+    * @deprecated Use ActiveMessageAddress.setAmAddress() instead
     */
    async command void setAmAddress(am_addr_t a) {
      addr = a;
+     signal ActiveMessageAddress.changed();
    }
+   
+   
+   /***************** Defaults ****************/
+   /**
+    * Notification that the address of this node changed.
+    */
+   default async event void ActiveMessageAddress.changed() {
+   }
+   
  }



More information about the Tinyos-2-commits mailing list