static void lowpan_adaptation_etx_update_cb(protocol_interface_info_entry_t *cur, buffer_t *buf, const mcps_data_conf_t *confirm) { switch (confirm->status) { case MLME_TX_NO_ACK: case MLME_NO_DATA: case MLME_SUCCESS: if (buf->link_specific.ieee802_15_4.requestAck) { if (cur->lowpan_info & INTERFACE_NWK_BOOTSRAP_MLE) { bool success = false; if (confirm->status == MLME_SUCCESS) { success = true; } // Gets table entry mac_neighbor_table_entry_t *neigh_table_ptr = mac_neighbor_table_address_discover(mac_neighbor_info(cur), buf->dst_sa.address + PAN_ID_LEN, buf->dst_sa.addr_type); if (neigh_table_ptr) { etx_transm_attempts_update(cur->id, 1 + confirm->tx_retries , success, neigh_table_ptr->index); // Updates ETX statistics etx_storage_t * etx_entry = etx_storage_entry_get(cur->id, neigh_table_ptr->index); if (etx_entry) { if (neigh_table_ptr->link_role == PRIORITY_PARENT_NEIGHBOUR) { protocol_stats_update(STATS_ETX_1ST_PARENT, etx_entry->etx >> 4); } else if (neigh_table_ptr->link_role == SECONDARY_PARENT_NEIGHBOUR) { protocol_stats_update(STATS_ETX_2ND_PARENT, etx_entry->etx >> 4); } } }
static mac_neighbor_table_entry_t *neighbor_data_poll_referesh(protocol_interface_info_entry_t *cur, const uint8_t *address, addrtype_t type) { mac_neighbor_table_entry_t *entry = mac_neighbor_table_address_discover(mac_neighbor_info(cur), address, type); if (!entry || !entry->connected_device) { return NULL; } entry->lifetime = entry->link_lifetime; return entry; }