refactored the serving cell config procedure. there was one more state than it was needed.

master
Francisco Paisana 5 years ago committed by Andre Puschmann
parent 8a33fde8e7
commit c76cdc6cea

@ -95,11 +95,12 @@ private:
rrc* rrc_ptr; rrc* rrc_ptr;
srslte::log* log_h; srslte::log* log_h;
srslte::proc_outcome_t launch_sib_acquire();
// proc args // proc args
std::vector<uint32_t> required_sibs; std::vector<uint32_t> required_sibs;
// state variables // state variables
enum class search_state_t { next_sib, si_acquire } search_state;
uint32_t req_idx = 0; uint32_t req_idx = 0;
srslte::proc_future_t<void> si_acquire_fut; srslte::proc_future_t<void> si_acquire_fut;
}; };

@ -277,13 +277,11 @@ proc_outcome_t rrc::serving_cell_config_proc::init(const std::vector<uint32_t>&
rrc_ptr->serving_cell->has_mcch = false; rrc_ptr->serving_cell->has_mcch = false;
req_idx = 0; req_idx = 0;
search_state = search_state_t::next_sib; return launch_sib_acquire();
return step();
} }
proc_outcome_t rrc::serving_cell_config_proc::step() srslte::proc_outcome_t rrc::serving_cell_config_proc::launch_sib_acquire()
{ {
if (search_state == search_state_t::next_sib) {
// Obtain the SIBs if not available or apply the configuration if available // Obtain the SIBs if not available or apply the configuration if available
for (; req_idx < required_sibs.size(); req_idx++) { for (; req_idx < required_sibs.size(); req_idx++) {
uint32_t required_sib = required_sibs[req_idx]; uint32_t required_sib = required_sibs[req_idx];
@ -294,9 +292,8 @@ proc_outcome_t rrc::serving_cell_config_proc::step()
Error("SI Acquire is already running...\n"); Error("SI Acquire is already running...\n");
return proc_outcome_t::error; return proc_outcome_t::error;
} }
search_state = search_state_t::si_acquire; return proc_outcome_t::yield;
return step(); }
} else {
// UE had SIB already. Handle its SIB // UE had SIB already. Handle its SIB
Info("Cell has SIB%d\n", required_sib + 1); Info("Cell has SIB%d\n", required_sib + 1);
switch (required_sib) { switch (required_sib) {
@ -310,12 +307,13 @@ proc_outcome_t rrc::serving_cell_config_proc::step()
break; break;
} }
} }
}
if (req_idx == required_sibs.size()) {
Info("Serving Cell Configuration Procedure has finished successfully\n"); Info("Serving Cell Configuration Procedure has finished successfully\n");
return proc_outcome_t::success; return proc_outcome_t::success;
} }
} else if (search_state == search_state_t::si_acquire) {
proc_outcome_t rrc::serving_cell_config_proc::step()
{
if (rrc_ptr->si_acquirer.run()) { if (rrc_ptr->si_acquirer.run()) {
return proc_outcome_t::yield; return proc_outcome_t::yield;
} }
@ -327,11 +325,8 @@ proc_outcome_t rrc::serving_cell_config_proc::step()
} }
} }
// continue with remaining SIBs // continue with remaining SIBs
search_state = search_state_t::next_sib;
req_idx++; req_idx++;
return step(); return launch_sib_acquire();
}
return proc_outcome_t::yield;
} }
/************************************** /**************************************

Loading…
Cancel
Save