[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/mobile-chat Proxy-First-Test.ma, 1.2, 1.3 Proxy.ma, 1.2, 1.3

Chien-Liang Fok chien-liang at users.sourceforge.net
Wed Nov 15 01:40:50 PST 2006


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

Modified Files:
	Proxy-First-Test.ma Proxy.ma 
Log Message:
Debugged, got basic test to work.

Index: Proxy-First-Test.ma
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/mobile-chat/Proxy-First-Test.ma,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Proxy-First-Test.ma	15 Nov 2006 05:19:58 -0000	1.2
--- Proxy-First-Test.ma	15 Nov 2006 09:40:47 -0000	1.3
***************
*** 1,79 ****
  //heap[0] = reserved location
  
  
! BEGIN	pusht string
! 	pusht string
! 	pushn ocm		// react to PDA+Proxy msg
! 	pushc 3
! 	pushcl	PDA_MSG
! 	regrxn
! 	
! 	pusht string
! 	pusht string
! 	pushn lbm		// react to leader broadcast msg
! 	pushc 3
! 	pushcl	LEADER_MSG
! 	regrxn
! 
! 
! LOOP	pushn 	abc
! 	pushn 	sun
! 	pushn	icm
! 	pushc 	3
! 	out
! 	pushc 16
! 	sleep
! 	rjump LOOP
  
  
! PDA_MSG	remove
! 	pop
! 	pop
! 	pushn lbm	// translate into leader broadcast message
! 	pushc 3
! 	out
! 	endrxn
! 	
! LEADER_MSG	remove
! 		pop
! 		pop
! 		pushn icm	// translate into in chat message
! 		pushc 3
! 		pushc GET_PROXY
! 		pushc LM_RETURN
! 		jumps
! LM_RETURN	rjumpc LM_SUCC
! 		pushc 8
! 		putled
! 		pushc 31
! 		putled
! 		endrxn
! LM_SUCC		rout
! 		endrxn
  
! 	
! GET_PROXY	numnbrs
! GET_PROXY_LOOP	copy		//   Stack:  (# neighbor, # neighbor)
! 		pushc 0		
! 		ceq		//   Stack:  (# neighbor)
! 		rjumpc GET_PROXY_FAIL		// no more neighbor, fail
! 		dec
! 		copy		//   Stack:  (# neighbor -1, # neighbor -1)
! 		getnbr		
! 		copy		//   Stack:  (neighbor addr, neighbor addr, # neighbor -1)
! 		pushcl 65530
! 		cgte		//   Stack:  (neighbor addr, # neighbor -1)
! 		rjumpc GET_PROXY_DONE		// find proxy addr, done
! 		pop		//   Stack:  (# neighbor -1)
! 		pushcl GET_PROXY_LOOP
! 		jumps
! GET_PROXY_FAIL	pop				// no more neighbor, fail, condition=0, finish
! 		pushc 0
! 		cpull
! 		rjump GET_PROXY_FIN
! GET_PROXY_DONE	swap				
! 		pop		//   Stack:  (neighbor addr)
! 		swap		// put the return addr on top of stack
! 		pushc 1
! 		cpull
! GET_PROXY_FIN	jumps
\ No newline at end of file
--- 1,80 ----
  //heap[0] = reserved location
  
+ pushc 26
+ putled
+ pushc 8
+ sleep
+ pushc 26
+ putled			// toggle the green LED
  
! BEGIN pusht string
!   pusht string
!   pushn ocm   // react to PDA+Proxy msg
!   pushc 3
!   pushcl  PDA_MSG
!   regrxn
!   
!   pusht string
!   pusht string
!   pushn lbm   // react to leader broadcast msg
!   pushc 3
!   pushcl  LEADER_MSG
!   regrxn
  
+ WAIT wait
  
! PDA_MSG remove       
!   pop
!   pop
!   pushn lbm // translate into leader broadcast message
!   pushc 3
!   out		// for now just translate message into a leader broadcast message and send it
!   endrxn
!   
! LEADER_MSG  remove
!     pushc 26
!     putled			// toggle green
!     pop
!     pop
!     pushn icm // translate into in chat message
!     pushc 3
!     pushcl LM_RETURN
!     pushcl GET_PROXY
!     jumps
! LM_RETURN rjumpc LM_SUCC
!     pushc 25
! 	putled
! 	clear
! 	pushc WAIT
!     endrxn
! LM_SUCC   pushc 28		
!           putled		// toggle blue led when proxy found
!           rout
!           endrxn
  
!   
! GET_PROXY numnbrs
! GET_PROXY_LOOP  copy    //   Stack:  (# neighbor, # neighbor)
!     pushc 0   
!     ceq   //   Stack:  (# neighbor)
!     rjumpc GET_PROXY_FAIL   // no more neighbor, fail
!     dec
!     copy    //   Stack:  (# neighbor -1, # neighbor -1)
!     getnbr    
!     copy    //   Stack:  (neighbor addr, neighbor addr, # neighbor -1)
!     pushcl 65530
!     clte    //   Stack:  (neighbor addr, # neighbor -1)
!     rjumpc GET_PROXY_DONE   // find proxy addr, done
!     pop   //   Stack:  (# neighbor -1)
!     pushcl GET_PROXY_LOOP
!     jumps
! GET_PROXY_FAIL  pop       // no more neighbor, fail, condition=0, finish
!     pushc 0
!     cpull
!     jumps
! GET_PROXY_DONE  swap        
!     pop   //   Stack:  (neighbor addr)
!     swap    // put the return addr on top of stack
!     pushc 1
!     cpull
!     jumps

Index: Proxy.ma
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/mobile-chat/Proxy.ma,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Proxy.ma	15 Nov 2006 02:10:55 -0000	1.2
--- Proxy.ma	15 Nov 2006 09:40:47 -0000	1.3
***************
*** 2,44 ****
  // heap[1] = previous member agent location
  
  pushc 8
  sleep
  
  // register reaction:  Receive message from PDA, send message to member agent
! // <'ocm', chat msg> (ocm - out chat msg)
! 		pusht string
! 		pushn ocm
! 		pushc 2
! 		pushcl SND_MSG
! 		regrxn
  
  // register reaction:  Receive message from member agent, send message to PDA
! // <"icm", chat msg> (icm - in chat msg)
! 		pusht	string
! 		pushn	icm
! 		pushc	2
! 		pushcl	RCV_MSG
! 		regrxn
! 		
! // register reaction:  Receive MOVE message from PDA, tell member agent to follow
! // <"pmv", new location> (pmv - PDA move)
! 		pusht location
! 		pushn pmv
! 		pushc 2
! 		pushcl MOVE
! 		regrxn
! 
! 
! WAIT		wait
  
- 		
- // reaction fired:  Receive message from member agent, send message to PDA
- // From Member:  <"icm", chat msg> (icm - in chat msg)
- RCV_MSG		remove			
- 		pushloc force_uart_x force_uart_y
- 		rout			// send tuple to base station		
- 		pushc 25		
- 		putled			// toggle red LED
- 		endrxn
  
  // reaction fired:  Receive message from PDA, send message to member agent
--- 2,32 ----
  // heap[1] = previous member agent location
  
+ pushc 25
+ putled
  pushc 8
  sleep
+ pushc 25
+ putled    //blink red LED for 1s
  
  // register reaction:  Receive message from PDA, send message to member agent
! // <'ocm', screen name, chat msg> (ocm - out chat msg)
!     pusht string
!     pusht string
!     pushn ocm
!     pushc 3
!     pushcl SND_MSG
!     regrxn
  
  // register reaction:  Receive message from member agent, send message to PDA
! // <"icm", screen name, chat msg> (icm - in chat msg)
!     pusht string
!     pusht string
!     pushn icm
!     pushc 3
!     pushcl  RCV_MSG
!     regrxn
!    
! WAIT          wait
  
  
  // reaction fired:  Receive message from PDA, send message to member agent
***************
*** 46,109 ****
  // To Member:  <"ocm", chat msg> (ocm - out chat msg)
  // # Future Optimization:  <'ocm', member agentID, chat msg> for multiple member agents on the same node
! SND_MSG		remove		
! 		randnbr		// find the neighor node
! 		pushcl FND_MEM
! 		jumpc		// if success, forward msg to member agent	
! 		pop
! 		pop
! 		pop
! 		pushn ncn	// if fail, send error message to PDA (ncn - no connection)
! 		pushc 1
! 		pushloc force_uart_x force_uart_y
! 		rout
! 		pushc 8		// blink 3 LED's twice
! 		putled
! 		pushc 31
! 		putled
! 		pushc 31
! 		putled
! 		pushc 31
! 		putled
! 		endrxn
! 	FND_MEM	getvar 0	//   Stack:  (rnd neighbor loc, current member loc)
! 		ceq		// compare random neighbor location with the stored member location
! 		pushcl SAME_MEM_LOC
! 		jumpc 		// if the neighbor loc is same as stored, proceed
! 		getvar 0	// if fails, save locations and blink 3 LED's twice
! 		setvar 1		// heap[1] = previous member agent location
! 		randnbr			
! 		pushc 0
! 		setvars			// heap[0] = current member agent location
! 		// tell member agent to follow
! 		pushc 8			// Blink 3 LED's twice
! 		putled
! 		pushc 31
! 		putled
! 		pushc 31
! 		putled
! 		pushc 31
! 		putled
! 		endrxn						
! 		SAME_MEM_LOC	getvar 0		// heap[0] = curr member 
! 				rout			// send to current member	
! 				pushc 26
! 				putled			// toggle green LED when message sent to member
! 				endrxn
  
- // reaction fired:  Receive MOVE message from PDA, tell member agent to follow
- // From PDA:  <"pmv", new location> (pmv - PDA move)
- // To Member:  <"pmv", new location>
- MOVE		remove			// remove the tuple
- 		pop			// pop off number of fields
- 		pop			// pop off "pmv", 
- 					//   Stack:  (new location)  
- 		getvar 0
- 		setvar 1		// heap[1] = previous member agent location
- 		pushc 0
- 		setvars			// heap[0] = current member agent location
- 		
- 		// tell member agent at the old location
  
! 		pushc 28
! 		putled			// toggle yellow LED
! 		endrxn
\ No newline at end of file
--- 34,57 ----
  // To Member:  <"ocm", chat msg> (ocm - out chat msg)
  // # Future Optimization:  <'ocm', member agentID, chat msg> for multiple member agents on the same node
! SND_MSG       remove                 
!               randnbr
!               rjumpc GOT_MEM
!               pushc 25
!               putled    // toggle red LED if no neighbor found
!              clear
! 	pushc WAIT
!               endrxn
! GOT_MEM       rout      // send tuple to the neighbor
!               pushc 26    // toggle green
!               putled              
!               endrxn
  
  
! // reaction fired:  Receive message from member agent, send message to PDA
! // From Member:  <"icm", chat msg> (icm - in chat msg)
! RCV_MSG   remove      
!     pushloc force_uart_x force_uart_y
!     rout      // send tuple to base station   
!     pushc 25    
!     putled      // toggle red LED
!     endrxn



More information about the Tinyos-contrib-commits mailing list