fix issue when adding neighbour cell that matches serving cell

master
Francisco Paisana 5 years ago
parent 43db9b81fb
commit 8c920837d6

@ -169,8 +169,8 @@ public:
meas_cell_list(); meas_cell_list();
bool add_neighbour_cell(const phy_meas_t& meas); bool add_meas_cell(const phy_meas_t& meas);
bool add_neighbour_cell(unique_cell_t cell); bool add_meas_cell(unique_cell_t cell);
void rem_last_neighbour(); void rem_last_neighbour();
unique_cell_t remove_neighbour_cell(uint32_t earfcn, uint32_t pci); unique_cell_t remove_neighbour_cell(uint32_t earfcn, uint32_t pci);
void clean_neighbours(); void clean_neighbours();

@ -169,7 +169,7 @@ const cell_t* meas_cell_list::get_neighbour_cell_handle(uint32_t earfcn, uint32_
} }
// If only neighbour PCI is provided, copy full cell from serving cell // If only neighbour PCI is provided, copy full cell from serving cell
bool meas_cell_list::add_neighbour_cell(const rrc_interface_phy_lte::phy_meas_t& meas) bool meas_cell_list::add_meas_cell(const rrc_interface_phy_lte::phy_meas_t& meas)
{ {
phy_interface_rrc_lte::phy_cell_t phy_cell = {}; phy_interface_rrc_lte::phy_cell_t phy_cell = {};
phy_cell.earfcn = meas.earfcn; phy_cell.earfcn = meas.earfcn;
@ -178,12 +178,12 @@ bool meas_cell_list::add_neighbour_cell(const rrc_interface_phy_lte::phy_meas_t&
c.get()->set_rsrp(meas.rsrp); c.get()->set_rsrp(meas.rsrp);
c.get()->set_rsrq(meas.rsrq); c.get()->set_rsrq(meas.rsrq);
c.get()->set_cfo(meas.cfo_hz); c.get()->set_cfo(meas.cfo_hz);
return add_neighbour_cell(std::move(c)); return add_meas_cell(std::move(c));
} }
bool meas_cell_list::add_neighbour_cell(unique_cell_t new_cell) bool meas_cell_list::add_meas_cell(unique_cell_t cell)
{ {
bool ret = add_neighbour_cell_unsorted(std::move(new_cell)); bool ret = add_neighbour_cell_unsorted(std::move(cell));
if (ret) { if (ret) {
sort_neighbour_cells(); sort_neighbour_cells();
} }
@ -199,8 +199,9 @@ bool meas_cell_list::add_neighbour_cell_unsorted(unique_cell_t new_cell)
} }
if (is_same_cell(serving_cell(), *new_cell)) { if (is_same_cell(serving_cell(), *new_cell)) {
log_h->error("Added neighbour cell %s is equal to serving cell\n", new_cell->to_string().c_str()); log_h->info("Added neighbour cell %s is serving cell\n", new_cell->to_string().c_str());
return false; serv_cell = std::move(new_cell);
return true;
} }
// If cell exists, update RSRP value // If cell exists, update RSRP value
@ -344,7 +345,7 @@ int meas_cell_list::set_serving_cell(phy_interface_rrc_lte::phy_cell_t phy_cell,
// Re-add old serving cell to list of neighbours // Re-add old serving cell to list of neighbours
if (old_serv_cell->is_valid() and not is_same_cell(phy_cell, *old_serv_cell) and not discard_serving) { if (old_serv_cell->is_valid() and not is_same_cell(phy_cell, *old_serv_cell) and not discard_serving) {
if (not add_neighbour_cell(std::move(old_serv_cell))) { if (not add_meas_cell(std::move(old_serv_cell))) {
log_h->info("Serving cell not added to list of neighbours. Worse than current neighbours\n"); log_h->info("Serving cell not added to list of neighbours. Worse than current neighbours\n");
} }
} }
@ -376,7 +377,7 @@ bool meas_cell_list::process_new_cell_meas(const std::vector<phy_meas_t>&
filter_meas(*c, m); filter_meas(*c, m);
} else { } else {
// or just set initial value // or just set initial value
neighbour_added |= add_neighbour_cell(m); neighbour_added |= add_meas_cell(m);
} }
if (is_serving_cell) { if (is_serving_cell) {

@ -121,7 +121,7 @@ proc_outcome_t rrc::cell_search_proc::handle_cell_found(const phy_interface_rrc_
Info("Cell found in this frequency. Setting new serving cell EARFCN=%d PCI=%d ...\n", new_cell.earfcn, new_cell.pci); Info("Cell found in this frequency. Setting new serving cell EARFCN=%d PCI=%d ...\n", new_cell.earfcn, new_cell.pci);
// Create a cell with NaN RSRP. Will be updated by new_phy_meas() during SIB search. // Create a cell with NaN RSRP. Will be updated by new_phy_meas() during SIB search.
if (not rrc_ptr->meas_cells.add_neighbour_cell(unique_cell_t(new cell_t(new_cell)))) { if (not rrc_ptr->meas_cells.add_meas_cell(unique_cell_t(new cell_t(new_cell)))) {
Error("Could not add new found cell\n"); Error("Could not add new found cell\n");
return proc_outcome_t::error; return proc_outcome_t::error;
} }

Loading…
Cancel
Save