[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components/ContextDiscovery
NeighborListC.nc, 1.15, 1.15.2.1 NeighborListM.nc, 1.31, 1.31.2.1
Chien-Liang Fok
chien-liang at users.sourceforge.net
Tue Nov 14 20:29:36 PST 2006
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/mobile-chat
Proxy.ma, 1.1, 1.2
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components
AddressMgrM.nc, 1.11, 1.11.2.1 ErrorMgrC.nc, 1.4,
1.4.2.1 ErrorMgrDummy.nc, 1.3, 1.3.2.1 ErrorMgrM.nc, 1.5,
1.5.2.1 LocationMgrC.nc, 1.7, 1.7.2.1 LocationMgrM.nc, 1.7,
1.7.2.1 LocationUtils.nc, 1.3, 1.3.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/ContextDiscovery
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26847/components/ContextDiscovery
Modified Files:
Tag: GroupComm
NeighborListC.nc NeighborListM.nc
Log Message:
Added a proxy heart beat and a virtual ID for the proxy.
Index: NeighborListC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/ContextDiscovery/NeighborListC.nc,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -C2 -d -r1.15 -r1.15.2.1
*** NeighborListC.nc 26 May 2006 02:58:20 -0000 1.15
--- NeighborListC.nc 15 Nov 2006 04:29:34 -0000 1.15.2.1
***************
*** 75,78 ****
--- 75,81 ----
NeighborListM.RcvBeacon -> Comm.ReceiveMsg[AM_AGILLABEACONMSG];
+ NeighborListM.SendProxyBeacon -> Comm.SendMsg[AM_AGILLAPROXYBEACONMSG];
+ NeighborListM.RcvProxyBeacon -> Comm.ReceiveMsg[AM_AGILLAPROXYBEACONMSG];
+
//Finder.SendBeaconBS -> Comm.SendMsg[AM_AGILLABEACONBSMSG];
//Finder.RcvBeaconBS -> Comm.ReceiveMsg[AM_AGILLABEACONBSMSG];
Index: NeighborListM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/ContextDiscovery/NeighborListM.nc,v
retrieving revision 1.31
retrieving revision 1.31.2.1
diff -C2 -d -r1.31 -r1.31.2.1
*** NeighborListM.nc 3 Oct 2006 12:55:53 -0000 1.31
--- NeighborListM.nc 15 Nov 2006 04:29:34 -0000 1.31.2.1
***************
*** 63,66 ****
--- 63,70 ----
interface SendMsg as SendBeacon;
interface ReceiveMsg as RcvBeacon;
+
+ interface SendMsg as SendProxyBeacon;
+ interface ReceiveMsg as RcvProxyBeacon;
+
// get neighbor list query
***************
*** 130,133 ****
--- 134,139 ----
uint8_t sendCount, nextSendCount; // for sending neighbor info to base station
+ void addToNbrList(uint16_t id, uint16_t hopsToGW, uint16_t chId, uint16_t energy);
+
/**************************************************************/
/* Method declarations */
***************
*** 225,259 ****
if (myBeacon != NULL)
{
! AgillaBeaconMsg* bmsg = (AgillaBeaconMsg *)myBeacon->data;
! uint16_t nbrToGW;
!
! bmsg->id = TOS_LOCAL_ADDRESS;
! // Determine the number of hops to the base station
! /*if (call AddressMgrI.isGW())
! bmsg->hopsToGW = 0;
! else
! {
! uint16_t addr;
! bmsg->hopsToGW = call NeighborListI.getGW(&addr);
! if (bmsg->hopsToGW != NO_GW)
{
! bmsg->hopsToGW++; // add one hop to get to the neighbor
! }
! }*/
! bmsg->hopsToGW = call NeighborListI.getGW(&nbrToGW);
! if (bmsg->hopsToGW != NO_GW && !call AddressMgrI.isGW()) bmsg->hopsToGW++; // increment hop count to include hop to this node
! bmsg->chId = _chId;
! bmsg->energy = 0;
! #if DEBUG_NEIGHBORLIST
! dbg(DBG_USR1, "NeighborListM: Send Beacon ID=%i, hopsToGW=%i, chID=%i, energy=%i\n",
! bmsg->id, bmsg->hopsToGW, bmsg->chId, bmsg->energy);
! #endif
! if (!call SendBeacon.send(TOS_BCAST_ADDR, sizeof(AgillaBeaconMsg), myBeacon))
! {
! dbg(DBG_USR1, "NeighborListM: ERROR: Unable to send beacon.\n");
! call MessageBufferI.freeMsg(myBeacon);
}
}
--- 231,280 ----
if (myBeacon != NULL)
{
! if (call LocationMgrI.isProxy()) {
! AgillaBeaconMsg* bmsg = (AgillaBeaconMsg *)myBeacon->data;
! uint16_t nbrToGW;
! bmsg->id = TOS_LOCAL_ADDRESS;
!
! // Determine the number of hops to the base station
! /*if (call AddressMgrI.isGW())
! bmsg->hopsToGW = 0;
! else
{
! uint16_t addr;
! bmsg->hopsToGW = call NeighborListI.getGW(&addr);
! if (bmsg->hopsToGW != NO_GW)
! {
! bmsg->hopsToGW++; // add one hop to get to the neighbor
! }
! }*/
! bmsg->hopsToGW = call NeighborListI.getGW(&nbrToGW);
! if (bmsg->hopsToGW != NO_GW && !call AddressMgrI.isGW()) bmsg->hopsToGW++; // increment hop count to include hop to this node
! bmsg->chId = _chId;
! bmsg->energy = 0;
! #if DEBUG_NEIGHBORLIST
! dbg(DBG_USR1, "NeighborListM: Send Beacon ID=%i, hopsToGW=%i, chID=%i, energy=%i\n",
! bmsg->id, bmsg->hopsToGW, bmsg->chId, bmsg->energy);
! #endif
! if (!call SendBeacon.send(TOS_BCAST_ADDR, sizeof(AgillaBeaconMsg), myBeacon))
! {
! dbg(DBG_USR1, "NeighborListM: ERROR: Unable to send beacon.\n");
! call MessageBufferI.freeMsg(myBeacon);
! }
! } else {
!
! // This mote is a proxy, send a proxy beacon containing its
! // virtual address.
! AgillaProxyBeaconMsg* bmsg = (AgillaProxyBeaconMsg *)myBeacon->data;
! bmsg->id = TOS_LOCAL_ADDRESS;
! bmsg->vID = call AddressMgrI.getVID();
!
! if (!call SendProxyBeacon.send(TOS_BCAST_ADDR, sizeof(AgillaProxyBeaconMsg), myBeacon))
! {
! dbg(DBG_USR1, "NeighborListM: ERROR: Unable to send beacon.\n");
! call MessageBufferI.freeMsg(myBeacon);
! }
}
}
***************
*** 267,270 ****
--- 288,297 ----
}
+ event result_t SendProxyBeacon.sendDone(TOS_MsgPtr m, result_t success)
+ {
+ call MessageBufferI.freeMsg(m);
+ return SUCCESS;
+ }
+
/**
* Check for neighbors whom we have not heard beacons from recently
***************
*** 319,323 ****
} // DisconnectTimer.fired()
!
/**
--- 346,368 ----
} // DisconnectTimer.fired()
! /**
! * This mote receives a proxy beacon message.
! * If this mote is a proxy, reject it because proxies
! * cannot talk to each other.
! *
! * If this mote is not a proxy, check whether the effective address
! * within the beacon is the local address. If it is, that means the
! * proxy is at this node's location and can talk to it, so add it
! * to the neighbor list.
! */
! event TOS_MsgPtr RcvProxyBeacon.receive(TOS_MsgPtr m) {
! AgillaProxyBeaconMsg* bmsg = (AgillaProxyBeaconMsg *)m->data;
!
! if (!call LocationMgrI.isProxy()) {
! if (bmsg->vID == TOS_LOCAL_ADDRESS)
! addToNbrList(bmsg->id, 0, 0, 0);
! }
! return m;
! }
/**
***************
*** 328,334 ****
event TOS_MsgPtr RcvBeacon.receive(TOS_MsgPtr m) {
AgillaBeaconMsg* bmsg = (AgillaBeaconMsg *)m->data;
! int16_t i = 0, indx = -1; // the index of the location
! tos_time_t now = call Time.get();
!
#if DEBUG_NEIGHBORLIST
dbg(DBG_USR1, "NeighborListM: processBeacon(): ID = %i, hopsToGW = %i\n", bmsg->id, bmsg->hopsToGW);
--- 373,377 ----
event TOS_MsgPtr RcvBeacon.receive(TOS_MsgPtr m) {
AgillaBeaconMsg* bmsg = (AgillaBeaconMsg *)m->data;
!
#if DEBUG_NEIGHBORLIST
dbg(DBG_USR1, "NeighborListM: processBeacon(): ID = %i, hopsToGW = %i\n", bmsg->id, bmsg->hopsToGW);
***************
*** 346,354 ****
#endif
// Check whether the neighbor is already in the list. If so,
// set indx equal to its position in the list, otherwise, set
// indx = -1.
while (i < numNbrs && indx == -1) {
! if (nbrs[i].addr == bmsg->id)
indx = i;
i++;
--- 389,411 ----
#endif
+ addToNbrList(bmsg->id, bmsg->hopsToGW, bmsg->chId, bmsg->energy);
+
+ #if NBR_LIST_PRINT_CHANGES || DEBUG_NEIGHBORLIST
+ printNbrList();
+ #endif
+
+ return m;
+ } // event TOS_MsgPtr RcvBeacon.receive(...)
+
+
+
+ void addToNbrList(uint16_t id, uint16_t hopsToGW, uint16_t chId, uint16_t energy) {
+ int16_t i = 0, indx = -1; // the index of the location
+
// Check whether the neighbor is already in the list. If so,
// set indx equal to its position in the list, otherwise, set
// indx = -1.
while (i < numNbrs && indx == -1) {
! if (nbrs[i].addr == id)
indx = i;
i++;
***************
*** 359,363 ****
{
indx = numNbrs++;
! nbrs[indx].addr = bmsg->id;
#if NBR_LIST_PRINT_CHANGES || DEBUG_NEIGHBORLIST
--- 416,420 ----
{
indx = numNbrs++;
! nbrs[indx].addr = id;
#if NBR_LIST_PRINT_CHANGES || DEBUG_NEIGHBORLIST
***************
*** 367,371 ****
{
dbg(DBG_USR1, "NeighborListM: Error! Failed to insert neighbor: neighbor list maximum reached!\n");
! return m;
}
--- 424,428 ----
{
dbg(DBG_USR1, "NeighborListM: Error! Failed to insert neighbor: neighbor list maximum reached!\n");
! return;
}
***************
*** 373,380 ****
{
// Update the timestamp and number of hops to the base station.
! nbrs[indx].hopsToGW = bmsg->hopsToGW;
! nbrs[indx].timeStamp = now;
! nbrs[indx].chId = bmsg->chId;
! nbrs[indx].energy = bmsg->energy;
//nbrs[indx].linkQuality = m->lqi;
--- 430,437 ----
{
// Update the timestamp and number of hops to the base station.
! nbrs[indx].hopsToGW = hopsToGW;
! nbrs[indx].timeStamp = call Time.get();
! nbrs[indx].chId = chId;
! nbrs[indx].energy = energy;
//nbrs[indx].linkQuality = m->lqi;
***************
*** 384,395 ****
// #endif
! } // end if the neighbor is in the list
!
! #if NBR_LIST_PRINT_CHANGES || DEBUG_NEIGHBORLIST
! printNbrList();
! #endif
!
! return m;
! } // event TOS_MsgPtr RcvBeacon.receive(...)
/**
--- 441,446 ----
// #endif
! } // end if the neighbor is in the list
! }
/**
- Previous message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/AgillaAgents/GroupComm/mobile-chat
Proxy.ma, 1.1, 1.2
- Next message: [Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components
AddressMgrM.nc, 1.11, 1.11.2.1 ErrorMgrC.nc, 1.4,
1.4.2.1 ErrorMgrDummy.nc, 1.3, 1.3.2.1 ErrorMgrM.nc, 1.5,
1.5.2.1 LocationMgrC.nc, 1.7, 1.7.2.1 LocationMgrM.nc, 1.7,
1.7.2.1 LocationUtils.nc, 1.3, 1.3.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list