mirror of https://gerrit.osmocom.org/libosmocore
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 Reviewed-on: https://gerrit.osmocom.org/44 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
This commit is contained in:
parent
fe65fa7e36
commit
764b022fc6
|
@ -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 @@ enum meas_rep_field {
|
|||
MEAS_REP_UL_RXQUAL_FULL,
|
||||
MEAS_REP_UL_RXQUAL_SUB,
|
||||
};
|
||||
|
||||
size_t gsm0858_rsl_ul_meas_enc(struct gsm_meas_rep_unidir *mru, bool dtxd_used,
|
||||
uint8_t *buf);
|
||||
|
|
|
@ -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 @@ int gsm_7bit_encode_n_ussd(uint8_t *result, size_t n, const char *data, int *oct
|
|||
return y;
|
||||
}
|
||||
|
||||
/*! \brief Build the RSL uplink measurement IE (3GPP TS 08.58 § 9.3.25)
|
||||
* \param[in] mru Unidirectional measurement 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_enc(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)
|
||||
{
|
||||
|
|
|
@ -92,6 +92,8 @@ gsm0808_create_reset;
|
|||
gsm0808_create_sapi_reject;
|
||||
gsm0808_prepend_dtap_header;
|
||||
|
||||
gsm0858_rsl_ul_meas_enc;
|
||||
|
||||
gsm338_get_sms_alphabet;
|
||||
|
||||
gsm340_gen_oa;
|
||||
|
|
Loading…
Reference in New Issue