[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components
AgentMgrM.nc, 1.23, 1.24 ExpLoggerC.nc, 1.1, 1.2 ExpLoggerM.nc,
1.1, 1.2 ResetMgrC.nc, 1.8, 1.9 ResetMgrM.nc, 1.6, 1.7
borndigerati
borndigerati at users.sourceforge.net
Thu Apr 6 18:15:17 PDT 2006
- Previous message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/apps/Agilla
Agilla.nc, 1.21, 1.22 AgillaOpcodes.h, 1.15,
1.16 Example Makefile.Agilla, 1.30, 1.31 platforms.properties,
1.3, 1.4
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components/AgentSender
AgentSenderI.nc, 1.2, 1.3 SenderCoordinatorM.nc, 1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5750/components
Modified Files:
AgentMgrM.nc ExpLoggerC.nc ExpLoggerM.nc ResetMgrC.nc
ResetMgrM.nc
Log Message:
Index: AgentMgrM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/AgentMgrM.nc,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** AgentMgrM.nc 6 Apr 2006 02:10:05 -0000 1.23
--- AgentMgrM.nc 7 Apr 2006 01:14:35 -0000 1.24
***************
*** 2,37 ****
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2004, Washington University in Saint Louis
* By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
* as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
*
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
*
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
*
! * See the GNU Lesser General Public License for more details, which can
* be found here: http://www.gnu.org/copyleft/lesser.html
*/
--- 2,37 ----
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2004, Washington University in Saint Louis
* By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
* as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
*
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
*
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
*
! * See the GNU Lesser General Public License for more details, which can
* be found here: http://www.gnu.org/copyleft/lesser.html
*/
***************
*** 57,75 ****
interface AgentSenderI;
interface AgentReceiverI;
!
interface NeighborListI;
interface SystemTSMgrI;
interface TupleUtilI;
interface HeapMgrI;
! interface OpStackI;
! interface RxnMgrI;
interface LocationMgrI;
!
! //interface Timer as SimTimer; // used for TOSSIM
interface LEDBlinkerI;
#if ENABLE_EXP_LOGGING
! interface ExpLoggerI;
! #endif
}
}
--- 57,74 ----
interface AgentSenderI;
interface AgentReceiverI;
!
interface NeighborListI;
interface SystemTSMgrI;
interface TupleUtilI;
interface HeapMgrI;
! interface OpStackI;
! interface RxnMgrI;
interface LocationMgrI;
! //interface Timer as SimTimer; // used for TOSSIM
interface LEDBlinkerI;
#if ENABLE_EXP_LOGGING
! interface ExpLoggerI;
! #endif
}
}
***************
*** 77,86 ****
#if INCLUDE_DEFAULT_AGENT
! AgillaCodeMsg cMsg;
#endif
AgillaAgentContext agents[AGILLA_NUM_AGENTS]; // the agent contexts
uint8_t idCount; // unique Agent ID count
!
/**
* OUTs an AgillaAgentID tuple into the tuple space, then
--- 76,85 ----
#if INCLUDE_DEFAULT_AGENT
! AgillaCodeMsg cMsg;
#endif
AgillaAgentContext agents[AGILLA_NUM_AGENTS]; // the agent contexts
uint8_t idCount; // unique Agent ID count
!
/**
* OUTs an AgillaAgentID tuple into the tuple space, then
***************
*** 91,95 ****
call AgentMgrI.run(context);
}
!
/**
* Generate a new agent ID.
--- 90,94 ----
call AgentMgrI.run(context);
}
!
/**
* Generate a new agent ID.
***************
*** 101,105 ****
newid += idCount++;
return newid;
! }
command result_t StdControl.init() {
--- 100,104 ----
newid += idCount++;
return newid;
! }
command result_t StdControl.init() {
***************
*** 110,128 ****
command result_t StdControl.start() {
#if INCLUDE_DEFAULT_AGENT
! if (TOS_LOCAL_ADDRESS == 0)
{
! #include "default_agent.ma"
! //runNewAgent(&agents[0]);
call AgentSenderI.send(&agents[0], agents[0].id, IOPwmove, 1, 1);
}
! #endif
! dbg(DBG_USR1, "AgentMgrI.start(): Agilla host %i started...\n", TOS_LOCAL_ADDRESS);
return SUCCESS;
}
!
command result_t StdControl.stop() {
return SUCCESS;
}
!
command result_t AgentMgrI.resetAll() {
int i;
--- 109,127 ----
command result_t StdControl.start() {
#if INCLUDE_DEFAULT_AGENT
! if (TOS_LOCAL_ADDRESS == 0)
{
! #include "default_agent.ma"
! //runNewAgent(&agents[0]);
call AgentSenderI.send(&agents[0], agents[0].id, IOPwmove, 1, 1);
}
! #endif
! dbg(DBG_USR1, "AgentMgrI.start(): Agilla host %i started...\n", TOS_LOCAL_ADDRESS);
return SUCCESS;
}
!
command result_t StdControl.stop() {
return SUCCESS;
}
!
command result_t AgentMgrI.resetAll() {
int i;
***************
*** 130,138 ****
for (i = 0; i < AGILLA_NUM_AGENTS; i++) {
//agents[i].sBlock = -1;
! call AgentMgrI.reset(&agents[i]);
! }
return SUCCESS;
}
!
/*event result_t SimTimer.fired() {
#if INCLUDE_DEFAULT_AGENT
--- 129,137 ----
for (i = 0; i < AGILLA_NUM_AGENTS; i++) {
//agents[i].sBlock = -1;
! call AgentMgrI.reset(&agents[i]);
! }
return SUCCESS;
}
!
/*event result_t SimTimer.fired() {
#if INCLUDE_DEFAULT_AGENT
***************
*** 141,147 ****
return SUCCESS;
}*/
!
/**
! * Resets an agent's context. Frees all resources being consumed by
* the agent. If an experiment is running, it saves timming information
* as needed.
--- 140,146 ----
return SUCCESS;
}*/
!
/**
! * Resets an agent's context. Frees all resources being consumed by
* the agent. If an experiment is running, it saves timming information
* as needed.
***************
*** 151,163 ****
command result_t AgentMgrI.reset(AgillaAgentContext* context) {
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrI.reset(): Resetting agent %i...\n", context->id.id);
#endif
!
call SystemTSMgrI.inAgentTuple(context->id);
call CodeMgrI.deallocateBlocks(context);
! call OpStackI.reset(context);
call HeapMgrI.reset(context);
call RxnMgrI.flush(&context->id);
!
context->state = AGILLA_STATE_HALT;
context->rstate = AGILLA_RSTATE_IDLE;
--- 150,162 ----
command result_t AgentMgrI.reset(AgillaAgentContext* context) {
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrI.reset(): Resetting agent %i...\n", context->id.id);
#endif
!
call SystemTSMgrI.inAgentTuple(context->id);
call CodeMgrI.deallocateBlocks(context);
! call OpStackI.reset(context);
call HeapMgrI.reset(context);
call RxnMgrI.flush(&context->id);
!
context->state = AGILLA_STATE_HALT;
context->rstate = AGILLA_RSTATE_IDLE;
***************
*** 165,173 ****
context->pc = 0;
context->id.id = 0;
!
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrI.reset(): Done resetting agent.\n");
#endif
!
return SUCCESS;
}
--- 164,172 ----
context->pc = 0;
context->id.id = 0;
!
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrI.reset(): Done resetting agent.\n");
#endif
!
return SUCCESS;
}
***************
*** 188,193 ****
int i;
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrI.getContext(): Getting agent context %i...\n", id->id);
! #endif
for(i=0; i < AGILLA_NUM_AGENTS; i++) {
if (agents[i].id.id == id->id && agents[i].state != AGILLA_STATE_HALT)
--- 187,192 ----
int i;
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrI.getContext(): Getting agent context %i...\n", id->id);
! #endif
for(i=0; i < AGILLA_NUM_AGENTS; i++) {
if (agents[i].id.id == id->id && agents[i].state != AGILLA_STATE_HALT)
***************
*** 195,200 ****
}
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrI.getContext(): Got agent %i...\n", id->id);
! #endif
return NULL;
}
--- 194,199 ----
}
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrI.getContext(): Got agent %i...\n", id->id);
! #endif
return NULL;
}
***************
*** 210,218 ****
command AgillaAgentContext* AgentMgrI.getFreeContext(AgillaAgentID *id, uint16_t codeSize) {
int i;
! for (i = 0; i < AGILLA_NUM_AGENTS; i++)
{
! if (agents[i].state == AGILLA_STATE_HALT)
{
! if (call CodeMgrI.allocateBlocks(&agents[i], codeSize))
{
agents[i].id = *id;
--- 209,217 ----
command AgillaAgentContext* AgentMgrI.getFreeContext(AgillaAgentID *id, uint16_t codeSize) {
int i;
! for (i = 0; i < AGILLA_NUM_AGENTS; i++)
{
! if (agents[i].state == AGILLA_STATE_HALT)
{
! if (call CodeMgrI.allocateBlocks(&agents[i], codeSize))
{
agents[i].id = *id;
***************
*** 223,227 ****
} else
{
! dbg(DBG_USR1, "AgentMgrI.getFreeContext: ERROR: Unable to allocate code blocks.\n");
}
}
--- 222,226 ----
} else
{
! dbg(DBG_USR1, "AgentMgrI.getFreeContext: ERROR: Unable to allocate code blocks.\n");
}
}
***************
*** 244,303 ****
*
* @param context The agent to migrate.
! * @param dest The the one-hop destination mote.
* @param final_dest The final destination mote, e.g., TOS_UART_ADDRESS.
* @param op The opcode that the agent is executing.
*/
command result_t AgentMgrI.migrate(AgillaAgentContext* context, uint16_t dest,
! uint16_t final_dest, uint8_t op)
! {
AgillaAgentID id = context->id;
!
if (dest == TOS_LOCAL_ADDRESS) // agent migrates to self
! {
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrM: Agent migrating to self (%i).\n", dest);
! #endif
!
! if (op == IOPsmove)
return SUCCESS;
!
! if (op == IOPwmove)
! {
context->condition = 1; // move was successful
context->pc = 0; // reset pc
! call OpStackI.reset(context);
call HeapMgrI.reset(context);
! call RxnMgrI.flush(&context->id);
return SUCCESS;
! }
!
// If the agent clones to self, go through the usual
// cloning operation.
}
!
if (op == IOPsclone || op == IOPwclone)
! id.id = getNewID();
!
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrM: migrating agent:\n\tid = %i\n\top = %i\n\tdest = 0x%x\n\tfinal_dest = 0x%x\n",
! id.id, op, dest, final_dest);
! #endif
!
return call AgentSenderI.send(context, id, op, dest, final_dest);
}
/**
! * This is signaled when an agent has finished migrating.
* If the operation was a MOVE and was successful, or the agent
* just bounced off this node, the context is
* reset. If it was not successful, or if the operation was a clone,
! * the context is resumed on this node.
*/
! event void AgentSenderI.sendDone(AgillaAgentContext* context, uint8_t op,
! result_t success)
{
! if (op == IOPsmove || op == IOPwmove)
{
! if (success == FAIL)
{
context->condition = 0;
--- 243,302 ----
*
* @param context The agent to migrate.
! * @param dest The the one-hop destination mote.
* @param final_dest The final destination mote, e.g., TOS_UART_ADDRESS.
* @param op The opcode that the agent is executing.
*/
command result_t AgentMgrI.migrate(AgillaAgentContext* context, uint16_t dest,
! uint16_t final_dest, uint8_t op)
! {
AgillaAgentID id = context->id;
!
if (dest == TOS_LOCAL_ADDRESS) // agent migrates to self
! {
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrM: Agent migrating to self (%i).\n", dest);
! #endif
!
! if (op == IOPsmove)
return SUCCESS;
!
! if (op == IOPwmove)
! {
context->condition = 1; // move was successful
context->pc = 0; // reset pc
! call OpStackI.reset(context);
call HeapMgrI.reset(context);
! call RxnMgrI.flush(&context->id);
return SUCCESS;
! }
!
// If the agent clones to self, go through the usual
// cloning operation.
}
!
if (op == IOPsclone || op == IOPwclone)
! id.id = getNewID();
!
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrM: migrating agent:\n\tid = %i\n\top = %i\n\tdest = 0x%x\n\tfinal_dest = 0x%x\n",
! id.id, op, dest, final_dest);
! #endif
!
return call AgentSenderI.send(context, id, op, dest, final_dest);
}
/**
! * This is signaled when an agent has finished migrating.
* If the operation was a MOVE and was successful, or the agent
* just bounced off this node, the context is
* reset. If it was not successful, or if the operation was a clone,
! * the context is resumed on this node.
*/
! event void AgentSenderI.sendDone(AgillaAgentContext* context, uint8_t op,
! result_t success, uint16_t dest)
{
! if (op == IOPsmove || op == IOPwmove)
{
! if (success == FAIL)
{
context->condition = 0;
***************
*** 308,312 ****
{
context->condition = 3;
! call AgentMgrI.run(context); // move failed b/c of rejection (set condition = 3, resume running)
}
} else if (op == IOPsclone || op == IOPwclone) {
--- 307,311 ----
{
context->condition = 3;
! call AgentMgrI.run(context); // move failed b/c of rejection (set condition = 3, resume running)
}
} else if (op == IOPsclone || op == IOPwclone) {
***************
*** 317,322 ****
else
context->condition = 0; // indicate this is the parent, but the operation failed.
! call AgentMgrI.run(context);
! } else
call AgentMgrI.reset(context); // the agent bounced off this node
}
--- 316,321 ----
else
context->condition = 0; // indicate this is the parent, but the operation failed.
! call AgentMgrI.run(context);
! } else
call AgentMgrI.reset(context); // the agent bounced off this node
}
***************
*** 328,335 ****
*/
event void AgentReceiverI.receivedAgent(AgillaAgentContext* context,
! uint16_t dest)
! {
if (dest == TOS_LOCAL_ADDRESS) {
!
// send the agent migration trace to the base station
#if ENABLE_EXP_LOGGING
--- 327,334 ----
*/
event void AgentReceiverI.receivedAgent(AgillaAgentContext* context,
! uint16_t dest)
! {
if (dest == TOS_LOCAL_ADDRESS) {
!
// send the agent migration trace to the base station
#if ENABLE_EXP_LOGGING
***************
*** 338,343 ****
call ExpLoggerI.sendTrace(context->id.id, TOS_LOCAL_ADDRESS, AGENT_MOVED, SUCCESS, loc);
#endif
!
! /*#ifdef PACKET_SIM_H_INCLUDED
uint8_t instr;
uint16_t i = 0;
--- 337,342 ----
call ExpLoggerI.sendTrace(context->id.id, TOS_LOCAL_ADDRESS, AGENT_MOVED, SUCCESS, loc);
#endif
!
! /*#ifdef PACKET_SIM_H_INCLUDED
uint8_t instr;
uint16_t i = 0;
***************
*** 354,367 ****
}
#endif*/
! runNewAgent(context);
} else {
uint16_t oneHopDest = dest;
result_t forward = SUCCESS;
!
//call Leds.redToggle();
//call Leds.greenToggle();
! //call ArrivalLedTimer.start(TIMER_ONE_SHOT, ARRIVAL_LED_TIME);
call LEDBlinkerI.blink((uint8_t)RED | GREEN, (uint8_t)1, ARRIVAL_LED_TIME);
!
#if ENABLE_GRID_ROUTING
forward = call NeighborListI.getClosestNeighbor(&oneHopDest);
--- 353,366 ----
}
#endif*/
! runNewAgent(context);
} else {
uint16_t oneHopDest = dest;
result_t forward = SUCCESS;
!
//call Leds.redToggle();
//call Leds.greenToggle();
! //call ArrivalLedTimer.start(TIMER_ONE_SHOT, ARRIVAL_LED_TIME);
call LEDBlinkerI.blink((uint8_t)RED | GREEN, (uint8_t)1, ARRIVAL_LED_TIME);
!
#if ENABLE_GRID_ROUTING
forward = call NeighborListI.getClosestNeighbor(&oneHopDest);
***************
*** 374,381 ****
// only supports physically one-hop networks. This destination is
// most likely TOS_UART_ADDRESS.
! call AgentMgrI.migrate(context, oneHopDest, dest, IOPhalt);
else
call AgentMgrI.reset(context);
! }
}
--- 373,380 ----
// only supports physically one-hop networks. This destination is
// most likely TOS_UART_ADDRESS.
! call AgentMgrI.migrate(context, oneHopDest, dest, IOPhalt);
else
call AgentMgrI.reset(context);
! }
}
***************
*** 383,390 ****
* Signalled when the blinking is done and blink(...) can be called again.
*/
! event result_t LEDBlinkerI.blinkDone() {
return SUCCESS;
! }
!
/*event result_t ArrivalLedTimer.fired() {
call Leds.redToggle();
--- 382,389 ----
* Signalled when the blinking is done and blink(...) can be called again.
*/
! event result_t LEDBlinkerI.blinkDone() {
return SUCCESS;
! }
!
/*event result_t ArrivalLedTimer.fired() {
call Leds.redToggle();
***************
*** 407,412 ****
return FAIL;
}
!
! /**
* Retuns the index of the agent context with the specified AgentID.
*/
--- 406,411 ----
return FAIL;
}
!
! /**
* Retuns the index of the agent context with the specified AgentID.
*/
***************
*** 431,458 ****
return SUCCESS;
}
!
! /*event result_t RxnMgrI.rxnFired(Reaction* rxn, AgillaTuple* tuple) {
! int i = getIndexOf(&rxn->id);
! if (i != -1) {
!
#if DEBUG_AGENT_MGR
dbg(DBG_USR1, "AgentMgrM: event RxnMgrI.rxnFired(): Agent %i's reaction fired!\n", agents[i].id.id);
call TupleUtilI.printTuple(tuple);
! #endif
!
! if (agents[i].state != AGILLA_STATE_LEAVING) {
call OpStackI.pushValue(&agents[i], agents[i].pc); // store the old pc on top of the stack
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrM: event RxnMgrI.rxnFired(): Saved agent %i's old PC %i onto stack!\n", agents[i].id.id, agents[i].pc);
call OpStackI.toString(&agents[i]);
! #endif
!
agents[i].pc = rxn->pc; // update pc
!
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrM: event RxnMgrI.rxnFired(): Updated Agent %i's PC to %i!\n", agents[i].id.id, agents[i].pc);
! #endif
!
call TupleUtilI.pushTuple(tuple, &agents[i]); // push matching tuple
if (agents[i].state == AGILLA_STATE_WAITING)
--- 430,457 ----
return SUCCESS;
}
!
! /*event result_t RxnMgrI.rxnFired(Reaction* rxn, AgillaTuple* tuple) {
! int i = getIndexOf(&rxn->id);
! if (i != -1) {
!
#if DEBUG_AGENT_MGR
dbg(DBG_USR1, "AgentMgrM: event RxnMgrI.rxnFired(): Agent %i's reaction fired!\n", agents[i].id.id);
call TupleUtilI.printTuple(tuple);
! #endif
!
! if (agents[i].state != AGILLA_STATE_LEAVING) {
call OpStackI.pushValue(&agents[i], agents[i].pc); // store the old pc on top of the stack
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrM: event RxnMgrI.rxnFired(): Saved agent %i's old PC %i onto stack!\n", agents[i].id.id, agents[i].pc);
call OpStackI.toString(&agents[i]);
! #endif
!
agents[i].pc = rxn->pc; // update pc
!
#if DEBUG_AGENT_MGR
! dbg(DBG_USR1, "AgentMgrM: event RxnMgrI.rxnFired(): Updated Agent %i's PC to %i!\n", agents[i].id.id, agents[i].pc);
! #endif
!
call TupleUtilI.pushTuple(tuple, &agents[i]); // push matching tuple
if (agents[i].state == AGILLA_STATE_WAITING)
***************
*** 461,465 ****
#if DEBUG_AGENT_MGR
dbg(DBG_USR1, "AgentMgrM: event RxnMgrI.rxnFired(): ERROR: Agent %i is leaving!\n", rxn->id.id);
! #endif
}
} else {
--- 460,464 ----
#if DEBUG_AGENT_MGR
dbg(DBG_USR1, "AgentMgrM: event RxnMgrI.rxnFired(): ERROR: Agent %i is leaving!\n", rxn->id.id);
! #endif
}
} else {
Index: ExpLoggerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/ExpLoggerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ExpLoggerC.nc 6 Apr 2006 02:10:05 -0000 1.1
--- ExpLoggerC.nc 7 Apr 2006 01:14:35 -0000 1.2
***************
*** 5,25 ****
provides {
interface ExpLoggerI;
! }
}
! implementation
{
components Main, ExpLoggerM, NetworkInterfaceProxy, MessageBufferM, SimpleTime;
!
ExpLoggerI = ExpLoggerM;
!
Main.StdControl -> ExpLoggerM;
Main.StdControl -> MessageBufferM;
Main.StdControl -> SimpleTime;
!
ExpLoggerM.SendResults -> NetworkInterfaceProxy.SendMsg[AM_AGILLAEXPRESULTSMSG];
ExpLoggerM.SendLatency -> NetworkInterfaceProxy.SendMsg[AM_AGILLAEXPLATENCYMSG];
ExpLoggerM.SendTrace -> NetworkInterfaceProxy.SendMsg[AM_AGILLATRACEMSG];
! ExpLoggerM.ReceiveQuery -> NetworkInterfaceProxy.ReceiveMsg[AM_AGILLAEXPQUERYRESULTSMSG];
ExpLoggerM.MessageBufferI -> MessageBufferM;
! ExpLoggerM.Time -> SimpleTime;;
}
--- 5,25 ----
provides {
interface ExpLoggerI;
! }
}
! implementation
{
components Main, ExpLoggerM, NetworkInterfaceProxy, MessageBufferM, SimpleTime;
!
ExpLoggerI = ExpLoggerM;
!
Main.StdControl -> ExpLoggerM;
Main.StdControl -> MessageBufferM;
Main.StdControl -> SimpleTime;
!
ExpLoggerM.SendResults -> NetworkInterfaceProxy.SendMsg[AM_AGILLAEXPRESULTSMSG];
ExpLoggerM.SendLatency -> NetworkInterfaceProxy.SendMsg[AM_AGILLAEXPLATENCYMSG];
ExpLoggerM.SendTrace -> NetworkInterfaceProxy.SendMsg[AM_AGILLATRACEMSG];
! ExpLoggerM.ReceiveQuery -> NetworkInterfaceProxy.ReceiveMsg[AM_AGILLAEXPQUERYRESULTSMSG];
ExpLoggerM.MessageBufferI -> MessageBufferM;
! ExpLoggerM.Time -> SimpleTime;
}
Index: ExpLoggerM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/ExpLoggerM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ExpLoggerM.nc 6 Apr 2006 02:10:05 -0000 1.1
--- ExpLoggerM.nc 7 Apr 2006 01:14:35 -0000 1.2
***************
*** 15,21 ****
}
implementation {
!
uint16_t _numQueries, _numUpdates;
!
command result_t StdControl.init() {
call ExpLoggerI.reset();
--- 15,21 ----
}
implementation {
!
uint16_t _numQueries, _numUpdates;
!
command result_t StdControl.init() {
call ExpLoggerI.reset();
***************
*** 26,34 ****
return SUCCESS;
}
!
command result_t StdControl.stop() {
return SUCCESS;
! }
!
command result_t ExpLoggerI.reset() {
_numQueries = 0;
--- 26,34 ----
return SUCCESS;
}
!
command result_t StdControl.stop() {
return SUCCESS;
! }
!
command result_t ExpLoggerI.reset() {
_numQueries = 0;
***************
*** 36,67 ****
return SUCCESS;
}
!
command result_t ExpLoggerI.incQueryMsg() {
_numQueries++;
return SUCCESS;
}
!
command result_t ExpLoggerI.incNumUpdates() {
_numUpdates++;
return SUCCESS;
}
!
command result_t ExpLoggerI.sendQueryLatency(uint32_t latency) {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaExpLatencyMsg *lMsg = (struct AgillaExpLatencyMsg *)msg->data;
! lMsg->latency = latency;
! if (!call SendLatency.send(TOS_UART_ADDR, sizeof(AgillaExpLatencyMsg), msg))
! call MessageBufferI.freeMsg(msg);
! }
return SUCCESS;
}
!
! command result_t ExpLoggerI.sendTrace(uint16_t agentID, uint16_t nodeID,
uint16_t action, uint16_t success, AgillaLocation loc)
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaTraceMsg *traceMsg = (struct AgillaTraceMsg *)msg->data;
--- 36,67 ----
return SUCCESS;
}
!
command result_t ExpLoggerI.incQueryMsg() {
_numQueries++;
return SUCCESS;
}
!
command result_t ExpLoggerI.incNumUpdates() {
_numUpdates++;
return SUCCESS;
}
!
command result_t ExpLoggerI.sendQueryLatency(uint32_t latency) {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaExpLatencyMsg *lMsg = (struct AgillaExpLatencyMsg *)msg->data;
! lMsg->latency = latency;
! if (!call SendLatency.send(TOS_UART_ADDR, sizeof(AgillaExpLatencyMsg), msg))
! call MessageBufferI.freeMsg(msg);
! }
return SUCCESS;
}
!
! command result_t ExpLoggerI.sendTrace(uint16_t agentID, uint16_t nodeID,
uint16_t action, uint16_t success, AgillaLocation loc)
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaTraceMsg *traceMsg = (struct AgillaTraceMsg *)msg->data;
***************
*** 72,81 ****
traceMsg->success = success;
traceMsg->loc = loc;
! if (!call SendTrace.send(TOS_UART_ADDR, sizeof(AgillaTraceMsg), msg))
! call MessageBufferI.freeMsg(msg);
! }
return SUCCESS;
}
!
/**
* This task is executed when a query is received.
--- 72,100 ----
traceMsg->success = success;
traceMsg->loc = loc;
! if (!call SendTrace.send(TOS_UART_ADDR, sizeof(AgillaTraceMsg), msg))
! call MessageBufferI.freeMsg(msg);
! }
return SUCCESS;
}
!
! command result_t ExpLoggerI.sendSetCluster(uint16_t newClusterHead)
! {
! TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
! {
! struct AgillaTraceMsg *traceMsg = (struct AgillaTraceMsg *)msg->data;
! traceMsg->timestamp = call Time.get();
! traceMsg->agentID = 0;
! traceMsg->nodeID = TOS_LOCAL_ADDRESS;
! traceMsg->action = SET_CLUSTER_HEAD;
! traceMsg->success = newClusterHead;
! traceMsg->loc.x = 0;
! traceMsg->loc.y = 0;
! if (!call SendTrace.send(TOS_UART_ADDR, sizeof(AgillaTraceMsg), msg))
! call MessageBufferI.freeMsg(msg);
! }
! return SUCCESS;
! }
!
/**
* This task is executed when a query is received.
***************
*** 83,121 ****
task void sendResults() {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaExpResultsMsg *rMsg = (struct AgillaExpResultsMsg *)msg->data;
! rMsg->numQueries = _numQueries;
rMsg->numUpdates = _numUpdates;
! if (!call SendResults.send(TOS_UART_ADDR, sizeof(AgillaExpResultsMsg), msg))
! call MessageBufferI.freeMsg(msg);
! }
}
!
! event TOS_MsgPtr ReceiveQuery.receive(TOS_MsgPtr m)
! {
#if DEBUG_EXP_LOGGER
! dbg(DBG_USR1, "ExpLoggerM: Sending Results.\n");
! #endif
post sendResults();
return m;
}
!
event result_t SendLatency.sendDone(TOS_MsgPtr m, result_t success)
{
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
event result_t SendResults.sendDone(TOS_MsgPtr m, result_t success)
{
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
event result_t SendTrace.sendDone(TOS_MsgPtr m, result_t success)
{
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
}
--- 102,140 ----
task void sendResults() {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaExpResultsMsg *rMsg = (struct AgillaExpResultsMsg *)msg->data;
! rMsg->numQueries = _numQueries;
rMsg->numUpdates = _numUpdates;
! if (!call SendResults.send(TOS_UART_ADDR, sizeof(AgillaExpResultsMsg), msg))
! call MessageBufferI.freeMsg(msg);
! }
}
!
! event TOS_MsgPtr ReceiveQuery.receive(TOS_MsgPtr m)
! {
#if DEBUG_EXP_LOGGER
! dbg(DBG_USR1, "ExpLoggerM: Sending Results.\n");
! #endif
post sendResults();
return m;
}
!
event result_t SendLatency.sendDone(TOS_MsgPtr m, result_t success)
{
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
event result_t SendResults.sendDone(TOS_MsgPtr m, result_t success)
{
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
event result_t SendTrace.sendDone(TOS_MsgPtr m, result_t success)
{
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
}
Index: ResetMgrC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/ResetMgrC.nc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ResetMgrC.nc 5 Apr 2006 18:04:38 -0000 1.8
--- ResetMgrC.nc 7 Apr 2006 01:14:35 -0000 1.9
***************
*** 2,37 ****
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2004, Washington University in Saint Louis
* By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
* as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
*
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
*
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
*
! * See the GNU Lesser General Public License for more details, which can
* be found here: http://www.gnu.org/copyleft/lesser.html
*/
--- 2,37 ----
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2004, Washington University in Saint Louis
* By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
* as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
*
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
*
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
*
! * See the GNU Lesser General Public License for more details, which can
* be found here: http://www.gnu.org/copyleft/lesser.html
*/
***************
*** 44,48 ****
configuration ResetMgrC {
provides {
! interface StdControl;
interface ResetMgrI;
}
--- 44,48 ----
configuration ResetMgrC {
provides {
! interface StdControl;
interface ResetMgrI;
}
***************
*** 56,67 ****
components AgentMgrC, TupleSpaceProxy;
components MessageBufferM, LedsC;
!
#if ENABLE_EXP_LOGGING
! components ExpLoggerC;
! #endif
!
StdControl = ResetMgrM;
StdControl = LEDBlinkerC;
!
ResetMgrI = ResetMgrM;
--- 56,72 ----
components AgentMgrC, TupleSpaceProxy;
components MessageBufferM, LedsC;
!
! #if ENABLE_CLUSTERING
! components ClusterheadDirectoryM;
! #endif
!
!
#if ENABLE_EXP_LOGGING
! components ExpLoggerC;
! #endif
!
StdControl = ResetMgrM;
StdControl = LEDBlinkerC;
!
ResetMgrI = ResetMgrM;
***************
*** 75,82 ****
ResetMgrM.LEDBlinkerI -> LEDBlinkerC;
ResetMgrM.MessageBufferI -> MessageBufferM;
!
#if ENABLE_EXP_LOGGING
! ResetMgrM.ExpLoggerI -> ExpLoggerC;
#endif
ResetMgrM.Leds -> LedsC;
}
--- 80,90 ----
ResetMgrM.LEDBlinkerI -> LEDBlinkerC;
ResetMgrM.MessageBufferI -> MessageBufferM;
!
#if ENABLE_EXP_LOGGING
! ResetMgrM.ExpLoggerI -> ExpLoggerC;
#endif
ResetMgrM.Leds -> LedsC;
+ #if ENABLE_CLUSTERING
+ ResetMgrM.CHDir -> ClusterheadDirectoryM;
+ #endif
}
Index: ResetMgrM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/ResetMgrM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ResetMgrM.nc 5 Apr 2006 18:04:38 -0000 1.6
--- ResetMgrM.nc 7 Apr 2006 01:14:37 -0000 1.7
***************
*** 2,37 ****
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2004, Washington University in Saint Louis
* By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
* as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
*
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
*
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
*
! * See the GNU Lesser General Public License for more details, which can
* be found here: http://www.gnu.org/copyleft/lesser.html
*/
--- 2,37 ----
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2004, Washington University in Saint Louis
* By Chien-Liang Fok.
! *
! * Washington University states that Agilla is free software;
! * you can redistribute it and/or modify it under the terms of
! * the current version of the GNU Lesser General Public License
* as published by the Free Software Foundation.
! *
! * Agilla is distributed in the hope that it will be useful, but
! * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
! * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
*
! * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
! * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
! * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
! * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER
! * PROPRIETARY RIGHTS. THERE ARE NO WARRANTIES THAT SOFTWARE IS
! * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
! * OR OTHER HARMFUL CODE.
*
! * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
! * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
! * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
! * indemnify, defend, and hold harmless WU, its employees, officers and
! * agents from any and all claims, costs, or liabilities, including
! * attorneys fees and court costs at both the trial and appellate levels
! * for any loss, damage, or injury caused by your actions or actions of
! * your officers, servants, agents or third parties acting on behalf or
! * under authorization from you, as a result of using Agilla.
*
! * See the GNU Lesser General Public License for more details, which can
* be found here: http://www.gnu.org/copyleft/lesser.html
*/
***************
*** 40,44 ****
/**
! * Resets the mote when it receives a reset command from the
* basestation.
*
--- 40,44 ----
/**
! * Resets the mote when it receives a reset command from the
* basestation.
*
***************
*** 47,51 ****
module ResetMgrM {
provides {
! interface StdControl;
interface ResetMgrI;
}
--- 47,51 ----
module ResetMgrM {
provides {
! interface StdControl;
interface ResetMgrI;
}
***************
*** 58,72 ****
interface ErrorMgrI;
interface ReceiveMsg as ReceiveReset;
! interface SendMsg as SendReset;
interface MessageBufferI;
!
#if ENABLE_EXP_LOGGING
interface ExpLoggerI;
#endif
!
! interface Leds;
}
}
! implementation {
/**
* Remembers whether the mote is resetting, used to ensure
--- 58,77 ----
interface ErrorMgrI;
interface ReceiveMsg as ReceiveReset;
! interface SendMsg as SendReset;
interface MessageBufferI;
!
! interface Leds;
! #if ENABLE_CLUSTERING
! interface ClusterheadDirectoryI as CHDir;
! #endif
!
!
#if ENABLE_EXP_LOGGING
interface ExpLoggerI;
#endif
!
}
}
! implementation {
/**
* Remembers whether the mote is resetting, used to ensure
***************
*** 74,98 ****
*/
bool resetting;
!
/**
* Remembers whether the mote is waiting for a reset operation
* to complete. This is used to prevent continuous reset message
* flooding when only a single mote in the network needs to be reset.
! */
bool waiting;
!
! command result_t StdControl.init()
{
! resetting = waiting = FALSE;
call Leds.init();
return SUCCESS;
}
!
! command result_t StdControl.start()
{
return SUCCESS;
}
!
! command result_t StdControl.stop()
{
return SUCCESS;
--- 79,103 ----
*/
bool resetting;
!
/**
* Remembers whether the mote is waiting for a reset operation
* to complete. This is used to prevent continuous reset message
* flooding when only a single mote in the network needs to be reset.
! */
bool waiting;
!
! command result_t StdControl.init()
{
! resetting = waiting = FALSE;
call Leds.init();
return SUCCESS;
}
!
! command result_t StdControl.start()
{
return SUCCESS;
}
!
! command result_t StdControl.stop()
{
return SUCCESS;
***************
*** 102,124 ****
* When the first reset message is received, re-broadcast it then
* set a reset timer. When the reset timer fires, reset the mote.
! * After re-broadcasting the reset message, and before the reset
* timer fires, ignore all other reset messages.
*/
! event TOS_MsgPtr ReceiveReset.receive(TOS_MsgPtr m)
{
! AgillaResetMsg* rmsg = (AgillaResetMsg*)m->data;
!
// Reset this mote only.
! if (call AddressMgrI.isOrigAddress(rmsg->address))
{
! if (!resetting)
{
! resetting = TRUE;
call LEDBlinkerI.blink((uint8_t)RED|GREEN|YELLOW, 1, 1024);
}
! }
// Reset all motes. Re-broadcast the reset message before resetting.
! else if (rmsg->address == TOS_BCAST_ADDR)
{
if (!resetting) // only re-broadcast once (prevents recursive flooding)
--- 107,129 ----
* When the first reset message is received, re-broadcast it then
* set a reset timer. When the reset timer fires, reset the mote.
! * After re-broadcasting the reset message, and before the reset
* timer fires, ignore all other reset messages.
*/
! event TOS_MsgPtr ReceiveReset.receive(TOS_MsgPtr m)
{
! AgillaResetMsg* rmsg = (AgillaResetMsg*)m->data;
!
// Reset this mote only.
! if (call AddressMgrI.isOrigAddress(rmsg->address))
{
! if (!resetting)
{
! resetting = TRUE;
call LEDBlinkerI.blink((uint8_t)RED|GREEN|YELLOW, 1, 1024);
}
! }
// Reset all motes. Re-broadcast the reset message before resetting.
! else if (rmsg->address == TOS_BCAST_ADDR)
{
if (!resetting) // only re-broadcast once (prevents recursive flooding)
***************
*** 129,141 ****
resetting = TRUE;
rmsg->from = TOS_LOCAL_ADDRESS;
! *msg = *m;
if (!call SendReset.send(TOS_BCAST_ADDR, sizeof(AgillaResetMsg), msg))
call MessageBufferI.freeMsg(msg);
call LEDBlinkerI.blink((uint8_t)RED|GREEN|YELLOW, 1, 1024);
}
! }
}
! // Reset a specific mote. Get the neighbor closest to the destination
// and send it to it
else {
--- 134,146 ----
resetting = TRUE;
rmsg->from = TOS_LOCAL_ADDRESS;
! *msg = *m;
if (!call SendReset.send(TOS_BCAST_ADDR, sizeof(AgillaResetMsg), msg))
call MessageBufferI.freeMsg(msg);
call LEDBlinkerI.blink((uint8_t)RED|GREEN|YELLOW, 1, 1024);
}
! }
}
! // Reset a specific mote. Get the neighbor closest to the destination
// and send it to it
else {
***************
*** 145,151 ****
if (msg != NULL)
{
! waiting = TRUE;
rmsg->from = TOS_LOCAL_ADDRESS;
! *msg = *m;
if (!call SendReset.send(TOS_BCAST_ADDR, sizeof(AgillaResetMsg), msg))
call MessageBufferI.freeMsg(msg);
--- 150,156 ----
if (msg != NULL)
{
! waiting = TRUE;
rmsg->from = TOS_LOCAL_ADDRESS;
! *msg = *m;
if (!call SendReset.send(TOS_BCAST_ADDR, sizeof(AgillaResetMsg), msg))
call MessageBufferI.freeMsg(msg);
***************
*** 156,165 ****
return m;
}
!
/**
* Signalled when the blinking is done and blink(...) can be called again.
*/
! event result_t LEDBlinkerI.blinkDone()
! {
if (waiting)
waiting = FALSE;
--- 161,170 ----
return m;
}
!
/**
* Signalled when the blinking is done and blink(...) can be called again.
*/
! event result_t LEDBlinkerI.blinkDone()
! {
if (waiting)
waiting = FALSE;
***************
*** 174,193 ****
call Leds.yellowOff();
call Leds.greenOff();
!
#if ENABLE_EXP_LOGGING
call ExpLoggerI.reset();
#endif
!
resetting = FALSE;
}
return SUCCESS;
! }
!
! event result_t SendReset.sendDone(TOS_MsgPtr m, result_t success)
{
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
/**
* Returns true if the mote is in the process or resetting.
--- 179,201 ----
call Leds.yellowOff();
call Leds.greenOff();
!
#if ENABLE_EXP_LOGGING
call ExpLoggerI.reset();
#endif
!
resetting = FALSE;
+ #if ENABLE_CLUSTERING
+ call CHDir.reset();
+ #endif
}
return SUCCESS;
! }
!
! event result_t SendReset.sendDone(TOS_MsgPtr m, result_t success)
{
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
/**
* Returns true if the mote is in the process or resetting.
***************
*** 195,204 ****
command result_t ResetMgrI.isResetting() {
return resetting;
! }
!
event result_t TupleSpaceI.newTuple(AgillaTuple* tuple) {
return SUCCESS;
}
!
event result_t TupleSpaceI.byteShift(uint16_t from, uint16_t amount) {
return SUCCESS;
--- 203,212 ----
command result_t ResetMgrI.isResetting() {
return resetting;
! }
!
event result_t TupleSpaceI.newTuple(AgillaTuple* tuple) {
return SUCCESS;
}
!
event result_t TupleSpaceI.byteShift(uint16_t from, uint16_t amount) {
return SUCCESS;
- Previous message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/apps/Agilla
Agilla.nc, 1.21, 1.22 AgillaOpcodes.h, 1.15,
1.16 Example Makefile.Agilla, 1.30, 1.31 platforms.properties,
1.3, 1.4
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components/AgentSender
AgentSenderI.nc, 1.2, 1.3 SenderCoordinatorM.nc, 1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list