]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
get etx now returns etx for the path to the root instead of etx from the current...
authorgnawali <gnawali>
Wed, 31 Oct 2007 22:53:01 +0000 (22:53 +0000)
committergnawali <gnawali>
Wed, 31 Oct 2007 22:53:01 +0000 (22:53 +0000)
tos/lib/net/ctp/CtpInfo.nc
tos/lib/net/ctp/CtpRoutingEngineP.nc

index 57c275efb50f2360b301b055ba19ec9890f0d22a..8074597676a5072a097c805d48fa3603520a65b6 100644 (file)
@@ -45,7 +45,7 @@ interface CtpInfo {
    * through the current parent.  The pointer is allocated by the
    * caller.  If the parent is invalid, return FAIL (no info).  The
    * caller MUST NOT use the value in parent if the return is not
-   * SUCCESS.
+   * SUCCESS. Calling getEtx at the root will set the etx argument to 0.
    */
   
   command error_t getEtx(uint16_t* etx);
index a2d935f8cfbbb8455511fc78a0b162e86508befb..5a595341ae9c015f5f2013d974838272ae1ec518 100644 (file)
@@ -548,7 +548,12 @@ implementation {
             return FAIL;
         if (routeInfo.parent == INVALID_ADDR)    
             return FAIL;
-        *etx = routeInfo.etx;
+       if (state_is_root == 1) {
+         *etx = 0;
+       } else {
+         // path etx = etx(parent) + etx(link to the parent)
+         *etx = routeInfo.etx + evaluateEtx(call LinkEstimator.getLinkQuality(routeInfo.parent));
+       }
         return SUCCESS;
     }