aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-12-14 22:24:28 +0100
committerHarald Welte <laforge@gnumonks.org>2009-12-14 22:24:28 +0100
commitf1dae1924a80e614982513707b4ee568d2126e1b (patch)
treecee91420cf73498955db2308171930620013578e /openbsc/src
parent7f73a1ac58d6b9f2f8ec793123bf0ee3038fb3a4 (diff)
04.08 MEAS REP: Convert relative cell number to ARFCN
Since we are keeping a bitvec of the neighbor cells, we can now use bitvec_get_nth_set_bit() to determine the ARFCN for each reported cell in the 04.08 MEASUREMENT REPORT.
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/gsm_04_08.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 88b1b6900..6d05a20ad 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -32,6 +32,7 @@
#include <openbsc/db.h>
#include <openbsc/msgb.h>
+#include <openbsc/bitvec.h>
#include <openbsc/tlv.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
@@ -171,6 +172,8 @@ int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg)
struct gsm48_hdr *gh = msgb_l3(msg);
unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh);
u_int8_t *data = gh->data;
+ struct gsm_bts *bts = msg->lchan->ts->trx->bts;
+ struct bitvec *nbv = &bts->si_common.neigh_list;
if (gh->msg_type != GSM48_MT_RR_MEAS_REP)
return -EINVAL;
@@ -194,37 +197,39 @@ int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg)
/* an encoding nightmare in perfection */
rep->cell[0].rxlev = data[4] & 0x3f;
- rep->cell[0].bcch_freq = data[5] >> 2;
+ rep->cell[0].arfcn = bitvec_get_nth_set_bit(nbv, data[5] >> 2);
rep->cell[0].bsic = ((data[5] & 0x03) << 3) | (data[6] >> 5);
if (rep->num_cell < 2)
return 0;
rep->cell[1].rxlev = ((data[6] & 0x1f) << 1) | (data[7] >> 7);
- rep->cell[1].bcch_freq = (data[7] >> 2) & 0x1f;
+ rep->cell[1].arfcn = bitvec_get_nth_set_bit(nbv, (data[7] >> 2) & 0x1f);
rep->cell[1].bsic = ((data[7] & 0x03) << 4) | (data[8] >> 4);
if (rep->num_cell < 3)
return 0;
rep->cell[2].rxlev = ((data[8] & 0x0f) << 2) | (data[9] >> 6);
- rep->cell[2].bcch_freq = (data[9] >> 1) & 0x1f;
+ rep->cell[2].arfcn = bitvec_get_nth_set_bit(nbv, (data[9] >> 1) & 0x1f);
rep->cell[2].bsic = ((data[9] & 0x01) << 6) | (data[10] >> 3);
if (rep->num_cell < 4)
return 0;
rep->cell[3].rxlev = ((data[10] & 0x07) << 3) | (data[11] >> 5);
- rep->cell[3].bcch_freq = data[11] & 0x1f;
+ rep->cell[3].arfcn = bitvec_get_nth_set_bit(nbv, data[11] & 0x1f);
rep->cell[3].bsic = data[12] >> 2;
if (rep->num_cell < 5)
return 0;
rep->cell[4].rxlev = ((data[12] & 0x03) << 4) | (data[13] >> 4);
- rep->cell[4].bcch_freq = ((data[13] & 0xf) << 1) | (data[14] >> 7);
+ rep->cell[4].arfcn = bitvec_get_nth_set_bit(nbv,
+ ((data[13] & 0xf) << 1) | (data[14] >> 7));
rep->cell[4].bsic = (data[14] >> 1) & 0x3f;
if (rep->num_cell < 6)
return 0;
rep->cell[5].rxlev = ((data[14] & 0x01) << 5) | (data[15] >> 3);
- rep->cell[5].bcch_freq = ((data[15] & 0x07) << 2) | (data[16] >> 6);
+ rep->cell[5].arfcn = bitvec_get_nth_set_bit(nbv,
+ ((data[15] & 0x07) << 2) | (data[16] >> 6));
rep->cell[5].bsic = data[16] & 0x3f;
return 0;