Added a function for obtaining the link estimate and rtmetric for a neighbor
This commit is contained in:
parent
46b2451969
commit
2cae71e89b
|
@ -33,7 +33,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: collect-neighbor.c,v 1.5 2010/09/13 13:28:14 adamdunkels Exp $
|
||||
* $Id: collect-neighbor.c,v 1.6 2010/09/22 22:04:55 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -251,8 +251,8 @@ collect_neighbor_list_best(struct collect_neighbor_list *neighbors_list)
|
|||
n->rtmetric, collect_neighbor_link_estimate(n),
|
||||
collect_neighbor_rtmetric(n));
|
||||
if(!rimeaddr_cmp(&n->addr, &rimeaddr_null) &&
|
||||
rtmetric > collect_neighbor_rtmetric(n)) {
|
||||
rtmetric = collect_neighbor_rtmetric(n);
|
||||
rtmetric > collect_neighbor_rtmetric_link_estimate(n)) {
|
||||
rtmetric = collect_neighbor_rtmetric_link_estimate(n);
|
||||
best = n;
|
||||
}
|
||||
}
|
||||
|
@ -335,11 +335,17 @@ collect_neighbor_link_estimate(struct collect_neighbor *n)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
collect_neighbor_rtmetric(struct collect_neighbor *n)
|
||||
collect_neighbor_rtmetric_link_estimate(struct collect_neighbor *n)
|
||||
{
|
||||
return n->rtmetric + collect_link_estimate(&n->le);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
collect_neighbor_rtmetric(struct collect_neighbor *n)
|
||||
{
|
||||
return n->rtmetric;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
collect_neighbor_set_lifetime(int seconds)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: collect-neighbor.h,v 1.3 2010/09/13 13:28:14 adamdunkels Exp $
|
||||
* $Id: collect-neighbor.h,v 1.4 2010/09/22 22:04:55 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -91,6 +91,7 @@ void collect_neighbor_tx(struct collect_neighbor *n, uint8_t num_tx);
|
|||
void collect_neighbor_rx(struct collect_neighbor *n);
|
||||
void collect_neighbor_tx_fail(struct collect_neighbor *n, uint8_t num_tx);
|
||||
int collect_neighbor_link_estimate(struct collect_neighbor *n);
|
||||
int collect_neighbor_rtmetric_link_estimate(struct collect_neighbor *n);
|
||||
int collect_neighbor_rtmetric(struct collect_neighbor *n);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue