[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/mobile-chat
Member.ma, 1.2, 1.3
Chien-Liang Fok
chien-liang at users.sourceforge.net
Wed Nov 15 06:43:15 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-serv19625
Modified Files:
Member.ma
Log Message:
Added LED Indicators for debugging.
Index: Member.ma
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/mobile-chat/Member.ma,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Member.ma 15 Nov 2006 13:47:10 -0000 1.2
--- Member.ma 15 Nov 2006 14:43:12 -0000 1.3
***************
*** 3,131 ****
// heap[0] = PDA+Proxy location
// heap[1] = leader location
!
! pushc 8
! sleep
! BEGIN randnbr // look for a node in the network
! rjumpc FND_NODE
! pushc 16
! sleep
! rjump BEGIN
! FND_NODE smove // migrate to the node
// Query Base station, Discover the leader location
! loc
! pushn abc // group name = "abc", HARD CODED
! pushn req
! pushc 3
! pushloc uart_x uart_y
! rout // Send To BaseStation: <"req", "abc", member loc>
! pushc 8 // sleep for 1 second to allow BS to generate reponse
! sleep
!
! pusht location // React to BS: <"grl", leader loc>
! pushn grl // future: <"grl", member ID, leader loc>
! pushc 2
! in // wait for response
! pop
! pop
! setvar 1 // heap[1] = leader location
!
// Register with the leader
! loc
! aid
! pushn jng
! pushc 3 // To Leader: <"jng", member ID, member loc>
! getvar 1
! rout // send to leader location
// register reaction: for leader broadcast messages
! pusht string
! pusht string
! aid
! pushn lbm // <"lbm", memeber ID, screen name, chat msg>
! pushc 4
! pushcl LEADER_MSG
! regrxn
! // register reaction: for messages from PDA+Proxy to send
// FromPDA+Proxy: <'ocm', screen name, chat msg>
! pusht string
! pusht string
! pushn ocm
! pushc 3
! pushcl PDA_MSG
! regrxn
!
! // register reaction to move to a different node
! pusht location
! aid
! pushn abc
! pushc 3
! pushcl MOVE
! regrxn
! WAIT wait
!
// React to: <"lbm", memeber ID, screen name, chat msg>
// Send to Proxy:
! LEADER_MSG remove // remove the tuple
! pop
! pop
! pop // Stack: (screen name, chat msg)
! getvar 0
! cisnbr // check if the PDA+Proxy is still a valid neighbor
! rjumpc LM_CONT
! pop // fail, disgard chat msg
! pop
! endrxn
! LM_CONT pushn icm // <"icm", screen name, chat msg>
! pushc 3
! getvar 0
! rout // success, send tuple to PDA+Proxy
! endrxn
// React to: <'ocm', screen name, chat msg> from PDA+Proxy
// Send to leader: <"mbm", AgentID, String:name, String:msg>
! PDA_MSG remove
! pop
! pop // Stack: (screen name, chat msg)
! aid
! 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
--- 3,107 ----
// heap[0] = PDA+Proxy location
// heap[1] = leader location
!
! pushc 26
! putled
! pushc 16
! sleep
! pushc 26
! putled // Blink green LED
! BEGIN randnbr // look for a node in the network
! rjumpc FND_NODE
! pushc 16
! sleep
! rjump BEGIN
! FND_NODE smove // migrate to the node
!
! pushc 26
! putled
! pushc 8
! sleep
! pushc 26
! putled // Blink green LED
// Query Base station, Discover the leader location
! loc
! pushn abc // group name = "abc", HARD CODED
! pushn req
! pushc 3
! pushloc uart_x uart_y
! rout // Send To BaseStation: <"req", "abc", member loc>
! pushc 8 // sleep for 1 second to allow BS to generate reponse
! sleep
!
! pusht location // React to BS: <"grl", leader loc>
! pushn grl // future: <"grl", member ID, leader loc>
! pushc 2
! in // wait for response
! pop
! pop
! setvar 1 // heap[1] = leader location
!
// Register with the leader
! loc
! aid
! pushn jng
! pushc 3 // To Leader: <"jng", member ID, member loc>
! getvar 1
! rout // send to leader location
// register reaction: for leader broadcast messages
! pusht string
! pusht string
! aid
! pushn lbm // <"lbm", memeber ID, screen name, chat msg>
! pushc 4
! pushcl LEADER_MSG
! regrxn
! // register reaction: for messages from PDA+Proxy to send
// FromPDA+Proxy: <'ocm', screen name, chat msg>
! pusht string
! pusht string
! pushn ocm
! pushc 3
! pushcl PDA_MSG
! regrxn
!
!
! WAIT wait
!
// React to: <"lbm", memeber ID, screen name, chat msg>
// Send to Proxy:
! LEADER_MSG remove // remove the tuple
! pop
! pop
! pop // Stack: (screen name, chat msg)
! getvar 0
! cisnbr // check if the PDA+Proxy is still a valid neighbor
! rjumpc LM_CONT
! pop // fail, disgard chat msg
! pop
! endrxn
! LM_CONT pushn icm // <"icm", screen name, chat msg>
! pushc 3
! getvar 0
! rout // success, send tuple to PDA+Proxy
! endrxn
// React to: <'ocm', screen name, chat msg> from PDA+Proxy
// Send to leader: <"mbm", AgentID, String:name, String:msg>
! PDA_MSG remove
! pop
! pop // Stack: (screen name, chat msg)
! aid
! 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
More information about the Tinyos-contrib-commits
mailing list