[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/2-member-send Leader.ma, NONE, 1.1 Member.ma, NONE, 1.1 MemberSend.ma, NONE, 1.1 README, NONE, 1.1

Chien-Liang Fok chien-liang at users.sourceforge.net
Wed May 24 19:37:59 PDT 2006


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

Added Files:
	Leader.ma Member.ma MemberSend.ma README 
Log Message:
Added group communication agents.

--- NEW FILE: Leader.ma ---
		pushc 4			// store the group member information on the heap
		setvar 0		// heap[0] = number of members (4)		
		pushloc 2 1
		pushloc 3 1
		pushloc 4 1		
		pushloc 5 1
		setvar 1
		setvar 2
		setvar 3
		setvar 4
		
		pusht value
		pushn mbm
		pushc 2			// template = <"mbm", value>
		pushc RXN_GROUP_SEND
		regrxn			// register a reaction for member broadcast messages
		wait

// The group send reaction
// Assumes heap[0] = number of agents and heap[1...n] are the agent's addresses
RXN_GROUP_SEND	remove
		pop
		pop
		esetvar 19
		pushc 0
RGS_LOOP	inc
		copy
		getvar 0
		cgt			// check whether the counter is > number of members
		rjumpc DONE
		copy
		getvars			// get the neighbor's address
		egetvar 19		
		swap
		pushn lbm
		swap
		pushc 2
		swap			// tuple = <"lbm", 31>
		rout
		pushc RGS_LOOP
		jumps			// go back to STG_LOOP		
DONE		pop			// pop the counter
		endrxn			// end the reaction
		
		

--- NEW FILE: Member.ma ---
		pusht value
		pushn lbm
		pushc 2
		pushc RXN_FIRED
		regrxn			// register reaction for leader broadcast message
		wait

RXN_FIRED	remove			// remove the tuple
		pop			// pop field count
		pop			// pop "lbm"
		putled
		endrxn
--- NEW FILE: MemberSend.ma ---
		pusht value
		pushn lbm
		pushc 2
		pushc RXN_FIRED
		regrxn			// register reaction for leader broadcast message

// send a member broadcast message every second
LOOP		pushc 31
		pushn mbm
		pushc 2
		pushloc 1 1
		rout			// insert tuple <"mbm", 31> on leader's mote
		pushc 8
		sleep
		rjump LOOP		

RXN_FIRED	remove			// remove the tuple
		pop			// pop field count
		pop			// pop "lbm"
		putled
		endrxn
--- NEW FILE: README ---
AGENT GROUP COMMUNICATION
-------------------------------------------------------------------------------
The group is hard coded within the leader to be at locations (1,1), (2,1), (3,1) and (4,1). 
The leader has a reaction sensitive to member broadcast messages.  When this reaction fires,
the leader sends the value stored within the message to each member.

The members react to the group broadcast message, extract the value and display it on the LEDs.

The MemberSend periodically sends the leader a member broadcast message that triggers the 
sending of the group message.

The leader must be at (1,1).
Members must be at (1,1), (2,1), (3,1) and (4,1).
One of the members must be MemberSend.ma.

MESSAGE FORMATS
-------------------------------------------------------------------------------
Member Broadcast Message:
 
 <"mbm", value>
 
 This message is sent from the member to the leader for broadcasting to the 
 group.

Leader Broadcast Message:
  <"lbm", value>
 
  This message is sent from the group leader to each member in the group.
  


More information about the Tinyos-contrib-commits mailing list