mirror of https://github.com/PentHertz/srsLTE.git
added a callback that always gets triggered when the phy cell selection completes. This callback checks if cell selection failed, and if so, sets the rsrp of the selected cell to -infinity
This commit is contained in:
parent
0b127fa8c7
commit
7f8af023b8
|
@ -52,7 +52,9 @@ public:
|
||||||
struct in_sync_ev {};
|
struct in_sync_ev {};
|
||||||
struct out_sync_ev {};
|
struct out_sync_ev {};
|
||||||
|
|
||||||
explicit phy_controller(phy_interface_rrc_lte* phy_, srslte::task_sched_handle task_sched_);
|
explicit phy_controller(phy_interface_rrc_lte* phy_,
|
||||||
|
srslte::task_sched_handle task_sched_,
|
||||||
|
std::function<void(uint32_t, uint32_t, bool)> on_cell_selection = {});
|
||||||
|
|
||||||
// PHY procedures interfaces
|
// PHY procedures interfaces
|
||||||
bool start_cell_select(const phy_cell_t& phy_cell, srslte::event_observer<bool> observer);
|
bool start_cell_select(const phy_cell_t& phy_cell, srslte::event_observer<bool> observer);
|
||||||
|
@ -114,10 +116,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
phy_interface_rrc_lte* phy = nullptr;
|
phy_interface_rrc_lte* phy = nullptr;
|
||||||
srslte::task_sched_handle task_sched;
|
srslte::task_sched_handle task_sched;
|
||||||
srslte::event_observer<bool> cell_selection_observer;
|
srslte::event_observer<bool> cell_selection_once_observer;
|
||||||
srslte::event_dispatcher<cell_srch_res> cell_search_observers;
|
std::function<void(uint32_t, uint32_t, bool)> cell_selection_always_observer;
|
||||||
|
srslte::event_dispatcher<cell_srch_res> cell_search_observers;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
state_list<unknown_st, in_sync_st, out_sync_st, searching_cell, selecting_cell> states{this,
|
state_list<unknown_st, in_sync_st, out_sync_st, searching_cell, selecting_cell> states{this,
|
||||||
|
|
|
@ -189,6 +189,7 @@ public:
|
||||||
cell_t& operator[](size_t idx) { return *neighbour_cells[idx]; }
|
cell_t& operator[](size_t idx) { return *neighbour_cells[idx]; }
|
||||||
const cell_t& operator[](size_t idx) const { return *neighbour_cells[idx]; }
|
const cell_t& operator[](size_t idx) const { return *neighbour_cells[idx]; }
|
||||||
cell_t& at(size_t idx) { return *neighbour_cells.at(idx); }
|
cell_t& at(size_t idx) { return *neighbour_cells.at(idx); }
|
||||||
|
cell_t* find_cell(uint32_t earfcn, uint32_t pci);
|
||||||
|
|
||||||
// serving cell handling
|
// serving cell handling
|
||||||
int set_serving_cell(phy_interface_rrc_lte::phy_cell_t phy_cell, bool discard_serving);
|
int set_serving_cell(phy_interface_rrc_lte::phy_cell_t phy_cell, bool discard_serving);
|
||||||
|
|
|
@ -30,10 +30,13 @@ std::string to_string(const phy_interface_rrc_lte::phy_cell_t& cell)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
phy_controller::phy_controller(srsue::phy_interface_rrc_lte* phy_, srslte::task_sched_handle task_sched_) :
|
phy_controller::phy_controller(srsue::phy_interface_rrc_lte* phy_,
|
||||||
|
srslte::task_sched_handle task_sched_,
|
||||||
|
std::function<void(uint32_t, uint32_t, bool)> on_cell_selection) :
|
||||||
base_t(srslte::log_ref{"RRC"}),
|
base_t(srslte::log_ref{"RRC"}),
|
||||||
phy(phy_),
|
phy(phy_),
|
||||||
task_sched(task_sched_)
|
task_sched(task_sched_),
|
||||||
|
cell_selection_always_observer(std::move(on_cell_selection))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void phy_controller::in_sync()
|
void phy_controller::in_sync()
|
||||||
|
@ -56,7 +59,7 @@ bool phy_controller::start_cell_select(const phy_cell_t& phy_cell, srslte::event
|
||||||
log_h->warning("Failed to launch cell selection. Current state: %s\n", current_state_name().c_str());
|
log_h->warning("Failed to launch cell selection. Current state: %s\n", current_state_name().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cell_selection_observer = std::move(observer);
|
cell_selection_once_observer = std::move(observer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +99,8 @@ void phy_controller::selecting_cell::exit(phy_controller* f)
|
||||||
|
|
||||||
// Signal result back to FSM that called cell selection
|
// Signal result back to FSM that called cell selection
|
||||||
bool result = csel_res.result;
|
bool result = csel_res.result;
|
||||||
f->task_sched.defer_task([f, result]() { f->cell_selection_observer(result); });
|
f->cell_selection_always_observer(target_cell.earfcn, target_cell.pci, result);
|
||||||
|
f->task_sched.defer_task([f, result]() { f->cell_selection_once_observer(result); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void phy_controller::selecting_cell::wait_in_sync::enter(selecting_cell* f)
|
void phy_controller::selecting_cell::wait_in_sync::enter(selecting_cell* f)
|
||||||
|
|
|
@ -116,7 +116,15 @@ void rrc::init(phy_interface_rrc_lte* phy_,
|
||||||
|
|
||||||
args = args_;
|
args = args_;
|
||||||
|
|
||||||
phy_ctrl.reset(new phy_controller{phy, task_sched});
|
auto on_every_cell_selection = [this](uint32_t earfcn, uint32_t pci, bool csel_result) {
|
||||||
|
if (not csel_result) {
|
||||||
|
cell_t* c = meas_cells.find_cell(earfcn, pci);
|
||||||
|
if (c != nullptr) {
|
||||||
|
c->set_rsrp(-INFINITY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
phy_ctrl.reset(new phy_controller{phy, task_sched, on_every_cell_selection});
|
||||||
|
|
||||||
state = RRC_STATE_IDLE;
|
state = RRC_STATE_IDLE;
|
||||||
plmn_is_selected = false;
|
plmn_is_selected = false;
|
||||||
|
|
|
@ -329,6 +329,14 @@ bool meas_cell_list::has_neighbour_cell(uint32_t earfcn, uint32_t pci) const
|
||||||
return get_neighbour_cell_handle(earfcn, pci) != nullptr;
|
return get_neighbour_cell_handle(earfcn, pci) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cell_t* meas_cell_list::find_cell(uint32_t earfcn, uint32_t pci)
|
||||||
|
{
|
||||||
|
if (serving_cell().phy_cell.pci == pci and serving_cell().phy_cell.earfcn == earfcn) {
|
||||||
|
return &serving_cell();
|
||||||
|
}
|
||||||
|
return get_neighbour_cell_handle(earfcn, pci);
|
||||||
|
}
|
||||||
|
|
||||||
int meas_cell_list::set_serving_cell(phy_interface_rrc_lte::phy_cell_t phy_cell, bool discard_serving)
|
int meas_cell_list::set_serving_cell(phy_interface_rrc_lte::phy_cell_t phy_cell, bool discard_serving)
|
||||||
{
|
{
|
||||||
// don't update neighbor cell list unless serving cell changes
|
// don't update neighbor cell list unless serving cell changes
|
||||||
|
|
|
@ -1358,13 +1358,9 @@ srslte::proc_outcome_t rrc::ho_proc::init(const asn1::rrc::rrc_conn_recfg_s& rrc
|
||||||
: rrc_ptr->meas_cells.serving_cell().get_earfcn();
|
: rrc_ptr->meas_cells.serving_cell().get_earfcn();
|
||||||
|
|
||||||
// Target cell shall be either serving cell (intra-cell HO) or neighbour cell
|
// Target cell shall be either serving cell (intra-cell HO) or neighbour cell
|
||||||
if (rrc_ptr->has_neighbour_cell(target_earfcn, mob_ctrl_info->target_pci)) {
|
cell_t* cell_to_ho = rrc_ptr->meas_cells.find_cell(target_earfcn, mob_ctrl_info->target_pci);
|
||||||
// target cell is neighbour cell
|
if (cell_to_ho != nullptr) {
|
||||||
target_cell =
|
target_cell = cell_to_ho->phy_cell;
|
||||||
rrc_ptr->meas_cells.get_neighbour_cell_handle(target_earfcn, recfg_r8.mob_ctrl_info.target_pci)->phy_cell;
|
|
||||||
} else if (recfg_r8.mob_ctrl_info.target_pci == rrc_ptr->meas_cells.serving_cell().get_pci()) {
|
|
||||||
// intra-cell HO, target cell is current serving cell
|
|
||||||
target_cell = rrc_ptr->get_serving_cell()->phy_cell;
|
|
||||||
} else {
|
} else {
|
||||||
rrc_ptr->rrc_log->console("Received HO command to unknown PCI=%d\n", mob_ctrl_info->target_pci);
|
rrc_ptr->rrc_log->console("Received HO command to unknown PCI=%d\n", mob_ctrl_info->target_pci);
|
||||||
Error("Could not find target cell earfcn=%d, pci=%d\n",
|
Error("Could not find target cell earfcn=%d, pci=%d\n",
|
||||||
|
|
Loading…
Reference in New Issue