Ejemplo n.º 1
0
/*---------------------------------------------------------------------------*/
void
collect_neighbor_list_remove(struct collect_neighbor_list *neighbors_list,
                             const rimeaddr_t *addr)
{
    struct collect_neighbor *n = collect_neighbor_list_find(neighbors_list, addr);

    if(n != NULL)
    {
        list_remove(neighbors_list->list, n);
        memb_free(&collect_neighbors_mem, n);
    }
}
Ejemplo n.º 2
0
static void
received_announcement(struct announcement *a, const linkaddr_t *from,
	     uint16_t id, uint16_t value)
{
  struct collect_neighbor *n;

  /*  printf("adv_received %d.%d\n", from->u8[0], from->u8[1]); */
  
  n = collect_neighbor_list_find(&neighbor_list, from);
  
  if(n == NULL) {
    collect_neighbor_list_add(&neighbor_list, from, value);
  } else {
    collect_neighbor_update_rtmetric(n, value);
  }
}
Ejemplo n.º 3
0
// Collect data function.  Identical to the collect-view-data process, but a function.
void collect_data(struct shell_command *c) {
	struct collect_view_data_msg msg;
	struct collect_neighbor *n;
	uint16_t parent_etx;
	uint16_t num_neighbors;
	uint16_t beacon_interval;

	n = collect_neighbor_list_find(&shell_collect_conn.neighbor_list,
		                         &shell_collect_conn.parent);
	if(n != NULL) {
		parent_etx = collect_neighbor_link_estimate(n);
	} else {
		parent_etx = 0;
	}
	num_neighbors = collect_neighbor_list_num(&shell_collect_conn.neighbor_list);
	beacon_interval = broadcast_announcement_beacon_interval() / CLOCK_SECOND;

	collect_view_construct_message(&msg, &shell_collect_conn.parent,
		                         parent_etx, shell_collect_conn.rtmetric,
		                         num_neighbors, beacon_interval);
	shell_output(c, &msg, sizeof(msg), "", 0);
}