[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/opcodes
OPgetAgentsM.nc, 1.3, 1.4 OPgetClosestAgentM.nc, 1.6,
1.7 OPgetNumAgentsM.nc, 1.4, 1.5 OPgetlocation.nc, 1.2,
1.3 OPgetlocationM.nc, 1.5, 1.6
Chien-Liang Fok
chien-liang at users.sourceforge.net
Wed Apr 5 11:04:51 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv942/opcodes
Modified Files:
OPgetAgentsM.nc OPgetClosestAgentM.nc OPgetNumAgentsM.nc
OPgetlocation.nc OPgetlocationM.nc
Log Message:
Index: OPgetAgentsM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetAgentsM.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OPgetAgentsM.nc 24 Mar 2006 01:29:00 -0000 1.3
--- OPgetAgentsM.nc 5 Apr 2006 18:04:39 -0000 1.4
***************
*** 104,107 ****
--- 104,112 ----
*/
int16_t _num_agents;
+
+ /**
+ * The type of the agent being searched for.
+ */
+ uint16_t _agent_type;
command result_t StdControl.init()
***************
*** 182,185 ****
--- 187,191 ----
qMsg->dest = TOS_UART_ADDR;
qMsg->qid = _qid++;
+ qMsg->agent_type = _agent_type;
if (!sendQueryMsg(msg))
call MessageBufferI.freeMsg(msg);
***************
*** 214,218 ****
} else
{
! AgillaVariable var;
dbg(DBG_USR1, "VM (%i:%i): Executing OPgetAllAgents.\n", context->id.id, context->pc-1);
--- 220,224 ----
} else
{
! AgillaVariable var;
dbg(DBG_USR1, "VM (%i:%i): Executing OPgetAllAgents.\n", context->id.id, context->pc-1);
***************
*** 220,224 ****
_num_agents = 0;
! // Get the location
if (call OpStackI.popOperand(_currAgent, &var))
{
--- 226,230 ----
_num_agents = 0;
! // Get the max number of results
if (call OpStackI.popOperand(_currAgent, &var))
{
***************
*** 227,231 ****
else
{
! dbg(DBG_USR1, "VM (%i:%i): OPgetAgentsM: ERROR: Invalid parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
call ErrorMgrI.error2d(_currAgent, AGILLA_ERROR_INVALID_TYPE, 0x13, var.vtype);
--- 233,237 ----
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);
***************
*** 239,242 ****
--- 245,266 ----
}
+ // 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);
+ return finish(FAIL);
+ }
+ } 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())
Index: OPgetClosestAgentM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetClosestAgentM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** OPgetClosestAgentM.nc 24 Mar 2006 01:29:00 -0000 1.6
--- OPgetClosestAgentM.nc 5 Apr 2006 18:04:39 -0000 1.7
***************
*** 99,102 ****
--- 99,107 ----
*/
//AgillaLocation _loc;
+
+ /**
+ * The type of the agent being searched for.
+ */
+ uint16_t _agent_type;
command result_t StdControl.init()
***************
*** 171,175 ****
TOS_MsgPtr msg = call MessageBufferI.getMsg();
if (msg != NULL)
! {
struct AgillaQueryNearestAgentMsg *qMsg = (struct AgillaQueryNearestAgentMsg *)msg->data;
qMsg->agent_id = _currAgent->id;
--- 176,180 ----
TOS_MsgPtr msg = call MessageBufferI.getMsg();
if (msg != NULL)
! {
struct AgillaQueryNearestAgentMsg *qMsg = (struct AgillaQueryNearestAgentMsg *)msg->data;
qMsg->agent_id = _currAgent->id;
***************
*** 178,181 ****
--- 183,187 ----
qMsg->qid = _qid++;
call LocationMgrI.getLocation(TOS_LOCAL_ADDRESS, &qMsg->loc);
+ qMsg->agent_type = _agent_type;
if (!sendQueryMsg(msg))
call MessageBufferI.freeMsg(msg);
***************
*** 210,213 ****
--- 216,221 ----
} else
{
+ AgillaVariable var;
+
dbg(DBG_USR1, "VM (%i:%i): Executing OPgetClosestAgent.\n", context->id.id, context->pc-1);
_currAgent = context;
***************
*** 231,235 ****
return finish(FAIL);
}*/
!
if (!post doSendQuery())
--- 239,261 ----
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);
! return finish(FAIL);
! }
! } 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())
Index: OPgetNumAgentsM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetNumAgentsM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** OPgetNumAgentsM.nc 24 Mar 2006 01:29:00 -0000 1.4
--- OPgetNumAgentsM.nc 5 Apr 2006 18:04:39 -0000 1.5
***************
*** 94,97 ****
--- 94,103 ----
*/
uint8_t _qid;
+
+ /**
+ * The type of the agent being searched for.
+ */
+ uint16_t _agent_type;
+
command result_t StdControl.init()
***************
*** 172,175 ****
--- 178,182 ----
qMsg->dest = TOS_UART_ADDR;
qMsg->qid = _qid++;
+ qMsg->agent_type = _agent_type;
if (!sendQueryMsg(msg))
***************
*** 205,210 ****
--- 212,239 ----
} 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);
+ return finish(FAIL);
+ }
+ } 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);
Index: OPgetlocation.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetlocation.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OPgetlocation.nc 20 Mar 2006 20:06:40 -0000 1.2
--- OPgetlocation.nc 5 Apr 2006 18:04:39 -0000 1.3
***************
*** 56,59 ****
--- 56,64 ----
components TimerC;
+ #if ENABLE_EXP_LOGGING
+ components ExpLoggerC;
+ components LocalTimeMicroC;
+ #endif
+
BytecodeI = OPgetlocationM;
***************
*** 61,64 ****
--- 66,70 ----
Main.StdControl -> MessageBufferM;
Main.StdControl -> TimerC;
+
OPgetlocationM.NeighborListI -> NbrList;
***************
*** 80,83 ****
--- 86,94 ----
OPgetlocationM.Leds -> LedsC;
OPgetlocationM.Timeout -> TimerC.Timer[unique("Timer")];
+
+ #if ENABLE_EXP_LOGGING
+ OPgetlocationM.ExpLoggerI -> ExpLoggerC;
+ OPgetlocationM.LocalTime -> LocalTimeMicroC;
+ #endif
}
Index: OPgetlocationM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/opcodes/OPgetlocationM.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** OPgetlocationM.nc 24 Mar 2006 01:29:00 -0000 1.5
--- OPgetlocationM.nc 5 Apr 2006 18:04:39 -0000 1.6
***************
*** 70,73 ****
--- 70,78 ----
interface Timer as Timeout;
interface Leds; // debug
+
+ #if ENABLE_EXP_LOGGING
+ interface ExpLoggerI;
+ interface LocalTime;
+ #endif
}
}
***************
*** 100,103 ****
--- 105,112 ----
uint8_t _qid;
+ #if ENABLE_EXP_LOGGING
+ uint32_t _start;
+ #endif
+
command result_t StdControl.init()
{
***************
*** 118,121 ****
--- 127,139 ----
inline result_t finish(result_t success)
{
+ #if ENABLE_EXP_LOGGING
+ if (success) {
+ _start = call LocalTime.read() - _start;
+ } else {
+ _start = 0;
+ }
+ call ExpLoggerI.sendQueryLatency(_start);
+ #endif
+
_currAgent->condition = (uint16_t)success;
call AgentMgrI.run(_currAgent);
***************
*** 141,145 ****
*/
inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
if (call AddressMgrI.isGW())
{
--- 159,167 ----
*/
inline result_t sendQueryMsg(TOS_MsgPtr msg)
! {
! #if ENABLE_EXP_LOGGING
! _start = call LocalTime.read();
! #endif
!
if (call AddressMgrI.isGW())
{
***************
*** 181,186 ****
if (!sendQueryMsg(msg))
call MessageBufferI.freeMsg(msg);
! else
! call Timeout.start(TIMER_ONE_SHOT, TIMEOUT_GET_LOCATION);
}
} // task doSendQuery()
--- 203,214 ----
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()
***************
*** 222,227 ****
if (var.vtype & AGILLA_VAR_A)
_aID = var.id;
! else
! {
dbg(DBG_USR1, "VM (%i:%i): OPgetlocationM: ERROR: Invalid parameter type [%i].\n",
_currAgent->id.id, _currAgent->pc-1, var.vtype);
--- 250,256 ----
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);
***************
*** 257,265 ****
if (_currAgent != NULL && _currAgent->id.id == reply->agent_id.id)
{
-
#if DEBUG_OP_GETLOCATION
dbg(DBG_USR1, "OPgetlocationM: Received Results (%i, %i)\n", reply->loc.x, reply->loc.y);
#endif
!
call Timeout.stop();
--- 286,293 ----
if (_currAgent != NULL && _currAgent->id.id == reply->agent_id.id)
{
#if DEBUG_OP_GETLOCATION
dbg(DBG_USR1, "OPgetlocationM: Received Results (%i, %i)\n", reply->loc.x, reply->loc.y);
#endif
!
call Timeout.stop();
***************
*** 267,270 ****
--- 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);
}
***************
*** 295,301 ****
--- 328,341 ----
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;
More information about the Tinyos-contrib-commits
mailing list