[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/chat Leader.ma, 1.3, 1.4 Member.ma, 1.4, 1.5

Chien-Liang Fok chien-liang at users.sourceforge.net
Wed Oct 18 07:34:24 PDT 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/chat
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22310

Modified Files:
	Leader.ma Member.ma 
Log Message:


Index: Leader.ma
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/chat/Leader.ma,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Leader.ma	20 Sep 2006 11:19:24 -0000	1.3
--- Leader.ma	18 Oct 2006 14:34:22 -0000	1.4
***************
*** 18,24 ****
  // register a reaction sensitive to join messages
  		pusht location
  		pushn jng
! 		pushc 2
! 		pushc RXN_GROUP_JOIN
  		regrxn
  	
--- 18,25 ----
  // register a reaction sensitive to join messages
  		pusht location
+ 		pusht agentid
  		pushn jng
! 		pushc 3
! 		pushcl RXN_GROUP_JOIN
  		regrxn
  	
***************
*** 26,33 ****
  		pusht string
  		pusht string
  		pushn mbm
! 		pushc 3			// template = <"mbm", string, string>
  		pushc RXN_GROUP_SEND
  		regrxn			// register a reaction for member broadcast messages
  WAIT		wait
  
--- 27,43 ----
  		pusht string
  		pusht string
+ 		pusht agentid
  		pushn mbm
! 		pushc 4			// template = <"mbm", agentID, string, string>
  		pushc RXN_GROUP_SEND
  		regrxn			// register a reaction for member broadcast messages
+ 		
+ // register a reaction sensitive to member update messages
+ 		pusht location
+ 		pusht agentid
+ 		pushn upd
+ 		pushc 3
+ 		pushcl RXN_UPDATE_LOC
+ 		regrxn
  WAIT		wait
  
***************
*** 37,40 ****
--- 47,51 ----
  		pop
  		pop
+ 		esetvar	17		// heap[17] = member agentID
  		esetvar 19		// heap[19] = name
  		esetvar 18		// heap[18] = message
***************
*** 43,61 ****
  		pushc 0
  RGS_LOOP	inc
! 		copy
! 		getvar 0
  		cgt			// check whether the counter is > number of members
! 		pushc DONE
  		jumpc
  		copy
  		getvars			// get the neighbor's address
  		egetvar 18				
  		swap
! 		egetvar 19
  		swap
  		pushn lbm
  		swap
! 		pushc 3
! 		swap			// tuple = <"lbm", name, message>
  		rout
  		pushc RGS_LOOP
--- 54,76 ----
  		pushc 0
  RGS_LOOP	inc
! 		copy			// Stack:  cntr, cntr
! 		getvar 0		// Stack:  # of members, cntr, cntr
  		cgt			// check whether the counter is > number of members
! 		pushcl DONE
  		jumpc
  		copy
+ 		pushc 2
+ 		mul
  		getvars			// get the neighbor's address
  		egetvar 18				
  		swap
! 		egetvar 19		// member's name
! 		swap
! 		egetvar 17		// member's agent ID	
  		swap
  		pushn lbm
  		swap
! 		pushc 4
! 		swap			// tuple = <"lbm", member ID, name, message>
  		rout
  		pushc RGS_LOOP
***************
*** 75,81 ****
  		copy
  		setvar 0		// heap[0]++
! 		setvars			// save the location of the member on the heap
  		pushc 28
! 		putled			// toggle yellow
  		endrxn
! 		
\ No newline at end of file
--- 90,112 ----
  		copy
  		setvar 0		// heap[0]++
! 		pushc 2
! 		mul
! 		dec
! 		setvars			// heap[index*2-1] = agent id
! 		getvar 0
! 		pushc 2
! 		mul
! 		setvars			// heap[index*2] = location
  		pushc 28
! 		putled			// toggle yellow when member joins group
  		endrxn
! 		
! RXN_UPDATE_LOC  remove
! 		pushc 25
! 		putled			// toggle red LED when member moves
! 		pop			// pop number of fields
! 		pop			// pop the string "upd"
! 		findMatch		// find the index of the agent id on the heap
! 		inc			// the location is in the next index position
! 		setvars			// save the new location
! 		endrxn
\ No newline at end of file

Index: Member.ma
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/chat/Member.ma,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Member.ma	27 Sep 2006 03:42:40 -0000	1.4
--- Member.ma	18 Oct 2006 14:34:22 -0000	1.5
***************
*** 1,11 ****
! // set the leader location to be (1,1)
! 		pushloc 1 1
! 		setvar 0	// heap[0] = leader location
  		
  // register with the leader
  		loc
  		pushn jng
! 		pushc 2
! 		getvar 0
  		rout
  
--- 1,45 ----
! // get use rname from cmd line
! // store user name in heap[0]
! //		pushn fei
! //		setvar 0
! 
! // Send a string to the base station to create GUI
! // 'msc', agentID, screen name
! 		getvar	0
! 		aid
! 		pushn	msc
! 		pushc	3
! 		pushloc	force_uart_x force_uart_y
! 		rout
! 
! pushc 8
! sleep
! 
! // discover the leader location
! 		loc
! 		pushn abc	// group name = "abc"
! 		pushn req
! 		pushc 3
! 		pushloc uart_x uart_y
! 		rout		// send request message: <"req", "abc", loc>
! 
! 		pushc 8		// sleep for 1 second to allow BS to generate reponse
! 		sleep
! 		
! 		pusht location
! 		pushn grl
! 		pushc 2		
! 
! 		in 		// wait for response
! 		pop
! 		pop
! 		setvar 1	// heap[1] = leader location
  		
  // register with the leader
  		loc
+ 		aid
  		pushn jng
! 		pushc 3
! 		getvar 1
  		rout
  
***************
*** 13,30 ****
  		pusht string
  		pusht string
  		pushn lbm
! 		pushc 3
! 		pushc RXN_FIRED
  		regrxn
  
  // register reaction for messages to send		
  		pusht string
! 		pusht string
  		pushn snd
  		pushc 3
! 		pushc SND_MSG
  		regrxn
  WAIT		wait
! 
  RXN_FIRED	remove			// remove the tuple
  		pushloc force_uart_x force_uart_y
--- 47,74 ----
  		pusht string
  		pusht string
+ 		aid
  		pushn lbm
! 		pushc 4
! 		pushcl RXN_FIRED
  		regrxn
  
  // register reaction for messages to send		
  		pusht string
! 		getvar 0		// name of agent
! 		aid
  		pushn snd
+ 		pushc 4
+ 		pushcl SND_MSG
+ 		regrxn
+ 		
+ // register reaction to move to a different node
+ 		pusht location
+ 		aid
+ 		pushn abc
  		pushc 3
! 		pushcl MOVE
  		regrxn
  WAIT		wait
! 		
  RXN_FIRED	remove			// remove the tuple
  		pushloc force_uart_x force_uart_y
***************
*** 36,45 ****
  		pop
  		pushn mbm
! 		pushc 3			// <"mbm", String:name, String:msg>
! 		getvar 0
  		rout			// send to leader	
  		pushc 26
! 		putled
! 		clear
! 		pushc WAIT
  		endrxn
--- 80,117 ----
  		pop
  		pushn mbm
! 		pushc 4			// <"mbm", AgentID, String:name, String:msg>
! 		getvar 1
  		rout			// send to leader	
  		pushc 26
! 		putled			// toggle green when message is sent to leader
  		endrxn
+ 
+ MOVE		pushc 28	
+ 		putled
+ 		remove			// remove the tuple
+ 		pop			// pop off number of fields
+ 		pop			// pop off "mov"
+ 		pop			// pop off agent id
+ 		
+ 		aid
+ 		pushn msc
+ 		pushc 2
+ 		pushloc	force_uart_x force_uart_y
+ 		rout			// tell current base station to kill GUI
+ 		
+ 		pushloc 2 1			// copy destination location
+ 		aid
+ 		pushn upd
+ 		pushc 3			// tuple: <"upd", AgentID, new location>
+ 		getvar 1
+ 		rout			// send update location message to leader
+ 		
+ 		smove			// strong move to destination
+ 		
+ 		getvar	0
+ 		aid
+ 		pushn	msc
+ 		pushc	3
+ 		pushloc	force_uart_x force_uart_y
+ 		rout			// send message to base station to create GUI
+ 		endrxn
\ No newline at end of file



More information about the Tinyos-contrib-commits mailing list