laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35214?usp=email )
Change subject: Correctly assemble measurement result into MEASUREMENT REPORT ......................................................................
Correctly assemble measurement result into MEASUREMENT REPORT
After adding the strongest cell to the measurement report, the variables 'strongest' and 'strongest_i' are used to prevent that already added cells are added again.
Please note that there are no neighbor cell measurements available, because current layer 1 does not report BSIC of neighbor cells. This means that there is no neighbor cell reported.
Related: OS#6280 Change-Id: Iaeeaf978da31611c47a20af41790bfa6640dcffd --- M src/host/layer23/src/mobile/gsm48_rr.c 1 file changed, 28 insertions(+), 3 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve
diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c index 52c6a73..fb79c9b 100644 --- a/src/host/layer23/src/mobile/gsm48_rr.c +++ b/src/host/layer23/src/mobile/gsm48_rr.c @@ -3707,7 +3707,7 @@ if (rep_valid) { int8_t strongest, current; uint8_t ncc; - int i, index; + int i, index, strongest_i;
#if 0 /* FIXME: multi-band reporting, if not: 0 = normal reporting */ @@ -3721,13 +3721,20 @@ current = -128; /* -infinite */ index = 0; for (i = 0; i < rrmeas->nc_num; i++) { + /* Skip stronger cells that have been added to measurement report so far. */ + if (rrmeas->nc_rxlev_dbm[i] > strongest) + continue; + /* Skip cells with equal strength that have been added so far. */ + if (rrmeas->nc_rxlev_dbm[i] == strongest && i <= strongest_i) + continue; /* only check if NCC is permitted */ ncc = rrmeas->nc_bsic[i] >> 3; if ((s->nb_ncc_permitted_si6 & (1 << ncc)) - && rrmeas->nc_rxlev_dbm[i] > current - && rrmeas->nc_rxlev_dbm[i] < strongest) { + && rrmeas->nc_rxlev_dbm[i] > current) { current = rrmeas->nc_rxlev_dbm[i]; + strongest = current; index = i; + strongest_i = i; } } if (current == -128) /* no more found */