[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/ctp
CtpRoutingEngineP.nc, 1.1.2.2, 1.1.2.3
Phil Levis
scipio at users.sourceforge.net
Sun Sep 10 16:01:18 PDT 2006
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/doc/html overview.html, 1.2,
1.3 tep1.html, 1.2, 1.3 tep101.html, 1.2, 1.3 tep102.html, 1.2,
1.3 tep103.html, 1.2, 1.3 tep106.html, 1.2, 1.3 tep107.html,
1.2, 1.3 tep108.html, 1.2, 1.3 tep109.html, 1.2,
1.3 tep110.html, 1.2, 1.3 tep111.html, 1.2, 1.3 tep112.html,
1.2, 1.3 tep113.html, 1.2, 1.3 tep114.html, 1.2,
1.3 tep115.html, 1.2, 1.3 tep116.html, 1.2, 1.3 tep117.html,
1.2, 1.3 tep118.html, 1.2, 1.3 tep119.html, 1.2,
1.3 tep120.html, 1.2, 1.3 tep121.html, 1.2, 1.3 tep123.html,
1.2, 1.3 tep2.html, 1.2, 1.3 tep3.html, 1.2, 1.3
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/tos/lib/net/ctp CtpP.nc, 1.1.2.2,
1.1.2.3 CtpRoutingEngineP.nc, 1.1.2.3, 1.1.2.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27051
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
CtpRoutingEngineP.nc
Log Message:
Include trickle-like updates.
Index: CtpRoutingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/Attic/CtpRoutingEngineP.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** CtpRoutingEngineP.nc 25 Aug 2006 00:41:28 -0000 1.1.2.2
--- CtpRoutingEngineP.nc 10 Sep 2006 23:01:15 -0000 1.1.2.3
***************
*** 89,92 ****
--- 89,93 ----
/*
* @author Rodrigo Fonseca
+ * @author Philip Levis (added trickle-like updates)
* Acknowledgment: based on MintRoute, MultiHopLQI, BVR tree construction, Berkeley's MTree
*
***************
*** 95,99 ****
*/
! generic module CtpRoutingEngineP(uint8_t routingTableSize) {
provides {
interface UnicastNameFreeRouting as Routing;
--- 96,100 ----
*/
! generic module CtpRoutingEngineP(uint8_t routingTableSize, uint16_t minInterval, uint16_t maxInterval) {
provides {
interface UnicastNameFreeRouting as Routing;
***************
*** 153,156 ****
--- 154,187 ----
error_t routingTableEvict(am_addr_t neighbor);
+ uint16_t currentInterval = minInterval;
+ bool tHasPassed;
+
+ void chooseAdvertiseTime() {
+ uint16_t t = call Random.random16() % (currentInterval / 2);
+ t += currentInterval;
+ tHasPassed = FALSE;
+ call BeaconTimer.stop();
+ call BeaconTimer.start(t);
+ }
+
+ void resetInterval() {
+ currentInterval = minInterval;
+ chooseAdvertiseTime();
+ }
+
+ void decayInterval() {
+ currentInterval *= 2;
+ if (currentInterval > maxInterval) {
+ currentInterval = maxInterval;
+ }
+ chooseAdvertiseTime();
+ }
+
+ void remainingInterval() {
+ uint16_t t = call BeaconTimer.getdt();
+ t = currentInterval - t;
+ tHasPassed = TRUE;
+ call BeaconTimer.start(t);
+ }
command error_t Init.init() {
***************
*** 292,295 ****
--- 323,327 ----
// ii. when choosing a next hop
parentChanges++;
+ resetInterval();
dbg("TreeRouting","Changed parent. from %d to %d\n", routeInfo.parent, best->neighbor);
call CollectionDebug.logEventRoute(NET_C_TREE_NEW_PARENT, best->neighbor, best->info.hopcount + 1, best->info.metric);
***************
*** 367,380 ****
event void BeaconTimer.fired() {
! if (radioOn && running) {
! // determine next interval
! uint16_t nextInt;
! nextInt = call Random.rand16() % BEACON_INTERVAL;
! nextInt += BEACON_INTERVAL >> 1;
! call BeaconTimer.startOneShot(nextInt);
! post updateRouteTask();
! post sendBeaconTask();
! }
! }
/* Handle the receiving of beacon messages from the neighbors. We update the
--- 399,413 ----
event void BeaconTimer.fired() {
! if (radioOn && running) {
! if (!t.hasPassed()) {
! post updateRouteTask();
! post sendBeaconTask();
! remainingInterval();
! }
! else {
! decayInterval();
! }
! }
!
/* Handle the receiving of beacon messages from the neighbors. We update the
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/doc/html overview.html, 1.2,
1.3 tep1.html, 1.2, 1.3 tep101.html, 1.2, 1.3 tep102.html, 1.2,
1.3 tep103.html, 1.2, 1.3 tep106.html, 1.2, 1.3 tep107.html,
1.2, 1.3 tep108.html, 1.2, 1.3 tep109.html, 1.2,
1.3 tep110.html, 1.2, 1.3 tep111.html, 1.2, 1.3 tep112.html,
1.2, 1.3 tep113.html, 1.2, 1.3 tep114.html, 1.2,
1.3 tep115.html, 1.2, 1.3 tep116.html, 1.2, 1.3 tep117.html,
1.2, 1.3 tep118.html, 1.2, 1.3 tep119.html, 1.2,
1.3 tep120.html, 1.2, 1.3 tep121.html, 1.2, 1.3 tep123.html,
1.2, 1.3 tep2.html, 1.2, 1.3 tep3.html, 1.2, 1.3
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/tos/lib/net/ctp CtpP.nc, 1.1.2.2,
1.1.2.3 CtpRoutingEngineP.nc, 1.1.2.3, 1.1.2.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list