[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/opcodes
OPgetAgents.nc, 1.1, 1.2 OPgetAgentsM.nc, 1.4,
1.5 OPgetClosestAgent.nc, 1.1, 1.2 OPgetClosestAgentM.nc, 1.7,
1.8 OPgetNumAgents.nc, 1.1, 1.2 OPgetNumAgentsM.nc, 1.5,
1.6 OPgetlocation.nc, 1.3, 1.4 OPgetlocationM.nc, 1.6,
1.7 OPpushc6M.nc, 1.2, 1.3
borndigerati
borndigerati at users.sourceforge.net
Thu Apr 6 18:15:05 PDT 2006
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components/ContextDiscovery
ClusteringI.nc, 1.2, 1.3 NeighborListC.nc, 1.10,
1.11 NeighborListI.nc, 1.4, 1.5 NeighborListM.nc, 1.21,
1.22 NeighborListProxy.nc, 1.2, 1.3
- Next 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
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5750/opcodes
Modified Files:
OPgetAgents.nc OPgetAgentsM.nc OPgetClosestAgent.nc
OPgetClosestAgentM.nc OPgetNumAgents.nc OPgetNumAgentsM.nc
OPgetlocation.nc OPgetlocationM.nc OPpushc6M.nc
Log Message:
Index: OPgetAgents.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetAgents.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** OPgetAgents.nc 22 Mar 2006 00:37:08 -0000 1.1
--- OPgetAgents.nc 7 Apr 2006 01:14:53 -0000 1.2
***************
*** 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
*/
***************
*** 51,83 ****
}
implementation {
! components Main, OPgetAgentsM, LocationMgrC, AgentMgrC, TupleUtilC;
! components OpStackC, QueueProxy, ErrorMgrProxy, LedsC, NeighborListProxy as NbrList;
components NetworkInterfaceProxy as Comm, AddressMgrC, MessageBufferM;
components TimerC;
!
! BytecodeI = OPgetAgentsM;
! Main.StdControl -> OPgetAgentsM;
Main.StdControl -> MessageBufferM;
Main.StdControl -> TimerC;
!
! OPgetAgentsM.NeighborListI -> NbrList;
! OPgetAgentsM.LocationMgrI -> LocationMgrC;
!
! OPgetAgentsM.SendRequest -> Comm.SendMsg[AM_AGILLAQUERYALLAGENTSMSG];
! OPgetAgentsM.ReceiveRequest -> Comm.ReceiveMsg[AM_AGILLAQUERYALLAGENTSMSG];
!
! OPgetAgentsM.SendResults -> Comm.SendMsg[AM_AGILLAQUERYREPLYALLAGENTSMSG];
! OPgetAgentsM.ReceiveResults -> Comm.ReceiveMsg[AM_AGILLAQUERYREPLYALLAGENTSMSG];
!
! OPgetAgentsM.MessageBufferI -> MessageBufferM;
! OPgetAgentsM.AddressMgrI -> AddressMgrC;
! OPgetAgentsM.AgentMgrI -> AgentMgrC;
! OPgetAgentsM.TupleUtilI -> TupleUtilC;
! OPgetAgentsM.OpStackI -> OpStackC;
! OPgetAgentsM.QueueI -> QueueProxy;
! OPgetAgentsM.ErrorMgrI -> ErrorMgrProxy;
! OPgetAgentsM.Leds -> LedsC;
! OPgetAgentsM.Timeout -> TimerC.Timer[unique("Timer")];
}
--- 51,97 ----
}
implementation {
! components Main, LocationMgrC, AgentMgrC, TupleUtilC;
! components OpStackC, QueueProxy, ErrorMgrProxy, LedsC;
components NetworkInterfaceProxy as Comm, AddressMgrC, MessageBufferM;
components TimerC;
! #if ENABLE_CLUSTERING
! components ClusterheadDirectoryM;
! components NeighborListM as NbrList;
! components OPgetAgentsCM as OPgetAgents;
! #else
! components NeighborListProxy as NbrList;
! components OPgetAgentsM as OPgetAgents;
! #endif
! BytecodeI = OPgetAgents;
!
! Main.StdControl -> OPgetAgents;
Main.StdControl -> MessageBufferM;
Main.StdControl -> TimerC;
!
! OPgetAgents.NeighborListI -> NbrList;
! OPgetAgents.LocationMgrI -> LocationMgrC;
!
! OPgetAgents.SendRequest -> Comm.SendMsg[AM_AGILLAQUERYALLAGENTSMSG];
! OPgetAgents.ReceiveRequest -> Comm.ReceiveMsg[AM_AGILLAQUERYALLAGENTSMSG];
!
! OPgetAgents.SendResults -> Comm.SendMsg[AM_AGILLAQUERYREPLYALLAGENTSMSG];
! OPgetAgents.ReceiveResults -> Comm.ReceiveMsg[AM_AGILLAQUERYREPLYALLAGENTSMSG];
!
! OPgetAgents.MessageBufferI -> MessageBufferM;
! OPgetAgents.AddressMgrI -> AddressMgrC;
! OPgetAgents.AgentMgrI -> AgentMgrC;
! OPgetAgents.TupleUtilI -> TupleUtilC;
! OPgetAgents.OpStackI -> OpStackC;
! OPgetAgents.QueueI -> QueueProxy;
! OPgetAgents.ErrorMgrI -> ErrorMgrProxy;
! OPgetAgents.Leds -> LedsC;
! OPgetAgents.Timeout -> TimerC.Timer[unique("Timer")];
!
! #if ENABLE_CLUSTERING
! OPgetAgents.ClusteringI -> NbrList;
! OPgetAgents.ClusterheadDirectoryI -> ClusterheadDirectoryM;
! #endif
!
}
Index: OPgetAgentsM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetAgentsM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** OPgetAgentsM.nc 5 Apr 2006 18:04:39 -0000 1.4
--- OPgetAgentsM.nc 7 Apr 2006 01:14:53 -0000 1.5
***************
*** 2,37 ****
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2006, 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) 2006, 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
*/
***************
*** 51,64 ****
interface StdControl;
}
! uses {
interface NeighborListI;
interface LocationMgrI;
!
interface SendMsg as SendRequest;
interface ReceiveMsg as ReceiveRequest; // for routing
!
interface ReceiveMsg as ReceiveResults;
interface SendMsg as SendResults; // for routing
!
interface MessageBufferI;
interface AddressMgrI;
--- 51,64 ----
interface StdControl;
}
! uses {
interface NeighborListI;
interface LocationMgrI;
!
interface SendMsg as SendRequest;
interface ReceiveMsg as ReceiveRequest; // for routing
!
interface ReceiveMsg as ReceiveResults;
interface SendMsg as SendResults; // for routing
!
interface MessageBufferI;
interface AddressMgrI;
***************
*** 66,73 ****
interface TupleUtilI;
interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
interface Timer as Timeout;
! interface Leds; // debug
}
}
--- 66,73 ----
interface TupleUtilI;
interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
interface Timer as Timeout;
! interface Leds; // debug
}
}
***************
*** 82,108 ****
* the current agent finishes.
*/
! AgillaAgentContext* _currAgent;
!
/**
! * Holds pending agents that are waiting for the current agent
* to finish.
*/
Queue waitQueue;
!
/**
* A running counter for the query id.
*/
uint8_t _qid;
!
/**
* The maximum number of agents in the response.
*/
int16_t _max;
!
/**
* The number of agents in the response.
*/
int16_t _num_agents;
!
/**
* The type of the agent being searched for.
--- 82,108 ----
* the current agent finishes.
*/
! AgillaAgentContext* _currAgent;
!
/**
! * Holds pending agents that are waiting for the current agent
* to finish.
*/
Queue waitQueue;
!
/**
* A running counter for the query id.
*/
uint8_t _qid;
!
/**
* The maximum number of agents in the response.
*/
int16_t _max;
!
/**
* The number of agents in the response.
*/
int16_t _num_agents;
!
/**
* The type of the agent being searched for.
***************
*** 110,118 ****
uint16_t _agent_type;
! command result_t StdControl.init()
! {
! _currAgent = NULL;
_qid = 0;
! call QueueI.init(&waitQueue);
return SUCCESS;
}
--- 110,123 ----
uint16_t _agent_type;
! /**
! * The type of the agent being searched for.
! */
! uint16_t _agent_type;
!
! command result_t StdControl.init()
! {
! _currAgent = NULL;
_qid = 0;
! call QueueI.init(&waitQueue);
return SUCCESS;
}
***************
*** 131,147 ****
call AgentMgrI.run(_currAgent);
_currAgent = NULL;
!
// If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
{
#if DEBUG_OP_GET_AGENTS
dbg(DBG_USR1, "OPgetAgentsM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
}
return SUCCESS;
} // finish()
!
/**
--- 136,152 ----
call AgentMgrI.run(_currAgent);
_currAgent = NULL;
!
// If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
{
#if DEBUG_OP_GET_AGENTS
dbg(DBG_USR1, "OPgetAgentsM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
}
return SUCCESS;
} // finish()
!
/**
***************
*** 150,177 ****
* is forwarded to the UART.
*/
! inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
if (call AddressMgrI.isGW())
{
#if DEBUG_OP_GET_AGENTS
dbg(DBG_USR1, "OPgetAgentsM: sendQueryMsg(): Sending query message to the BS\n");
! #endif
return call SendRequest.send(TOS_UART_ADDR, sizeof(AgillaQueryAllAgentsMsg), msg);
} else
{
uint16_t onehop_dest;
!
// Get the one-hop neighbor that is closest to the gateway.
// If there is no known gateway, abort.
! if (call NeighborListI.getGW(&onehop_dest) == NO_GW)
{
! dbg(DBG_USR1, "OPgetAgentsM: ERROR: No neighbor closer to a gateway.\n");
return FAIL;
}
!
return call SendRequest.send(onehop_dest, sizeof(AgillaQueryAllAgentsMsg), msg);
}
} // sendQueryMsg()
!
/**
* Starts the sending of a location update message.
--- 155,182 ----
* is forwarded to the UART.
*/
! inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
if (call AddressMgrI.isGW())
{
#if DEBUG_OP_GET_AGENTS
dbg(DBG_USR1, "OPgetAgentsM: sendQueryMsg(): Sending query message to the BS\n");
! #endif
return call SendRequest.send(TOS_UART_ADDR, sizeof(AgillaQueryAllAgentsMsg), msg);
} else
{
uint16_t onehop_dest;
!
// Get the one-hop neighbor that is closest to the gateway.
// If there is no known gateway, abort.
! if (call NeighborListI.getGW(&onehop_dest) == NO_GW)
{
! dbg(DBG_USR1, "OPgetAgentsM: ERROR: No neighbor closer to a gateway.\n");
return FAIL;
}
!
return call SendRequest.send(onehop_dest, sizeof(AgillaQueryAllAgentsMsg), msg);
}
} // sendQueryMsg()
!
/**
* Starts the sending of a location update message.
***************
*** 180,184 ****
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaQueryAllAgentsMsg *qMsg = (struct AgillaQueryAllAgentsMsg *)msg->data;
--- 185,189 ----
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaQueryAllAgentsMsg *qMsg = (struct AgillaQueryAllAgentsMsg *)msg->data;
***************
*** 186,198 ****
qMsg->src = TOS_LOCAL_ADDRESS;
qMsg->dest = TOS_UART_ADDR;
! qMsg->qid = _qid++;
qMsg->agent_type = _agent_type;
! if (!sendQueryMsg(msg))
call MessageBufferI.freeMsg(msg);
else
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_NUM_AGENTS);
}
! } // task doSendQuery()
!
/**
* Execute a directory operation.
--- 191,205 ----
qMsg->src = TOS_LOCAL_ADDRESS;
qMsg->dest = TOS_UART_ADDR;
!
! qMsg->qid = ((TOS_LOCAL_ADDRESS & 0xff) << 8) | _qid++;
qMsg->agent_type = _agent_type;
! if (!sendQueryMsg(msg))
!
call MessageBufferI.freeMsg(msg);
else
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_NUM_AGENTS);
}
! } // task doSendQuery()
!
/**
* Execute a directory operation.
***************
*** 202,237 ****
* @return SUCCESS If the operation is being perfomed.
*/
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
// Change the context's state to WAITING. This prevents the VM
// from executing the agent.
context->state = AGILLA_STATE_WAITING;
!
// Mutual Exclusion. Only allow one agent to perform
// a remote tuple space operation at a time.
! if (_currAgent != NULL)
{
#if DEBUG_OP_GET_AGENTS
dbg(DBG_USR1, "OPgetAgentsM: execute(): Another agent is performing a directory operation, waiting...\n");
! #endif
!
! context->pc--;
return call QueueI.enqueue(context, &waitQueue, context);
! } else
! {
! AgillaVariable var;
!
dbg(DBG_USR1, "VM (%i:%i): Executing OPgetAllAgents.\n", context->id.id, context->pc-1);
! _currAgent = context;
_num_agents = 0;
!
! // Get the max number of results
! if (call OpStackI.popOperand(_currAgent, &var))
{
if (var.vtype & AGILLA_VAR_V)
_max = var.value.value;
! else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Invalid first parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x13, var.vtype);
--- 209,245 ----
* @return SUCCESS If the operation is being perfomed.
*/
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
// Change the context's state to WAITING. This prevents the VM
// from executing the agent.
context->state = AGILLA_STATE_WAITING;
!
// Mutual Exclusion. Only allow one agent to perform
// a remote tuple space operation at a time.
! if (_currAgent != NULL)
{
#if DEBUG_OP_GET_AGENTS
dbg(DBG_USR1, "OPgetAgentsM: execute(): Another agent is performing a directory operation, waiting...\n");
! #endif
!
! context->pc--;
return call QueueI.enqueue(context, &waitQueue, context);
! } else
! {
! AgillaVariable var;
!
!
dbg(DBG_USR1, "VM (%i:%i): Executing OPgetAllAgents.\n", context->id.id, context->pc-1);
! _currAgent = context;
_num_agents = 0;
!
! // Get the max number of results
! if (call OpStackI.popOperand(_currAgent, &var))
{
if (var.vtype & AGILLA_VAR_V)
_max = var.value.value;
! else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Invalid first parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x13, var.vtype);
***************
*** 240,256 ****
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
// Get the type of agent being searched for
! if (call OpStackI.popOperand(_currAgent, &var))
{
if (var.vtype & AGILLA_VAR_V)
_agent_type = var.value.value;
! else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Invalid second parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x14, var.vtype);
--- 248,264 ----
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
// Get the type of agent being searched for
! if (call OpStackI.popOperand(_currAgent, &var))
{
if (var.vtype & AGILLA_VAR_V)
_agent_type = var.value.value;
! else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Invalid second parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x14, var.vtype);
***************
*** 259,270 ****
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
!
if (!post doSendQuery())
finish(FAIL);
! return SUCCESS;
}
} // BytecodeI.execute
--- 267,278 ----
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
!
if (!post doSendQuery())
finish(FAIL);
! return SUCCESS;
}
} // BytecodeI.execute
***************
*** 273,280 ****
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveResults.receive(TOS_MsgPtr m)
! {
AgillaQueryReplyAllAgentsMsg* reply = (AgillaQueryReplyAllAgentsMsg*)m->data;
!
if (reply->dest == TOS_LOCAL_ADDRESS)
{
--- 281,288 ----
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveResults.receive(TOS_MsgPtr m)
! {
AgillaQueryReplyAllAgentsMsg* reply = (AgillaQueryReplyAllAgentsMsg*)m->data;
!
if (reply->dest == TOS_LOCAL_ADDRESS)
{
***************
*** 284,293 ****
#if DEBUG_OP_GET_AGENTS
! dbg(DBG_USR1, "OPgetAgentsM: Received Results ID = %i, num_agents = %i\n",
! reply->agent_id.id, reply->num_agents);
! #endif
call Timeout.stop();
!
cnAgents = reply->num_agents;
if (reply->num_agents > MAX_AGENT_NUM)
--- 292,301 ----
#if DEBUG_OP_GET_AGENTS
! dbg(DBG_USR1, "OPgetAgentsM: Received Results ID = %i, num_agents = %i\n",
! reply->agent_id.id, reply->num_agents);
! #endif
call Timeout.stop();
!
cnAgents = reply->num_agents;
if (reply->num_agents > MAX_AGENT_NUM)
***************
*** 297,308 ****
for (i = 0; i < cnAgents; i++)
{
! if (_num_agents < _max)
{
#if DEBUG_OP_GET_AGENTS
! dbg(DBG_USR1, "\tagent_info[%i].loc = (%i, %i)\n", i, reply->agent_info[i].loc.x, reply->agent_info[i].loc.y);
! dbg(DBG_USR1, "\tagent_info[%i].agentid = %i\n", i, reply->agent_info[i].agent_id.id);
! #endif
call OpStackI.pushLocation(_currAgent, &reply->agent_info[i].loc);
! call OpStackI.pushAgentID(_currAgent, &reply->agent_info[i].agent_id);
_num_agents++;
}
--- 305,316 ----
for (i = 0; i < cnAgents; i++)
{
! if (_num_agents < _max)
{
#if DEBUG_OP_GET_AGENTS
! dbg(DBG_USR1, "\tagent_info[%i].loc = (%i, %i)\n", i, reply->agent_info[i].loc.x, reply->agent_info[i].loc.y);
! dbg(DBG_USR1, "\tagent_info[%i].agentid = %i\n", i, reply->agent_info[i].agent_id.id);
! #endif
call OpStackI.pushLocation(_currAgent, &reply->agent_info[i].loc);
! call OpStackI.pushAgentID(_currAgent, &reply->agent_info[i].agent_id);
_num_agents++;
}
***************
*** 314,319 ****
call OpStackI.pushValue(_currAgent, _num_agents);
finish(SUCCESS);
! } else
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_NUM_AGENTS);
}
} else
--- 322,327 ----
call OpStackI.pushValue(_currAgent, _num_agents);
finish(SUCCESS);
! } else
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_NUM_AGENTS);
}
} else
***************
*** 321,345 ****
// forward the results to the node closest to the destination
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
uint16_t oneHopDest = reply->dest;
!
#if ENABLE_GRID_ROUTING
call NeighborListI.getClosestNeighbor(&oneHopDest);
#endif
!
*msg = *m;
if (!call SendResults.send(oneHopDest, sizeof(AgillaQueryReplyAllAgentsMsg), msg))
call MessageBufferI.freeMsg(msg);
! }
}
return m;
} // ReceiveResults
!
! event result_t Timeout.fired()
! {
#if DEBUG_OP_GET_AGENTS
! dbg(DBG_USR1, "OPgetAgentsM: ERROR: Timed out while waiting for results.\n");
! #endif
finish(_max == _num_agents);
return SUCCESS;
--- 329,353 ----
// forward the results to the node closest to the destination
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
uint16_t oneHopDest = reply->dest;
!
#if ENABLE_GRID_ROUTING
call NeighborListI.getClosestNeighbor(&oneHopDest);
#endif
!
*msg = *m;
if (!call SendResults.send(oneHopDest, sizeof(AgillaQueryReplyAllAgentsMsg), msg))
call MessageBufferI.freeMsg(msg);
! }
}
return m;
} // ReceiveResults
!
! event result_t Timeout.fired()
! {
#if DEBUG_OP_GET_AGENTS
! dbg(DBG_USR1, "OPgetAgentsM: ERROR: Timed out while waiting for results.\n");
! #endif
finish(_max == _num_agents);
return SUCCESS;
***************
*** 349,356 ****
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveRequest.receive(TOS_MsgPtr m)
! {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
*msg = *m;
--- 357,364 ----
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveRequest.receive(TOS_MsgPtr m)
! {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
*msg = *m;
***************
*** 371,375 ****
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
}
--- 379,383 ----
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
}
Index: OPgetClosestAgent.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetClosestAgent.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** OPgetClosestAgent.nc 22 Mar 2006 00:37:08 -0000 1.1
--- OPgetClosestAgent.nc 7 Apr 2006 01:14:53 -0000 1.2
***************
*** 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
*/
***************
*** 52,83 ****
implementation {
components Main, OPgetClosestAgentM, LocationMgrC, AgentMgrC, TupleUtilC;
! components OpStackC, QueueProxy, ErrorMgrProxy, LedsC, NeighborListProxy as NbrList;
components NetworkInterfaceProxy as Comm, AddressMgrC, MessageBufferM;
components TimerC;
!
! BytecodeI = OPgetClosestAgentM;
! Main.StdControl -> OPgetClosestAgentM;
Main.StdControl -> MessageBufferM;
Main.StdControl -> TimerC;
!
! OPgetClosestAgentM.NeighborListI -> NbrList;
! OPgetClosestAgentM.LocationMgrI -> LocationMgrC;
!
! OPgetClosestAgentM.SendRequest -> Comm.SendMsg[AM_AGILLAQUERYNEARESTAGENTMSG];
! OPgetClosestAgentM.ReceiveRequest -> Comm.ReceiveMsg[AM_AGILLAQUERYNEARESTAGENTMSG];
!
! OPgetClosestAgentM.SendResults -> Comm.SendMsg[AM_AGILLAQUERYREPLYNEARESTAGENTMSG];
! OPgetClosestAgentM.ReceiveResults -> Comm.ReceiveMsg[AM_AGILLAQUERYREPLYNEARESTAGENTMSG];
!
! OPgetClosestAgentM.MessageBufferI -> MessageBufferM;
! OPgetClosestAgentM.AddressMgrI -> AddressMgrC;
! OPgetClosestAgentM.AgentMgrI -> AgentMgrC;
! OPgetClosestAgentM.TupleUtilI -> TupleUtilC;
! OPgetClosestAgentM.OpStackI -> OpStackC;
! OPgetClosestAgentM.QueueI -> QueueProxy;
! OPgetClosestAgentM.ErrorMgrI -> ErrorMgrProxy;
! OPgetClosestAgentM.Leds -> LedsC;
! OPgetClosestAgentM.Timeout -> TimerC.Timer[unique("Timer")];
}
--- 52,96 ----
implementation {
components Main, OPgetClosestAgentM, LocationMgrC, AgentMgrC, TupleUtilC;
! components OpStackC, QueueProxy, ErrorMgrProxy, LedsC;
components NetworkInterfaceProxy as Comm, AddressMgrC, MessageBufferM;
components TimerC;
! #if ENABLE_CLUSTERING
! components ClusterheadDirectoryM;
! components NeighborListM as NbrList;
! components OPgetClosestAgentCM as OPgetClosestAgent;
! #else
! components NeighborListProxy as NbrList;
! components OPgetClosestAgentM as OPgetClosestAgent;
! #endif
! BytecodeI = OPgetClosestAgent;
!
! Main.StdControl -> OPgetClosestAgent;
Main.StdControl -> MessageBufferM;
Main.StdControl -> TimerC;
!
! OPgetClosestAgent.NeighborListI -> NbrList;
! OPgetClosestAgent.LocationMgrI -> LocationMgrC;
!
! OPgetClosestAgent.SendRequest -> Comm.SendMsg[AM_AGILLAQUERYNEARESTAGENTMSG];
! OPgetClosestAgent.ReceiveRequest -> Comm.ReceiveMsg[AM_AGILLAQUERYNEARESTAGENTMSG];
!
! OPgetClosestAgent.SendResults -> Comm.SendMsg[AM_AGILLAQUERYREPLYNEARESTAGENTMSG];
! OPgetClosestAgent.ReceiveResults -> Comm.ReceiveMsg[AM_AGILLAQUERYREPLYNEARESTAGENTMSG];
!
! OPgetClosestAgent.MessageBufferI -> MessageBufferM;
! OPgetClosestAgent.AddressMgrI -> AddressMgrC;
! OPgetClosestAgent.AgentMgrI -> AgentMgrC;
! OPgetClosestAgent.TupleUtilI -> TupleUtilC;
! OPgetClosestAgent.OpStackI -> OpStackC;
! OPgetClosestAgent.QueueI -> QueueProxy;
! OPgetClosestAgent.ErrorMgrI -> ErrorMgrProxy;
! OPgetClosestAgent.Leds -> LedsC;
! OPgetClosestAgent.Timeout -> TimerC.Timer[unique("Timer")];
!
! #if ENABLE_CLUSTERING
! OPgetClosestAgent.ClusteringI -> NbrList;
! OPgetClosestAgent.ClusterheadDirectoryI -> ClusterheadDirectoryM;
! #endif
}
Index: OPgetClosestAgentM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetClosestAgentM.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** OPgetClosestAgentM.nc 5 Apr 2006 18:04:39 -0000 1.7
--- OPgetClosestAgentM.nc 7 Apr 2006 01:14:53 -0000 1.8
***************
*** 2,37 ****
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2006, 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) 2006, 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
*/
***************
*** 51,64 ****
interface StdControl;
}
! uses {
interface NeighborListI;
interface LocationMgrI;
!
interface SendMsg as SendRequest;
interface ReceiveMsg as ReceiveRequest; // for routing
!
interface ReceiveMsg as ReceiveResults;
interface SendMsg as SendResults; // for routing
!
interface MessageBufferI;
interface AddressMgrI;
--- 51,64 ----
interface StdControl;
}
! uses {
interface NeighborListI;
interface LocationMgrI;
!
interface SendMsg as SendRequest;
interface ReceiveMsg as ReceiveRequest; // for routing
!
interface ReceiveMsg as ReceiveResults;
interface SendMsg as SendResults; // for routing
!
interface MessageBufferI;
interface AddressMgrI;
***************
*** 66,73 ****
interface TupleUtilI;
interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
interface Timer as Timeout;
! interface Leds; // debug
}
}
--- 66,73 ----
interface TupleUtilI;
interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
interface Timer as Timeout;
! interface Leds; // debug
}
}
***************
*** 82,113 ****
* the current agent finishes.
*/
! AgillaAgentContext* _currAgent;
!
/**
! * Holds pending agents that are waiting for the current agent
* to finish.
*/
Queue waitQueue;
!
/**
* A running counter for the query id.
*/
uint8_t _qid;
!
/**
* The location parameter. (Find the agent closest to this location.)
*/
//AgillaLocation _loc;
!
/**
* The type of the agent being searched for.
*/
! uint16_t _agent_type;
! command result_t StdControl.init()
! {
! _currAgent = NULL;
_qid = 0;
! call QueueI.init(&waitQueue);
return SUCCESS;
}
--- 82,118 ----
* the current agent finishes.
*/
! AgillaAgentContext* _currAgent;
!
/**
! * Holds pending agents that are waiting for the current agent
* to finish.
*/
Queue waitQueue;
!
/**
* A running counter for the query id.
*/
uint8_t _qid;
!
/**
* The location parameter. (Find the agent closest to this location.)
*/
//AgillaLocation _loc;
!
/**
* The type of the agent being searched for.
*/
! uint16_t _agent_type;
! /**
! * The type of the agent being searched for.
! */
! uint16_t _agent_type;
!
! command result_t StdControl.init()
! {
! _currAgent = NULL;
_qid = 0;
! call QueueI.init(&waitQueue);
return SUCCESS;
}
***************
*** 126,142 ****
call AgentMgrI.run(_currAgent);
_currAgent = NULL;
!
// If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
{
#if DEBUG_OP_GET_CLOSEST_AGENT
dbg(DBG_USR1, "OPgetClosestAgentM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
}
return SUCCESS;
} // finish()
!
/**
--- 131,147 ----
call AgentMgrI.run(_currAgent);
_currAgent = NULL;
!
// If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
{
#if DEBUG_OP_GET_CLOSEST_AGENT
dbg(DBG_USR1, "OPgetClosestAgentM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
}
return SUCCESS;
} // finish()
!
/**
***************
*** 145,172 ****
* is forwarded to the UART.
*/
! inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
if (call AddressMgrI.isGW())
{
#if DEBUG_OP_GET_CLOSEST_AGENT
dbg(DBG_USR1, "OPgetClosestAgentM: sendQueryMsg(): Sending query message to the BS\n");
! #endif
return call SendRequest.send(TOS_UART_ADDR, sizeof(AgillaQueryNearestAgentMsg), msg);
} else
{
uint16_t onehop_dest;
!
// Get the one-hop neighbor that is closest to the gateway.
// If there is no known gateway, abort.
! if (call NeighborListI.getGW(&onehop_dest) == NO_GW)
{
! dbg(DBG_USR1, "OPgetClosestAgentM: ERROR: No neighbor closer to a gateway.\n");
return FAIL;
}
!
return call SendRequest.send(onehop_dest, sizeof(AgillaQueryNearestAgentMsg), msg);
}
} // sendQueryMsg()
!
/**
* Starts the sending of a location update message.
--- 150,177 ----
* is forwarded to the UART.
*/
! inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
if (call AddressMgrI.isGW())
{
#if DEBUG_OP_GET_CLOSEST_AGENT
dbg(DBG_USR1, "OPgetClosestAgentM: sendQueryMsg(): Sending query message to the BS\n");
! #endif
return call SendRequest.send(TOS_UART_ADDR, sizeof(AgillaQueryNearestAgentMsg), msg);
} else
{
uint16_t onehop_dest;
!
// Get the one-hop neighbor that is closest to the gateway.
// If there is no known gateway, abort.
! if (call NeighborListI.getGW(&onehop_dest) == NO_GW)
{
! dbg(DBG_USR1, "OPgetClosestAgentM: ERROR: No neighbor closer to a gateway.\n");
return FAIL;
}
!
return call SendRequest.send(onehop_dest, sizeof(AgillaQueryNearestAgentMsg), msg);
}
} // sendQueryMsg()
!
/**
* Starts the sending of a location update message.
***************
*** 175,194 ****
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaQueryNearestAgentMsg *qMsg = (struct AgillaQueryNearestAgentMsg *)msg->data;
qMsg->agent_id = _currAgent->id;
qMsg->src = TOS_LOCAL_ADDRESS;
qMsg->dest = TOS_UART_ADDR;
! qMsg->qid = _qid++;
call LocationMgrI.getLocation(TOS_LOCAL_ADDRESS, &qMsg->loc);
qMsg->agent_type = _agent_type;
! if (!sendQueryMsg(msg))
call MessageBufferI.freeMsg(msg);
else
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_NUM_AGENTS);
}
! } // task doSendQuery()
!
/**
* Execute a directory operation.
--- 180,202 ----
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
!
! if (msg != NULL)
{
+
struct AgillaQueryNearestAgentMsg *qMsg = (struct AgillaQueryNearestAgentMsg *)msg->data;
qMsg->agent_id = _currAgent->id;
qMsg->src = TOS_LOCAL_ADDRESS;
qMsg->dest = TOS_UART_ADDR;
! qMsg->qid = ((TOS_LOCAL_ADDRESS & 0xff) << 8) | _qid++;
call LocationMgrI.getLocation(TOS_LOCAL_ADDRESS, &qMsg->loc);
qMsg->agent_type = _agent_type;
! if (!sendQueryMsg(msg))
!
call MessageBufferI.freeMsg(msg);
else
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_NUM_AGENTS);
}
! } // task doSendQuery()
!
/**
* Execute a directory operation.
***************
*** 198,232 ****
* @return SUCCESS If the operation is being perfomed.
*/
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
// Change the context's state to WAITING. This prevents the VM
// from executing the agent.
context->state = AGILLA_STATE_WAITING;
!
// Mutual Exclusion. Only allow one agent to perform
// a remote tuple space operation at a time.
! if (_currAgent != NULL)
{
#if DEBUG_OP_GET_CLOSEST_AGENT
dbg(DBG_USR1, "OPgetClosestAgentM: execute(): Another agent is performing a directory operation, waiting...\n");
! #endif
!
! context->pc--;
return call QueueI.enqueue(context, &waitQueue, context);
} else
! {
! AgillaVariable var;
!
dbg(DBG_USR1, "VM (%i:%i): Executing OPgetClosestAgent.\n", context->id.id, context->pc-1);
! _currAgent = context;
! // Get the location
! /*if (call OpStackI.popOperand(_currAgent, &var))
! {
if (var.vtype & AGILLA_VAR_L)
_loc = var.loc;
! else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetlocationM: ERROR: Invalid parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x12, var.vtype);
--- 206,241 ----
* @return SUCCESS If the operation is being perfomed.
*/
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
// Change the context's state to WAITING. This prevents the VM
// from executing the agent.
context->state = AGILLA_STATE_WAITING;
!
// Mutual Exclusion. Only allow one agent to perform
// a remote tuple space operation at a time.
! if (_currAgent != NULL)
{
#if DEBUG_OP_GET_CLOSEST_AGENT
dbg(DBG_USR1, "OPgetClosestAgentM: execute(): Another agent is performing a directory operation, waiting...\n");
! #endif
!
! context->pc--;
return call QueueI.enqueue(context, &waitQueue, context);
} else
! {
! AgillaVariable var;
!
!
dbg(DBG_USR1, "VM (%i:%i): Executing OPgetClosestAgent.\n", context->id.id, context->pc-1);
! _currAgent = context;
! // Get the location
! /*if (call OpStackI.popOperand(_currAgent, &var))
! {
if (var.vtype & AGILLA_VAR_L)
_loc = var.loc;
! else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetlocationM: ERROR: Invalid parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x12, var.vtype);
***************
*** 235,251 ****
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetlocationM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
}*/
!
// Get the type of agent being searched for
! if (call OpStackI.popOperand(_currAgent, &var))
{
if (var.vtype & AGILLA_VAR_V)
_agent_type = var.value.value;
! else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Invalid agent_type parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x15, var.vtype);
--- 244,260 ----
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetlocationM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
}*/
!
// Get the type of agent being searched for
! if (call OpStackI.popOperand(_currAgent, &var))
{
if (var.vtype & AGILLA_VAR_V)
_agent_type = var.value.value;
! else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Invalid agent_type parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x15, var.vtype);
***************
*** 254,265 ****
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
!
if (!post doSendQuery())
finish(FAIL);
! return SUCCESS;
}
} // BytecodeI.execute
--- 263,274 ----
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
!
if (!post doSendQuery())
finish(FAIL);
! return SUCCESS;
}
} // BytecodeI.execute
***************
*** 268,298 ****
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveResults.receive(TOS_MsgPtr m)
! {
AgillaQueryReplyNearestAgentMsg* reply = (AgillaQueryReplyNearestAgentMsg*)m->data;
!
if (reply->dest == TOS_LOCAL_ADDRESS)
! {
if (_currAgent != NULL && _currAgent->id.id == reply->agent_id.id)
! {
#if DEBUG_OP_GET_CLOSEST_AGENT
! dbg(DBG_USR1, "OPgetClosestAgentM: Received Results ID = %i, (%i, %i)\n",
! reply->agent_id.id, reply->loc.x, reply->loc.y);
! #endif
call Timeout.stop();
! // If no nearest agent is found, set condition code to be 0.
! if (reply->nearest_agent_loc.x == 0 && reply->nearest_agent_loc.y == 0 &&
! reply->nearest_agent_id.id == 0)
! {
! finish(FAIL);
! } else
! {
! // push the results onto the stack
! call OpStackI.pushLocation(_currAgent, &reply->nearest_agent_loc);
! call OpStackI.pushAgentID(_currAgent, &reply->nearest_agent_id);
! finish(SUCCESS);
! }
}
} else
--- 277,300 ----
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveResults.receive(TOS_MsgPtr m)
! {
AgillaQueryReplyNearestAgentMsg* reply = (AgillaQueryReplyNearestAgentMsg*)m->data;
!
if (reply->dest == TOS_LOCAL_ADDRESS)
! {
if (_currAgent != NULL && _currAgent->id.id == reply->agent_id.id)
! {
#if DEBUG_OP_GET_CLOSEST_AGENT
! dbg(DBG_USR1, "OPgetClosestAgentM: Received Results ID = %i, (%i, %i)\n",
! reply->nearest_agent_id.id, reply->nearest_agent_loc.x, reply->nearest_agent_loc.y);
! #endif
call Timeout.stop();
! // push the results onto the stack
! call OpStackI.pushLocation(_currAgent, &reply->nearest_agent_loc);
! call OpStackI.pushAgentID(_currAgent, &reply->nearest_agent_id);
! finish(SUCCESS);
!
}
} else
***************
*** 300,324 ****
// forward the results to the node closest to the destination
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
uint16_t oneHopDest = reply->dest;
!
#if ENABLE_GRID_ROUTING
call NeighborListI.getClosestNeighbor(&oneHopDest);
#endif
!
*msg = *m;
if (!call SendResults.send(oneHopDest, sizeof(AgillaQueryReplyNearestAgentMsg), msg))
call MessageBufferI.freeMsg(msg);
! }
}
return m;
} // ReceiveResults
!
! event result_t Timeout.fired()
! {
#if DEBUG_OP_GET_CLOSEST_AGENT
! dbg(DBG_USR1, "OPgetClosestAgentM: ERROR: Timed out while waiting for results.\n");
! #endif
finish(FAIL);
return SUCCESS;
--- 302,326 ----
// forward the results to the node closest to the destination
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
uint16_t oneHopDest = reply->dest;
!
#if ENABLE_GRID_ROUTING
call NeighborListI.getClosestNeighbor(&oneHopDest);
#endif
!
*msg = *m;
if (!call SendResults.send(oneHopDest, sizeof(AgillaQueryReplyNearestAgentMsg), msg))
call MessageBufferI.freeMsg(msg);
! }
}
return m;
} // ReceiveResults
!
! event result_t Timeout.fired()
! {
#if DEBUG_OP_GET_CLOSEST_AGENT
! dbg(DBG_USR1, "OPgetClosestAgentM: ERROR: Timed out while waiting for results.\n");
! #endif
finish(FAIL);
return SUCCESS;
***************
*** 328,336 ****
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveRequest.receive(TOS_MsgPtr m)
! {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
*msg = *m;
if (!sendQueryMsg(msg))
--- 330,339 ----
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveRequest.receive(TOS_MsgPtr m)
! {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
+
*msg = *m;
if (!sendQueryMsg(msg))
***************
*** 350,354 ****
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
}
--- 353,357 ----
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
}
Index: OPgetNumAgents.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetNumAgents.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** OPgetNumAgents.nc 20 Mar 2006 21:03:30 -0000 1.1
--- OPgetNumAgents.nc 7 Apr 2006 01:14:53 -0000 1.2
***************
*** 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
*/
***************
*** 51,83 ****
}
implementation {
! components Main, OPgetNumAgentsM, LocationMgrC, AgentMgrC, TupleUtilC;
! components OpStackC, QueueProxy, ErrorMgrProxy, LedsC, NeighborListProxy as NbrList;
components NetworkInterfaceProxy as Comm, AddressMgrC, MessageBufferM;
components TimerC;
!
! BytecodeI = OPgetNumAgentsM;
! Main.StdControl -> OPgetNumAgentsM;
Main.StdControl -> MessageBufferM;
Main.StdControl -> TimerC;
!
! OPgetNumAgentsM.NeighborListI -> NbrList;
! OPgetNumAgentsM.LocationMgrI -> LocationMgrC;
!
! OPgetNumAgentsM.SendRequest -> Comm.SendMsg[AM_AGILLAQUERYNUMAGENTSMSG];
! OPgetNumAgentsM.ReceiveRequest -> Comm.ReceiveMsg[AM_AGILLAQUERYNUMAGENTSMSG];
!
! OPgetNumAgentsM.SendResults -> Comm.SendMsg[AM_AGILLAQUERYREPLYNUMAGENTSMSG];
! OPgetNumAgentsM.ReceiveResults -> Comm.ReceiveMsg[AM_AGILLAQUERYREPLYNUMAGENTSMSG];
!
! OPgetNumAgentsM.MessageBufferI -> MessageBufferM;
! OPgetNumAgentsM.AddressMgrI -> AddressMgrC;
! OPgetNumAgentsM.AgentMgrI -> AgentMgrC;
! OPgetNumAgentsM.TupleUtilI -> TupleUtilC;
! OPgetNumAgentsM.OpStackI -> OpStackC;
! OPgetNumAgentsM.QueueI -> QueueProxy;
! OPgetNumAgentsM.ErrorMgrI -> ErrorMgrProxy;
! OPgetNumAgentsM.Leds -> LedsC;
! OPgetNumAgentsM.Timeout -> TimerC.Timer[unique("Timer")];
}
--- 51,93 ----
}
implementation {
! components Main, LocationMgrC, AgentMgrC, TupleUtilC;
! components OpStackC, QueueProxy, ErrorMgrProxy, LedsC;
components NetworkInterfaceProxy as Comm, AddressMgrC, MessageBufferM;
components TimerC;
! #if ENABLE_CLUSTERING
! components NeighborListM as NbrList;
! components OPgetNumAgentsCM as OPgetNumAgents;
! #else
! components NeighborListProxy as NbrList;
! components OPgetNumAgentsM as OPgetNumAgents;
! #endif
! BytecodeI = OPgetNumAgents;
!
! Main.StdControl -> OPgetNumAgents;
Main.StdControl -> MessageBufferM;
Main.StdControl -> TimerC;
!
! OPgetNumAgents.NeighborListI -> NbrList;
! #if ENABLE_CLUSTERING
! OPgetNumAgents.ClusteringI -> NbrList;
! #endif
! OPgetNumAgents.LocationMgrI -> LocationMgrC;
!
! OPgetNumAgents.SendRequest -> Comm.SendMsg[AM_AGILLAQUERYNUMAGENTSMSG];
! OPgetNumAgents.ReceiveRequest -> Comm.ReceiveMsg[AM_AGILLAQUERYNUMAGENTSMSG];
!
! OPgetNumAgents.SendResults -> Comm.SendMsg[AM_AGILLAQUERYREPLYNUMAGENTSMSG];
! OPgetNumAgents.ReceiveResults -> Comm.ReceiveMsg[AM_AGILLAQUERYREPLYNUMAGENTSMSG];
!
! OPgetNumAgents.MessageBufferI -> MessageBufferM;
! OPgetNumAgents.AddressMgrI -> AddressMgrC;
! OPgetNumAgents.AgentMgrI -> AgentMgrC;
! OPgetNumAgents.TupleUtilI -> TupleUtilC;
! OPgetNumAgents.OpStackI -> OpStackC;
! OPgetNumAgents.QueueI -> QueueProxy;
! OPgetNumAgents.ErrorMgrI -> ErrorMgrProxy;
! OPgetNumAgents.Leds -> LedsC;
! OPgetNumAgents.Timeout -> TimerC.Timer[unique("Timer")];
}
Index: OPgetNumAgentsM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetNumAgentsM.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** OPgetNumAgentsM.nc 5 Apr 2006 18:04:39 -0000 1.5
--- OPgetNumAgentsM.nc 7 Apr 2006 01:14:53 -0000 1.6
***************
*** 2,37 ****
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2006, 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) 2006, 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
*/
***************
*** 51,64 ****
interface StdControl;
}
! uses {
interface NeighborListI;
interface LocationMgrI;
!
interface SendMsg as SendRequest;
interface ReceiveMsg as ReceiveRequest; // for routing
!
interface ReceiveMsg as ReceiveResults;
interface SendMsg as SendResults; // for routing
!
interface MessageBufferI;
interface AddressMgrI;
--- 51,64 ----
interface StdControl;
}
! uses {
interface NeighborListI;
interface LocationMgrI;
!
interface SendMsg as SendRequest;
interface ReceiveMsg as ReceiveRequest; // for routing
!
interface ReceiveMsg as ReceiveResults;
interface SendMsg as SendResults; // for routing
!
interface MessageBufferI;
interface AddressMgrI;
***************
*** 66,73 ****
interface TupleUtilI;
interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
interface Timer as Timeout;
! interface Leds; // debug
}
}
--- 66,73 ----
interface TupleUtilI;
interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
interface Timer as Timeout;
! interface Leds; // debug
}
}
***************
*** 82,98 ****
* the current agent finishes.
*/
! AgillaAgentContext* _currAgent;
!
/**
! * Holds pending agents that are waiting for the current agent
* to finish.
*/
Queue waitQueue;
!
/**
* A running counter for the query id.
*/
uint8_t _qid;
!
/**
* The type of the agent being searched for.
--- 82,98 ----
* the current agent finishes.
*/
! AgillaAgentContext* _currAgent;
!
/**
! * Holds pending agents that are waiting for the current agent
* to finish.
*/
Queue waitQueue;
!
/**
* A running counter for the query id.
*/
uint8_t _qid;
!
/**
* The type of the agent being searched for.
***************
*** 101,109 ****
! command result_t StdControl.init()
! {
! _currAgent = NULL;
_qid = 0;
! call QueueI.init(&waitQueue);
return SUCCESS;
}
--- 101,115 ----
! /**
! * The type of the agent being searched for.
! */
! uint16_t _agent_type;
!
!
! command result_t StdControl.init()
! {
! _currAgent = NULL;
_qid = 0;
! call QueueI.init(&waitQueue);
return SUCCESS;
}
***************
*** 122,138 ****
call AgentMgrI.run(_currAgent);
_currAgent = NULL;
!
// If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
{
#if DEBUG_OP_GETNUMAGENTS
dbg(DBG_USR1, "OPgetNumAgentsM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
}
return SUCCESS;
} // finish()
!
/**
--- 128,144 ----
call AgentMgrI.run(_currAgent);
_currAgent = NULL;
!
// If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
{
#if DEBUG_OP_GETNUMAGENTS
dbg(DBG_USR1, "OPgetNumAgentsM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
}
return SUCCESS;
} // finish()
!
/**
***************
*** 141,168 ****
* is forwarded to the UART.
*/
! inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
if (call AddressMgrI.isGW())
{
#if DEBUG_OP_GETNUMAGENTS
dbg(DBG_USR1, "OPgetNumAgentsM: sendQueryMsg(): Sending query message to the BS\n");
! #endif
return call SendRequest.send(TOS_UART_ADDR, sizeof(AgillaQueryNumAgentsMsg), msg);
} else
{
uint16_t onehop_dest;
!
// Get the one-hop neighbor that is closest to the gateway.
// If there is no known gateway, abort.
! if (call NeighborListI.getGW(&onehop_dest) == NO_GW)
{
! dbg(DBG_USR1, "OPgetNumAgentsM: ERROR: No neighbor closer to a gateway.\n");
return FAIL;
}
!
return call SendRequest.send(onehop_dest, sizeof(AgillaQueryNumAgentsMsg), msg);
}
} // sendQueryMsg()
!
/**
* Starts the sending of a location update message.
--- 147,174 ----
* is forwarded to the UART.
*/
! inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
if (call AddressMgrI.isGW())
{
#if DEBUG_OP_GETNUMAGENTS
dbg(DBG_USR1, "OPgetNumAgentsM: sendQueryMsg(): Sending query message to the BS\n");
! #endif
return call SendRequest.send(TOS_UART_ADDR, sizeof(AgillaQueryNumAgentsMsg), msg);
} else
{
uint16_t onehop_dest;
!
// Get the one-hop neighbor that is closest to the gateway.
// If there is no known gateway, abort.
! if (call NeighborListI.getGW(&onehop_dest) == NO_GW)
{
! dbg(DBG_USR1, "OPgetNumAgentsM: ERROR: No neighbor closer to a gateway.\n");
return FAIL;
}
!
return call SendRequest.send(onehop_dest, sizeof(AgillaQueryNumAgentsMsg), msg);
}
} // sendQueryMsg()
!
/**
* Starts the sending of a location update message.
***************
*** 171,175 ****
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaQueryNumAgentsMsg *qMsg = (struct AgillaQueryNumAgentsMsg *)msg->data;
--- 177,181 ----
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaQueryNumAgentsMsg *qMsg = (struct AgillaQueryNumAgentsMsg *)msg->data;
***************
*** 177,190 ****
qMsg->src = TOS_LOCAL_ADDRESS;
qMsg->dest = TOS_UART_ADDR;
! qMsg->qid = _qid++;
qMsg->agent_type = _agent_type;
!
! if (!sendQueryMsg(msg))
call MessageBufferI.freeMsg(msg);
else
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_NUM_AGENTS);
}
! } // task doSendQuery()
!
/**
* Execute a directory operation.
--- 183,198 ----
qMsg->src = TOS_LOCAL_ADDRESS;
qMsg->dest = TOS_UART_ADDR;
!
! qMsg->qid = ((TOS_LOCAL_ADDRESS & 0xff) << 8) | _qid++;
qMsg->agent_type = _agent_type;
!
! if (!sendQueryMsg(msg))
!
call MessageBufferI.freeMsg(msg);
else
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_NUM_AGENTS);
}
! } // task doSendQuery()
!
/**
* Execute a directory operation.
***************
*** 194,228 ****
* @return SUCCESS If the operation is being perfomed.
*/
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
// Change the context's state to WAITING. This prevents the VM
// from executing the agent.
context->state = AGILLA_STATE_WAITING;
!
// Mutual Exclusion. Only allow one agent to perform
// a remote tuple space operation at a time.
! if (_currAgent != NULL)
{
#if DEBUG_OP_GETNUMAGENTS
dbg(DBG_USR1, "OPgetNumAgentsM: execute(): Another agent is performing a directory operation, waiting...\n");
! #endif
!
! context->pc--;
return call QueueI.enqueue(context, &waitQueue, context);
} else
! {
! AgillaVariable var;
!
! dbg(DBG_USR1, "VM (%i:%i): Executing OPgetNumAgents.\n", context->id.id, context->pc-1);
_currAgent = context;
!
// Get the type of agent being searched for
! if (call OpStackI.popOperand(_currAgent, &var))
{
if (var.vtype & AGILLA_VAR_V)
_agent_type = var.value.value;
! else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Invalid agent_type parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x14, var.vtype);
--- 202,237 ----
* @return SUCCESS If the operation is being perfomed.
*/
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
// Change the context's state to WAITING. This prevents the VM
// from executing the agent.
context->state = AGILLA_STATE_WAITING;
!
// Mutual Exclusion. Only allow one agent to perform
// a remote tuple space operation at a time.
! if (_currAgent != NULL)
{
#if DEBUG_OP_GETNUMAGENTS
dbg(DBG_USR1, "OPgetNumAgentsM: execute(): Another agent is performing a directory operation, waiting...\n");
! #endif
!
! context->pc--;
return call QueueI.enqueue(context, &waitQueue, context);
} else
!
! {
! AgillaVariable var;
!
! dbg(DBG_USR1, "VM (%i:%i): Executing OPgetNumAgents.\n", context->id.id, context->pc-1);
_currAgent = context;
!
// Get the type of agent being searched for
! if (call OpStackI.popOperand(_currAgent, &var))
{
if (var.vtype & AGILLA_VAR_V)
_agent_type = var.value.value;
! else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Invalid agent_type parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x14, var.vtype);
***************
*** 231,242 ****
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
!
if (!post doSendQuery())
finish(FAIL);
! return SUCCESS;
}
} // BytecodeI.execute
--- 240,251 ----
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
!
if (!post doSendQuery())
finish(FAIL);
! return SUCCESS;
}
} // BytecodeI.execute
***************
*** 245,259 ****
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveResults.receive(TOS_MsgPtr m)
! {
AgillaQueryReplyNumAgentsMsg* reply = (AgillaQueryReplyNumAgentsMsg*)m->data;
!
if (reply->dest == TOS_LOCAL_ADDRESS)
! {
if (_currAgent != NULL && _currAgent->id.id == reply->agent_id.id)
! {
#if DEBUG_OP_GETNUMAGENTS
! dbg(DBG_USR1, "OPgetNumAgentsM: Received Results num agents = %i.\n", reply->num_agents);
! #endif
call Timeout.stop();
--- 254,268 ----
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveResults.receive(TOS_MsgPtr m)
! {
AgillaQueryReplyNumAgentsMsg* reply = (AgillaQueryReplyNumAgentsMsg*)m->data;
!
if (reply->dest == TOS_LOCAL_ADDRESS)
! {
if (_currAgent != NULL && _currAgent->id.id == reply->agent_id.id)
! {
#if DEBUG_OP_GETNUMAGENTS
! dbg(DBG_USR1, "OPgetNumAgentsM: Received Results num agents = %i.\n", reply->num_agents);
! #endif
call Timeout.stop();
***************
*** 266,290 ****
// forward the results to the node closest to the destination
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
uint16_t oneHopDest = reply->dest;
!
#if ENABLE_GRID_ROUTING
call NeighborListI.getClosestNeighbor(&oneHopDest);
#endif
!
*msg = *m;
if (!call SendResults.send(oneHopDest, sizeof(AgillaQueryReplyNumAgentsMsg), msg))
call MessageBufferI.freeMsg(msg);
! }
}
return m;
} // ReceiveResults
!
! event result_t Timeout.fired()
! {
#if DEBUG_OP_GETNUMAGENTS
! dbg(DBG_USR1, "OPgetNumAgentsM: ERROR: Timed out while waiting for results.\n");
! #endif
finish(FAIL);
return SUCCESS;
--- 275,299 ----
// forward the results to the node closest to the destination
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
uint16_t oneHopDest = reply->dest;
!
#if ENABLE_GRID_ROUTING
call NeighborListI.getClosestNeighbor(&oneHopDest);
#endif
!
*msg = *m;
if (!call SendResults.send(oneHopDest, sizeof(AgillaQueryReplyNumAgentsMsg), msg))
call MessageBufferI.freeMsg(msg);
! }
}
return m;
} // ReceiveResults
!
! event result_t Timeout.fired()
! {
#if DEBUG_OP_GETNUMAGENTS
! dbg(DBG_USR1, "OPgetNumAgentsM: ERROR: Timed out while waiting for results.\n");
! #endif
finish(FAIL);
return SUCCESS;
***************
*** 294,301 ****
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveRequest.receive(TOS_MsgPtr m)
! {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
*msg = *m;
--- 303,310 ----
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveRequest.receive(TOS_MsgPtr m)
! {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
*msg = *m;
***************
*** 316,320 ****
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
}
--- 325,329 ----
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
}
Index: OPgetlocation.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetlocation.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OPgetlocation.nc 5 Apr 2006 18:04:39 -0000 1.3
--- OPgetlocation.nc 7 Apr 2006 01:14:53 -0000 1.4
***************
*** 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
*/
***************
*** 51,94 ****
}
implementation {
! components Main, OPgetlocationM, LocationMgrC, AgentMgrC, TupleUtilC;
! components OpStackC, QueueProxy, ErrorMgrProxy, LedsC, NeighborListProxy as NbrList;
components NetworkInterfaceProxy as Comm, AddressMgrC, MessageBufferM;
components TimerC;
!
#if ENABLE_EXP_LOGGING
components ExpLoggerC;
components LocalTimeMicroC;
! #endif
!
! BytecodeI = OPgetlocationM;
! Main.StdControl -> OPgetlocationM;
Main.StdControl -> MessageBufferM;
Main.StdControl -> TimerC;
!
!
! OPgetlocationM.NeighborListI -> NbrList;
! OPgetlocationM.LocationMgrI -> LocationMgrC;
!
! OPgetlocationM.SendRequest -> Comm.SendMsg[AM_AGILLAQUERYAGENTLOCMSG];
! OPgetlocationM.ReceiveRequest -> Comm.ReceiveMsg[AM_AGILLAQUERYAGENTLOCMSG];
!
! OPgetlocationM.SendResults -> Comm.SendMsg[AM_AGILLAQUERYREPLYAGENTLOCMSG];
! OPgetlocationM.ReceiveResults -> Comm.ReceiveMsg[AM_AGILLAQUERYREPLYAGENTLOCMSG];
!
! OPgetlocationM.MessageBufferI -> MessageBufferM;
! OPgetlocationM.AddressMgrI -> AddressMgrC;
! OPgetlocationM.AgentMgrI -> AgentMgrC;
! OPgetlocationM.TupleUtilI -> TupleUtilC;
! OPgetlocationM.OpStackI -> OpStackC;
! OPgetlocationM.QueueI -> QueueProxy;
! OPgetlocationM.ErrorMgrI -> ErrorMgrProxy;
! OPgetlocationM.Leds -> LedsC;
! OPgetlocationM.Timeout -> TimerC.Timer[unique("Timer")];
#if ENABLE_EXP_LOGGING
! OPgetlocationM.ExpLoggerI -> ExpLoggerC;
! OPgetlocationM.LocalTime -> LocalTimeMicroC;
! #endif
}
--- 51,112 ----
}
implementation {
! components Main, LocationMgrC, AgentMgrC, TupleUtilC;
! components OpStackC, QueueProxy, ErrorMgrProxy, LedsC;
components NetworkInterfaceProxy as Comm, AddressMgrC, MessageBufferM;
components TimerC;
!
! #if ENABLE_CLUSTERING
! components ClusterheadDirectoryM;
! components NeighborListM as NbrList;
! components OPgetlocationCM as OPgetlocation;
! #else
! components NeighborListProxy as NbrList;
! components OPgetlocationM as OPgetlocation;
! #endif
!
#if ENABLE_EXP_LOGGING
components ExpLoggerC;
components LocalTimeMicroC;
! #endif
! BytecodeI = OPgetlocation;
!
!
!
!
!
! Main.StdControl -> OPgetlocation;
Main.StdControl -> MessageBufferM;
Main.StdControl -> TimerC;
!
! OPgetlocation.NeighborListI -> NbrList;
! OPgetlocation.LocationMgrI -> LocationMgrC;
!
! #if ENABLE_CLUSTERING
! OPgetlocation.ClusteringI -> NbrList;
! OPgetlocation.ClusterheadDirectoryI -> ClusterheadDirectoryM;
! #endif
!
! OPgetlocation.SendRequest -> Comm.SendMsg[AM_AGILLAQUERYAGENTLOCMSG];
! OPgetlocation.ReceiveRequest -> Comm.ReceiveMsg[AM_AGILLAQUERYAGENTLOCMSG];
!
! OPgetlocation.SendResults -> Comm.SendMsg[AM_AGILLAQUERYREPLYAGENTLOCMSG];
! OPgetlocation.ReceiveResults -> Comm.ReceiveMsg[AM_AGILLAQUERYREPLYAGENTLOCMSG];
!
! OPgetlocation.MessageBufferI -> MessageBufferM;
! OPgetlocation.AddressMgrI -> AddressMgrC;
! OPgetlocation.AgentMgrI -> AgentMgrC;
! OPgetlocation.TupleUtilI -> TupleUtilC;
! OPgetlocation.OpStackI -> OpStackC;
! OPgetlocation.QueueI -> QueueProxy;
! OPgetlocation.ErrorMgrI -> ErrorMgrProxy;
! OPgetlocation.Leds -> LedsC;
! OPgetlocation.Timeout -> TimerC.Timer[unique("Timer")];
#if ENABLE_EXP_LOGGING
! OPgetlocation.ExpLoggerI -> ExpLoggerC;
! OPgetlocation.LocalTime -> LocalTimeMicroC;
! #endif
!
}
Index: OPgetlocationM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetlocationM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** OPgetlocationM.nc 5 Apr 2006 18:04:39 -0000 1.6
--- OPgetlocationM.nc 7 Apr 2006 01:14:53 -0000 1.7
***************
*** 2,37 ****
/* Agilla - A middleware for wireless sensor networks.
! * Copyright (C) 2006, 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) 2006, 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
*/
***************
*** 51,64 ****
interface StdControl;
}
! uses {
interface NeighborListI;
interface LocationMgrI;
!
interface SendMsg as SendRequest;
interface ReceiveMsg as ReceiveRequest; // for routing
!
interface ReceiveMsg as ReceiveResults;
interface SendMsg as SendResults; // for routing
!
interface MessageBufferI;
interface AddressMgrI;
--- 51,64 ----
interface StdControl;
}
! uses {
interface NeighborListI;
interface LocationMgrI;
!
interface SendMsg as SendRequest;
interface ReceiveMsg as ReceiveRequest; // for routing
!
interface ReceiveMsg as ReceiveResults;
interface SendMsg as SendResults; // for routing
!
interface MessageBufferI;
interface AddressMgrI;
***************
*** 66,78 ****
interface TupleUtilI;
interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
interface Timer as Timeout;
! interface Leds; // debug
!
#if ENABLE_EXP_LOGGING
interface ExpLoggerI;
! interface LocalTime;
! #endif
}
}
--- 66,78 ----
interface TupleUtilI;
interface OpStackI;
! interface QueueI;
! interface ErrorMgrI;
interface Timer as Timeout;
! interface Leds; // debug
!
#if ENABLE_EXP_LOGGING
interface ExpLoggerI;
! interface LocalTime;
! #endif
}
}
***************
*** 87,103 ****
* the current agent finishes.
*/
! AgillaAgentContext* _currAgent;
!
/**
* The AgentID of the agent being searched for.
*/
AgillaAgentID _aID;
!
/**
! * Holds pending agents that are waiting for the current agent
* to finish.
*/
Queue waitQueue;
!
/**
* A running counter for the query id.
--- 87,103 ----
* the current agent finishes.
*/
! AgillaAgentContext* _currAgent;
!
/**
* The AgentID of the agent being searched for.
*/
AgillaAgentID _aID;
!
/**
! * Holds pending agents that are waiting for the current agent
* to finish.
*/
Queue waitQueue;
!
/**
* A running counter for the query id.
***************
*** 105,117 ****
uint8_t _qid;
#if ENABLE_EXP_LOGGING
uint32_t _start;
! #endif
! command result_t StdControl.init()
! {
! _currAgent = NULL;
_qid = 0;
! call QueueI.init(&waitQueue);
return SUCCESS;
}
--- 105,118 ----
uint8_t _qid;
+
#if ENABLE_EXP_LOGGING
uint32_t _start;
! #endif
! command result_t StdControl.init()
! {
! _currAgent = NULL;
_qid = 0;
! call QueueI.init(&waitQueue);
return SUCCESS;
}
***************
*** 134,155 ****
}
call ExpLoggerI.sendQueryLatency(_start);
! #endif
!
_currAgent->condition = (uint16_t)success;
call AgentMgrI.run(_currAgent);
_currAgent = NULL;
!
// If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
{
#if DEBUG_OP_GETLOCATION
dbg(DBG_USR1, "OPgetlocationM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
}
return SUCCESS;
} // finish()
!
/**
--- 135,156 ----
}
call ExpLoggerI.sendQueryLatency(_start);
! #endif
!
_currAgent->condition = (uint16_t)success;
call AgentMgrI.run(_currAgent);
_currAgent = NULL;
!
// If there are pending agents, execute them
! if (!call QueueI.empty(&waitQueue))
{
#if DEBUG_OP_GETLOCATION
dbg(DBG_USR1, "OPgetlocationM: finish(): WaitQueue (0x%x) not empty, running next agent.\n", &waitQueue);
! #endif
!
! call AgentMgrI.run(call QueueI.dequeue(NULL, &waitQueue));
}
return SUCCESS;
} // finish()
!
/**
***************
*** 158,189 ****
* is forwarded to the UART.
*/
! inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
! #if ENABLE_EXP_LOGGING
! _start = call LocalTime.read();
! #endif
!
if (call AddressMgrI.isGW())
{
#if DEBUG_OP_GETLOCATION
dbg(DBG_USR1, "OPgetLocationM: sendQueryMsg(): Sending query message to the BS\n");
! #endif
return call SendRequest.send(TOS_UART_ADDR, sizeof(AgillaQueryAgentLocMsg), msg);
} else
{
uint16_t onehop_dest;
!
// Get the one-hop neighbor that is closest to the gateway.
// If there is no known gateway, abort.
! if (call NeighborListI.getGW(&onehop_dest) == NO_GW)
{
! dbg(DBG_USR1, "OPgetLocationM: ERROR: No neighbor closer to a gateway.\n");
return FAIL;
}
!
return call SendRequest.send(onehop_dest, sizeof(AgillaQueryAgentLocMsg), msg);
}
} // sendQueryMsg()
!
/**
* Starts the sending of a location update message.
--- 159,188 ----
* is forwarded to the UART.
*/
!
! inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
!
if (call AddressMgrI.isGW())
{
#if DEBUG_OP_GETLOCATION
dbg(DBG_USR1, "OPgetLocationM: sendQueryMsg(): Sending query message to the BS\n");
! #endif
return call SendRequest.send(TOS_UART_ADDR, sizeof(AgillaQueryAgentLocMsg), msg);
} else
{
uint16_t onehop_dest;
!
// Get the one-hop neighbor that is closest to the gateway.
// If there is no known gateway, abort.
! if (call NeighborListI.getGW(&onehop_dest) == NO_GW)
{
! dbg(DBG_USR1, "OPgetLocationM: ERROR: No neighbor closer to a gateway.\n");
return FAIL;
}
!
return call SendRequest.send(onehop_dest, sizeof(AgillaQueryAgentLocMsg), msg);
}
} // sendQueryMsg()
!
/**
* Starts the sending of a location update message.
***************
*** 192,196 ****
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaQueryAgentLocMsg *qMsg = (struct AgillaQueryAgentLocMsg *)msg->data;
--- 191,195 ----
{
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
struct AgillaQueryAgentLocMsg *qMsg = (struct AgillaQueryAgentLocMsg *)msg->data;
***************
*** 198,217 ****
qMsg->src = TOS_LOCAL_ADDRESS;
qMsg->dest = TOS_UART_ADDR;
! qMsg->qid = _qid++;
qMsg->find_agent_id = _aID;
!
! if (!sendQueryMsg(msg))
call MessageBufferI.freeMsg(msg);
else {
#if ENABLE_EXP_LOGGING
! AgillaLocation loc;
loc.x = loc.y = 0;
call ExpLoggerI.sendTrace(_currAgent->id.id, TOS_LOCAL_ADDRESS, QUERY_ISSUED, SUCCESS, loc);
! #endif
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_LOCATION);
}
}
! } // task doSendQuery()
!
/**
* Execute a directory operation.
--- 197,218 ----
qMsg->src = TOS_LOCAL_ADDRESS;
qMsg->dest = TOS_UART_ADDR;
! qMsg->qid = ((TOS_LOCAL_ADDRESS & 0xff) << 8) | _qid++;
qMsg->find_agent_id = _aID;
!
! if (!sendQueryMsg(msg))
call MessageBufferI.freeMsg(msg);
else {
#if ENABLE_EXP_LOGGING
! AgillaLocation loc;
loc.x = loc.y = 0;
call ExpLoggerI.sendTrace(_currAgent->id.id, TOS_LOCAL_ADDRESS, QUERY_ISSUED, SUCCESS, loc);
! _start = call LocalTime.read();
! #endif
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_LOCATION);
}
+
}
! } // task doSendQuery()
!
/**
* Execute a directory operation.
***************
*** 221,257 ****
* @return SUCCESS If the operation is being perfomed.
*/
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
// Change the context's state to WAITING. This prevents the VM
// from executing the agent.
context->state = AGILLA_STATE_WAITING;
!
// Mutual Exclusion. Only allow one agent to perform
// a remote tuple space operation at a time.
! if (_currAgent != NULL)
{
#if DEBUG_OP_GETLOCATION
dbg(DBG_USR1, "OPgetlocationM: execute(): Another agent is performing a directory operation, waiting...\n");
! #endif
!
! context->pc--;
return call QueueI.enqueue(context, &waitQueue, context);
} else
{
AgillaVariable var;
!
_currAgent = context;
!
dbg(DBG_USR1, "VM (%i:%i): Executing OPgetlocation.\n", context->id.id, context->pc-1);
! // Get the AgentID
! if (call OpStackI.popOperand(_currAgent, &var))
! {
! if (var.vtype & AGILLA_VAR_A)
_aID = var.id;
! else if (var.vtype & AGILLA_VAR_V)
! _aID.id = var.value.value;
! else {
! dbg(DBG_USR1, "VM (%i:%i): OPgetlocationM: ERROR: Invalid parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x12, var.vtype);
--- 222,263 ----
* @return SUCCESS If the operation is being perfomed.
*/
! command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context)
! {
// Change the context's state to WAITING. This prevents the VM
// from executing the agent.
context->state = AGILLA_STATE_WAITING;
!
// Mutual Exclusion. Only allow one agent to perform
// a remote tuple space operation at a time.
! if (_currAgent != NULL)
{
#if DEBUG_OP_GETLOCATION
dbg(DBG_USR1, "OPgetlocationM: execute(): Another agent is performing a directory operation, waiting...\n");
! #endif
!
! context->pc--;
return call QueueI.enqueue(context, &waitQueue, context);
} else
{
AgillaVariable var;
!
_currAgent = context;
!
dbg(DBG_USR1, "VM (%i:%i): Executing OPgetlocation.\n", context->id.id, context->pc-1);
! // Get the AgentID
! if (call OpStackI.popOperand(_currAgent, &var))
! {
! if (var.vtype & AGILLA_VAR_A) {
_aID = var.id;
!
! } else if (var.vtype & AGILLA_VAR_V)
! {
! _aID.id = var.value.value;
! }
! else
! {
! dbg(DBG_USR1, "VM (%i:%i): OPgetlocationM: ERROR: Invalid parameter type [%i].\n",
!
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x12, var.vtype);
***************
*** 260,275 ****
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetlocationM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
#if DEBUG_OP_GETLOCATION
! dbg(DBG_USR1, "OPgetlocationM: Searching for agent with ID = %i\n", _aID.id);
! #endif
!
if (!post doSendQuery())
finish(FAIL);
! return SUCCESS;
}
} // BytecodeI.execute
--- 266,281 ----
} else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetlocationM: ERROR: Could not pop parameter off stack.\n",
_currAgent->id.id, _currAgent->pc-1);
return finish(FAIL);
! }
#if DEBUG_OP_GETLOCATION
! dbg(DBG_USR1, "OPgetlocationM: Searching for agent with ID = %i\n", _aID.id);
! #endif
!
if (!post doSendQuery())
finish(FAIL);
! return SUCCESS;
}
} // BytecodeI.execute
***************
*** 278,285 ****
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveResults.receive(TOS_MsgPtr m)
! {
AgillaQueryReplyAgentLocMsg* reply = (AgillaQueryReplyAgentLocMsg*)m->data;
!
if (reply->dest == TOS_LOCAL_ADDRESS)
{
--- 284,291 ----
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveResults.receive(TOS_MsgPtr m)
! {
AgillaQueryReplyAgentLocMsg* reply = (AgillaQueryReplyAgentLocMsg*)m->data;
!
if (reply->dest == TOS_LOCAL_ADDRESS)
{
***************
*** 287,293 ****
{
#if DEBUG_OP_GETLOCATION
! dbg(DBG_USR1, "OPgetlocationM: Received Results (%i, %i)\n", reply->loc.x, reply->loc.y);
! #endif
!
call Timeout.stop();
--- 293,300 ----
{
#if DEBUG_OP_GETLOCATION
!
! dbg(DBG_USR1, "OPgetlocationM: Received Results (%i, %i)\n", reply->loc.x, reply->loc.y);
! #endif
!
call Timeout.stop();
***************
*** 295,303 ****
call OpStackI.pushLocation(_currAgent, &reply->loc);
!
#if ENABLE_EXP_LOGGING
call ExpLoggerI.sendTrace(_currAgent->id.id, TOS_LOCAL_ADDRESS, QUERY_RESULTS_RECEIVED, SUCCESS, reply->loc);
! #endif
!
finish(SUCCESS);
}
--- 302,310 ----
call OpStackI.pushLocation(_currAgent, &reply->loc);
!
#if ENABLE_EXP_LOGGING
call ExpLoggerI.sendTrace(_currAgent->id.id, TOS_LOCAL_ADDRESS, QUERY_RESULTS_RECEIVED, SUCCESS, reply->loc);
! #endif
!
finish(SUCCESS);
}
***************
*** 306,341 ****
// forward the results to the node closest to the destination
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
uint16_t oneHopDest = reply->dest;
!
#if ENABLE_GRID_ROUTING
call NeighborListI.getClosestNeighbor(&oneHopDest);
! #endif
!
#if DEBUG_OP_GETLOCATION
! dbg(DBG_USR1, "OPgetlocationM: Forwarding results to %i\n", oneHopDest);
#endif
!
*msg = *m;
! if (!call SendResults.send(oneHopDest, sizeof(AgillaQueryReplyAgentLocMsg), msg))
call MessageBufferI.freeMsg(msg);
! }
}
return m;
}
!
! event result_t Timeout.fired()
! {
#if ENABLE_EXP_LOGGING
AgillaLocation loc;
! call LocationMgrI.getLocation(TOS_LOCAL_ADDRESS, &loc);
call ExpLoggerI.sendTrace(_currAgent->id.id, TOS_LOCAL_ADDRESS, QUERY_RESULTS_RECEIVED, FAIL, loc);
! #endif
!
#if DEBUG_OP_GETLOCATION
! dbg(DBG_USR1, "OPgetlocationM: ERROR: Timed out while waiting for results.\n");
! #endif
!
finish(FAIL);
return SUCCESS;
--- 313,352 ----
// forward the results to the node closest to the destination
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
uint16_t oneHopDest = reply->dest;
!
#if ENABLE_GRID_ROUTING
call NeighborListI.getClosestNeighbor(&oneHopDest);
! #endif
!
#if DEBUG_OP_GETLOCATION
! dbg(DBG_USR1, "OPgetlocationM: Forwarding results (%i,%i) to %i\n",
! reply->loc.x, reply->loc.y, oneHopDest);
#endif
!
*msg = *m;
! if (!call SendResults.send(oneHopDest, sizeof(AgillaQueryReplyAgentLocMsg), msg)){
call MessageBufferI.freeMsg(msg);
! }
! }
}
return m;
}
!
!
! event result_t Timeout.fired()
! {
#if ENABLE_EXP_LOGGING
AgillaLocation loc;
! call LocationMgrI.getLocation(TOS_LOCAL_ADDRESS, &loc);
call ExpLoggerI.sendTrace(_currAgent->id.id, TOS_LOCAL_ADDRESS, QUERY_RESULTS_RECEIVED, FAIL, loc);
! #endif
!
#if DEBUG_OP_GETLOCATION
!
! dbg(DBG_USR1, "OPgetlocationM: ERROR: Timed out while waiting for results.\n");
! #endif
!
finish(FAIL);
return SUCCESS;
***************
*** 345,352 ****
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveRequest.receive(TOS_MsgPtr m)
! {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
*msg = *m;
--- 356,363 ----
* Bounces a message off this mote.
*/
! event TOS_MsgPtr ReceiveRequest.receive(TOS_MsgPtr m)
! {
TOS_MsgPtr msg = call MessageBufferI.getMsg();
! if (msg != NULL)
{
*msg = *m;
***************
*** 367,371 ****
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
}
--- 378,382 ----
call MessageBufferI.freeMsg(m);
return SUCCESS;
! }
!
}
Index: OPpushc6M.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPpushc6M.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OPpushc6M.nc 6 Feb 2006 09:40:40 -0000 1.2
--- OPpushc6M.nc 7 Apr 2006 01:14:53 -0000 1.3
***************
*** 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 ****
*
*
! * "Copyright (c) 2000-2002 The Regents of the University of California.
* All rights reserved.
*
--- 40,44 ----
*
*
! * "Copyright (c) 2000-2002 The Regents of the University of California.
* All rights reserved.
*
***************
*** 48,52 ****
* notice, the following two paragraphs and the author appear in all
* copies of this software.
! *
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
--- 48,52 ----
* notice, the following two paragraphs and the author appear in all
* copies of this software.
! *
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
***************
*** 54,58 ****
* DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! *
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
--- 54,58 ----
* DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! *
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
***************
*** 64,68 ****
*/
/* tab:4
! *
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
* By downloading, copying, installing or using the software you
--- 64,68 ----
*/
/* tab:4
! *
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
* By downloading, copying, installing or using the software you
***************
*** 70,81 ****
* not download, install, copy or use the software.
*
! * Intel Open Source License
*
! * Copyright (c) 2002 Intel Corporation
! * All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
! *
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
--- 70,81 ----
* not download, install, copy or use the software.
*
! * Intel Open Source License
*
! * Copyright (c) 2002 Intel Corporation
! * All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
! *
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
***************
*** 86,90 ****
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
! *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
--- 86,90 ----
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
! *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
***************
*** 98,109 ****
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! *
! *
*/
! /*
* Authors: Philip Levis <pal at cs.berkeley.edu>
* History: Apr 11, 2003 Inception.
- *
*/
--- 98,108 ----
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! *
! *
*/
! /**
* Authors: Philip Levis <pal at cs.berkeley.edu>
* History: Apr 11, 2003 Inception.
*/
***************
*** 126,136 ****
OP_PUSHC_ARG_MASKM = 0x3f,
} OPpushcConstantsM;
!
!
command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context) {
uint16_t arg = (instr & OP_PUSHC_ARG_MASKM);
dbg(DBG_USR1, "VM (%i:%i): Executing pushc6 with arg %hi\n", context->id.id, context->pc-1, arg);
call OpStackI.pushValue(context, arg);
! // call OpStackI.toString(context);
return SUCCESS;
}
--- 125,135 ----
OP_PUSHC_ARG_MASKM = 0x3f,
} OPpushcConstantsM;
!
!
command result_t BytecodeI.execute(uint8_t instr, AgillaAgentContext* context) {
uint16_t arg = (instr & OP_PUSHC_ARG_MASKM);
dbg(DBG_USR1, "VM (%i:%i): Executing pushc6 with arg %hi\n", context->id.id, context->pc-1, arg);
call OpStackI.pushValue(context, arg);
! //call OpStackI.toString(context);
return SUCCESS;
}
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components/ContextDiscovery
ClusteringI.nc, 1.2, 1.3 NeighborListC.nc, 1.10,
1.11 NeighborListI.nc, 1.4, 1.5 NeighborListM.nc, 1.21,
1.22 NeighborListProxy.nc, 1.2, 1.3
- Next 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
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list