Fix previous commit could not HO more than once due to not refreshing serving cell after 1st HO

master
Ismael Gomez 7 years ago
parent df67735a99
commit cfaa5e9b28

@ -160,7 +160,7 @@ public:
virtual void in_sync() = 0; virtual void in_sync() = 0;
virtual void out_of_sync() = 0; virtual void out_of_sync() = 0;
virtual void earfcn_end() = 0; virtual void earfcn_end() = 0;
virtual void cell_found(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp) = 0; virtual void cell_camping(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp = NAN) = 0;
virtual void new_phy_meas(float rsrp, float rsrq, uint32_t tti, int earfcn = -1, int pci = -1) = 0; virtual void new_phy_meas(float rsrp, float rsrq, uint32_t tti, int earfcn = -1, int pci = -1) = 0;
}; };

@ -37,6 +37,7 @@
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include "srslte/common/threads.h" #include "srslte/common/threads.h"
#include <math.h>
#include <map> #include <map>
#include <queue> #include <queue>
@ -106,7 +107,9 @@ class cell_t
} }
void set_rsrp(float rsrp) { void set_rsrp(float rsrp) {
this->rsrp = rsrp; if (~isnan(rsrp)) {
this->rsrp = rsrp;
}
in_sync = true; in_sync = true;
gettimeofday(&last_update, NULL); gettimeofday(&last_update, NULL);
} }
@ -252,7 +255,7 @@ public:
void in_sync(); void in_sync();
void out_of_sync(); void out_of_sync();
void earfcn_end(); void earfcn_end();
void cell_found(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp); void cell_camping(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp);
void new_phy_meas(float rsrp, float rsrq, uint32_t tti, int earfcn, int pci); void new_phy_meas(float rsrp, float rsrq, uint32_t tti, int earfcn, int pci);
// MAC interface // MAC interface

@ -651,6 +651,7 @@ void phch_recv::run_thread()
if (!cell_search_in_progress) { if (!cell_search_in_progress) {
log_h->info("Sync OK. Camping on cell PCI=%d...\n", cell.id); log_h->info("Sync OK. Camping on cell PCI=%d...\n", cell.id);
phy_state = CELL_CAMP; phy_state = CELL_CAMP;
rrc->cell_camping(earfcn[cur_earfcn_index], cell);
} else { } else {
log_h->info("Sync OK. Measuring PCI=%d...\n", cell.id); log_h->info("Sync OK. Measuring PCI=%d...\n", cell.id);
measure_p.reset(); measure_p.reset();
@ -680,7 +681,7 @@ void phch_recv::run_thread()
log_h->info("SYNC: Measured OK. Camping on cell PCI=%d...\n", cell.id); log_h->info("SYNC: Measured OK. Camping on cell PCI=%d...\n", cell.id);
phy_state = CELL_CAMP; phy_state = CELL_CAMP;
cell_search_in_progress = false; cell_search_in_progress = false;
rrc->cell_found(earfcn[cur_earfcn_index], cell, measure_p.rsrp()); rrc->cell_camping(earfcn[cur_earfcn_index], cell, measure_p.rsrp());
break; break;
case measure::IDLE: case measure::IDLE:
break; break;

@ -590,14 +590,16 @@ void rrc::new_phy_meas(float rsrp, float rsrq, uint32_t tti, int earfcn_i, int p
} }
} }
void rrc::cell_found(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp) { /* PHY begins camping in a cell. RRC updates RSRP measurement,
* proceeds with PLMN selection/cell search if applicable and sets
* new cell as current serving cell */
void rrc::cell_camping(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp) {
bool found = false; bool found = false;
int cell_idx = -1; int cell_idx = -1;
if (serving_cell->equals(earfcn, phy_cell.id)) { if (serving_cell->equals(earfcn, phy_cell.id)) {
serving_cell->set_rsrp(rsrp); serving_cell->set_rsrp(rsrp);
serving_cell->in_sync = true;
found = true; found = true;
} else { } else {
// Check if cell is in our list of neighbour cells // Check if cell is in our list of neighbour cells
@ -605,7 +607,6 @@ void rrc::cell_found(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp) {
if (cell_idx >= 0) { if (cell_idx >= 0) {
set_serving_cell(cell_idx); set_serving_cell(cell_idx);
serving_cell->set_rsrp(rsrp); serving_cell->set_rsrp(rsrp);
serving_cell->in_sync = true;
found = true; found = true;
} }
} }
@ -629,7 +630,6 @@ void rrc::cell_found(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp) {
phy->cell_search_next(); phy->cell_search_next();
} else { } else {
set_serving_cell(earfcn, phy_cell.id); set_serving_cell(earfcn, phy_cell.id);
si_acquire_state = SI_ACQUIRE_SIB1; si_acquire_state = SI_ACQUIRE_SIB1;
} }
} }

Loading…
Cancel
Save