[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components/LocationReporter LocationReporterC.nc, 1.4, 1.5 LocationReporterM.nc, 1.7, 1.8

borndigerati borndigerati at users.sourceforge.net
Thu Apr 6 18:14:56 PDT 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/LocationReporter
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5750/components/LocationReporter

Modified Files:
	LocationReporterC.nc LocationReporterM.nc 
Log Message:


Index: LocationReporterC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/LocationReporter/LocationReporterC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** LocationReporterC.nc	5 Apr 2006 18:04:38 -0000	1.4
--- LocationReporterC.nc	7 Apr 2006 01:14:52 -0000	1.5
***************
*** 58,65 ****
    components LocationMgrC, SimpleTime, AgentMgrC /*, LocationSenderM*/;
    #if ENABLE_CLUSTERING
!   components NeighborListM;
!   components ClusterheadDirectoryM;
    #endif
  
    StdControl = LocationReporterM;
    StdControl = MessageBufferM;
--- 58,65 ----
    components LocationMgrC, SimpleTime, AgentMgrC /*, LocationSenderM*/;
    #if ENABLE_CLUSTERING
!   components NeighborListM, ClusterheadDirectoryM, AgentSenderC;
    #endif
  
+ 
    StdControl = LocationReporterM;
    StdControl = MessageBufferM;
***************
*** 78,84 ****
--- 78,87 ----
    LocationReporterM.SendLocation -> NIC.SendMsg[AM_AGILLALOCMSG];
    LocationReporterM.ReceiveLocation -> NIC.ReceiveMsg[AM_AGILLALOCMSG];
+ 
    #if ENABLE_CLUSTERING
    LocationReporterM.ClusteringI -> NeighborListM;
    LocationReporterM.CHDir -> ClusterheadDirectoryM;
+   LocationReporterM.AgentSenderI -> AgentSenderC;
    #endif
+ 
  }

Index: LocationReporterM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/LocationReporter/LocationReporterM.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** LocationReporterM.nc	5 Apr 2006 18:04:38 -0000	1.7
--- LocationReporterM.nc	7 Apr 2006 01:14:52 -0000	1.8
***************
*** 61,71 ****
--- 61,74 ----
       interface MessageBufferI;
       interface AgentReceiverI;
+ 
       #if ENABLE_CLUSTERING
       interface ClusteringI;
       interface ClusterheadDirectoryI as CHDir;
+      interface AgentSenderI;
       #endif
       //interface LocationSenderI as SendLocation;
       interface SendMsg as SendLocation;
       interface ReceiveMsg as ReceiveLocation;
+ 
     }
  }
***************
*** 136,139 ****
--- 139,143 ----
      {
        uint16_t onehop_dest;
+ 
  
        #if ENABLE_CLUSTERING
***************
*** 143,146 ****
--- 147,151 ----
          if(call ClusteringI.isClusterHead() || bounce){
              // send msg to GW
+             sMsg->dest = TOS_UART_ADDR;
              if (call NeighborListI.getGW(&onehop_dest) == NO_GW)
              {
***************
*** 175,178 ****
--- 180,184 ----
        #endif
  
+ 
        return call SendLocation.send(onehop_dest, sizeof(AgillaLocMsg), msg);
      }
***************
*** 308,312 ****
--- 314,353 ----
      return SUCCESS;
    }
+ 
  
+ #if ENABLE_CLUSTERING
+   /*
+    * Notification that an agent has moved. If this node is a clusterhead, check if the agent moves
+    * to another cluster. If yes, delete agent. In this node is not a clusterhead check if the agent
+    * moves to a detination that this node does not know about or if it moves to a node that this node
+    * knows to be in a different cluster. If this is true, then send a delete msg to the clusterhead.
+    */
+   event void AgentSenderI.sendDone(AgillaAgentContext* context, uint8_t op, result_t success, uint16_t dest){
+       if((op == IOPsmove || op == IOPwmove) && success == SUCCESS){
+           #if DEBUG_CLUSTERING
+              dbg(DBG_USR1, "LocationReporterM: agent %i moved to %i\n", context->id, dest);
+           #endif
+ 
+           if(call ClusteringI.isClusterHead()){
+               #if DEBUG_CLUSTERING
+                   dbg(DBG_USR1, "LocationReporterM: Node Is CH; Removing agent from local directory\n");
+               #endif
+               // check if agent has moved to another cluster
+               // if it has, then remove the agent
+               if(!call CHDir.isClusterMember(dest))
+               {
+                   if(!call AddressMgrI.isGW()) call CHDir.removeAgent(&(context->id));
+               } else {
+                   return;
+               }
+           } else {
+               if(call ClusteringI.isClusterMember(dest)) return;
+           }
+           doSend(&(context->id), TRUE);
+       }
+   }
+   #endif
+ 
+ 
    /**
     * Bounces a message off this mote if clustering is not used.



More information about the Tinyos-contrib-commits mailing list