diff mbox

Change in libosmocore[master]: Add function to make Uplink Measurement

Message ID gerrit.1462981669853.Ib37107bcc9909e5105ea711de42d3fb1db7e8d9e@gerrit.osmocom.org
State New
Headers show

Commit Message

gerrit-no-reply@lists.osmocom.org May 11, 2016, 3:47 p.m. UTC
From Max <msuraev@sysmocom.de>:

Max has uploaded a new change for review.

  https://gerrit.osmocom.org/44

Change subject: Add function to make Uplink Measurement
......................................................................

Add function to make Uplink Measurement

It assembles RSL Uplink Measurement IE according to 3GPP TS 08.58
§9.3.25. The function is based on lchan_build_rsl_ul_meas() from OsmoBTS
but optionally includes DTX information.

Change-Id: Ib37107bcc9909e5105ea711de42d3fb1db7e8d9e
---
M include/osmocom/gsm/meas_rep.h
M src/gsm/gsm_utils.c
M src/gsm/libosmogsm.map
3 files changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/44/1

Comments

gerrit-no-reply@lists.osmocom.org May 11, 2016, 4:32 p.m. UTC | #1
From Harald Welte <laforge@gnumonks.org>:

Harald Welte has posted comments on this change.

Change subject: Add function to make Uplink Measurement
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/44/1/include/osmocom/gsm/meas_rep.h
File include/osmocom/gsm/meas_rep.h:

Line 29: size_t gsm0858_rsl_ul_meas(struct gsm_meas_rep_unidir *mru, bool dtxd_used,
In terms of naming, I would again like to see something more explicit.  The name tells us the function is related to RSL uplink measurement, but what does it do? encode? decode? ...

So gsm0858_rsl_ul_meas_enc or .._enc_ul_meas would be more applicable.
gerrit-no-reply@lists.osmocom.org May 11, 2016, 4:44 p.m. UTC | #2
From Max <msuraev@sysmocom.de>:

Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/44

to look at the new patch set (#2).

Change subject: Add function to make Uplink Measurement
......................................................................

Add function to make Uplink Measurement

It assembles RSL Uplink Measurement IE according to 3GPP TS 08.58
§9.3.25. The function is based on lchan_build_rsl_ul_meas() from OsmoBTS
but optionally includes DTX information.

Change-Id: Ib37107bcc9909e5105ea711de42d3fb1db7e8d9e
---
M include/osmocom/gsm/meas_rep.h
M src/gsm/gsm_utils.c
M src/gsm/libosmogsm.map
3 files changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/44/2
gerrit-no-reply@lists.osmocom.org May 11, 2016, 6:23 p.m. UTC | #3
From Harald Welte <laforge@gnumonks.org>:

Harald Welte has posted comments on this change.

Change subject: Add function to make Uplink Measurement
......................................................................


Patch Set 2: Code-Review+2
gerrit-no-reply@lists.osmocom.org May 12, 2016, 11:13 a.m. UTC | #4
From Neels Hofmeyr <nhofmeyr@sysmocom.de>:

Neels Hofmeyr has posted comments on this change.

Change subject: Add function to make Uplink Measurement
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/44/2/src/gsm/gsm_utils.c
File src/gsm/gsm_utils.c:

Line 341:  *  \param[in] mru Unidirectional measumrement report structure
typo measumrement
gerrit-no-reply@lists.osmocom.org May 12, 2016, 11:18 a.m. UTC | #5
From Max <msuraev@sysmocom.de>:

Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/44

to look at the new patch set (#3).

Change subject: Add function to make Uplink Measurement
......................................................................

Add function to make Uplink Measurement

It assembles RSL Uplink Measurement IE according to 3GPP TS 08.58
§9.3.25. The function is based on lchan_build_rsl_ul_meas() from OsmoBTS
but optionally includes DTX information.

Change-Id: Ib37107bcc9909e5105ea711de42d3fb1db7e8d9e
---
M include/osmocom/gsm/meas_rep.h
M src/gsm/gsm_utils.c
M src/gsm/libosmogsm.map
3 files changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/44/3
gerrit-no-reply@lists.osmocom.org May 12, 2016, 5:58 p.m. UTC | #6
From Harald Welte <laforge@gnumonks.org>:

Harald Welte has posted comments on this change.

Change subject: Add function to make Uplink Measurement
......................................................................


Patch Set 4: Code-Review+2
diff mbox

Patch

diff --git a/include/osmocom/gsm/meas_rep.h b/include/osmocom/gsm/meas_rep.h
index 09c2c4f..4eaeb72 100644
--- a/include/osmocom/gsm/meas_rep.h
+++ b/include/osmocom/gsm/meas_rep.h
@@ -1,6 +1,7 @@ 
 #pragma once
 
 #include <stdint.h>
+#include <stdbool.h>
 
 /* RX Level and RX Quality */
 struct gsm_rx_lev_qual {
@@ -24,3 +25,6 @@ 
 	MEAS_REP_UL_RXQUAL_FULL,
 	MEAS_REP_UL_RXQUAL_SUB,
 };
+
+size_t gsm0858_rsl_ul_meas(struct gsm_meas_rep_unidir *mru, bool dtxd_used,
+			   uint8_t *buf);
diff --git a/src/gsm/gsm_utils.c b/src/gsm/gsm_utils.c
index 5002947..665d4ef 100644
--- a/src/gsm/gsm_utils.c
+++ b/src/gsm/gsm_utils.c
@@ -66,11 +66,13 @@ 
 #include <osmocom/core/utils.h>
 #include <osmocom/core/bitvec.h>
 #include <osmocom/gsm/gsm_utils.h>
+#include <osmocom/gsm/meas_rep.h>
 #include <osmocom/gsm/protocol/gsm_04_08.h>
 
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <errno.h>
 #include <ctype.h>
@@ -335,6 +337,24 @@ 
 	return y;
 }
 
+/*! \brief Build the RSL uplink measurement IE (3GPP TS 08.58 § 9.3.25)
+ *  \param[in] mru Unidirectional measumrement report structure
+ *  \param[in] dtxd_used Indicates if DTXd was used during measurement report
+ *             period
+ *  \param[out] buf Pre-allocated bufer for storing IE
+ *  \returns Number of bytes filled in buf
+ */
+size_t gsm0858_rsl_ul_meas(struct gsm_meas_rep_unidir *mru, bool dtxd_used,
+			uint8_t *buf)
+{
+	buf[0] = dtxd_used ? (1 << 6) : 0;
+	buf[0] |= (mru->full.rx_lev & 0x3f);
+	buf[1] = (mru->sub.rx_lev & 0x3f);
+	buf[2] = ((mru->full.rx_qual & 7) << 3) | (mru->sub.rx_qual & 7);
+
+	return 3;
+}
+
 /* convert power class to dBm according to GSM TS 05.05 */
 unsigned int ms_class_gmsk_dbm(enum gsm_band band, int class)
 {
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index e0d9dcb..4c0d054 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -92,6 +92,8 @@ 
 gsm0808_create_sapi_reject;
 gsm0808_prepend_dtap_header;
 
+gsm0858_rsl_ul_meas;
+
 gsm338_get_sms_alphabet;
 
 gsm340_gen_oa;