Moved get_earfcn to srslte get_carrier_freq func

master
David Rupprecht 4 years ago committed by Andre Puschmann
parent d4fb2dfb16
commit 848496bb0f

@ -122,6 +122,11 @@ void set_phy_cfg_t_common_pwr_ctrl(phy_cfg_t* cfg, const asn1::rrc::ul_pwr_ctrl_
void set_phy_cfg_t_scell_config(phy_cfg_t* cfg, const asn1::rrc::scell_to_add_mod_r10_s& asn1_type); void set_phy_cfg_t_scell_config(phy_cfg_t* cfg, const asn1::rrc::scell_to_add_mod_r10_s& asn1_type);
void set_phy_cfg_t_enable_64qam(phy_cfg_t* cfg, const bool enabled); void set_phy_cfg_t_enable_64qam(phy_cfg_t* cfg, const bool enabled);
/***************************
* Measurements
**************************/
int get_carrier_freq(const asn1::rrc::meas_obj_to_add_mod_s& obj);
/*************************** /***************************
* EUTRA UE Capabilities * EUTRA UE Capabilities
**************************/ **************************/

@ -820,6 +820,17 @@ void set_phy_cfg_t_scell_config(phy_cfg_t* cfg, const asn1::rrc::scell_to_add_mo
} }
} }
/***************************
* Measurements
**************************/
int get_carrier_freq(const asn1::rrc::meas_obj_to_add_mod_s& obj)
{
if (obj.meas_obj.type().value != meas_obj_to_add_mod_s::meas_obj_c_::types_opts::meas_obj_eutra) {
return -1;
}
return obj.meas_obj.meas_obj_eutra().carrier_freq;
}
/* /*
* UE Capabilities parser * UE Capabilities parser
*/ */

@ -30,7 +30,6 @@ using report_cfg_list = asn1::rrc::report_cfg_to_add_mod_list_l;
using meas_id_t = asn1::rrc::meas_id_to_add_mod_s; using meas_id_t = asn1::rrc::meas_id_to_add_mod_s;
using meas_id_list = asn1::rrc::meas_id_to_add_mod_list_l; using meas_id_list = asn1::rrc::meas_id_to_add_mod_list_l;
int get_earfcn(const meas_obj_t& obj);
bool is_same_earfcn(const meas_obj_t& lhs, const meas_obj_t& rhs); bool is_same_earfcn(const meas_obj_t& lhs, const meas_obj_t& rhs);
/// Find MeasObj with same earfcn. Assumes ordered list /// Find MeasObj with same earfcn. Assumes ordered list

@ -22,30 +22,23 @@ namespace srsenb {
* measObjToAddMod * measObjToAddMod
**********************************/ **********************************/
int get_earfcn(const meas_obj_t& obj)
{
if (obj.meas_obj.type().value != meas_obj_t::meas_obj_c_::types_opts::meas_obj_eutra) {
return -1;
}
return obj.meas_obj.meas_obj_eutra().carrier_freq;
}
bool is_same_earfcn(const meas_obj_t& lhs, const meas_obj_t& rhs) bool is_same_earfcn(const meas_obj_t& lhs, const meas_obj_t& rhs)
{ {
int freq1 = get_earfcn(lhs); int freq1 = srslte::get_carrier_freq(lhs);
int freq2 = get_earfcn(rhs); int freq2 = srslte::get_carrier_freq(rhs);
return freq1 != -1 and freq1 == freq2; return freq1 != -1 and freq1 == freq2;
} }
meas_obj_t* find_meas_obj(meas_obj_to_add_mod_list_l& l, uint32_t earfcn) meas_obj_t* find_meas_obj(meas_obj_to_add_mod_list_l& l, uint32_t earfcn)
{ {
auto same_earfcn = [earfcn](const meas_obj_t& obj) { return (int)earfcn == get_earfcn(obj); }; auto same_earfcn = [earfcn](const meas_obj_t& obj) { return (int)earfcn == srslte::get_carrier_freq(obj); };
auto it = std::find_if(l.begin(), l.end(), same_earfcn); auto it = std::find_if(l.begin(), l.end(), same_earfcn);
return it == l.end() ? nullptr : &(*it); return it == l.end() ? nullptr : &(*it);
} }
const meas_obj_t* find_meas_obj(const meas_obj_to_add_mod_list_l& l, uint32_t earfcn) const meas_obj_t* find_meas_obj(const meas_obj_to_add_mod_list_l& l, uint32_t earfcn)
{ {
auto same_earfcn = [earfcn](const meas_obj_t& obj) { return (int)earfcn == get_earfcn(obj); }; auto same_earfcn = [earfcn](const meas_obj_t& obj) { return (int)earfcn == srslte::get_carrier_freq(obj); };
auto it = std::find_if(l.begin(), l.end(), same_earfcn); auto it = std::find_if(l.begin(), l.end(), same_earfcn);
return it == l.end() ? nullptr : &(*it); return it == l.end() ? nullptr : &(*it);
} }

@ -12,10 +12,11 @@
#include "srsenb/hdr/enb.h" #include "srsenb/hdr/enb.h"
#include "srsenb/hdr/stack/rrc/ue_meas_cfg.h" #include "srsenb/hdr/stack/rrc/ue_meas_cfg.h"
#include "srslte/asn1/rrc_utils.h"
#include "srslte/common/test_common.h" #include "srslte/common/test_common.h"
#include "srslte/interfaces/enb_rrc_interface_types.h" #include "srslte/interfaces/enb_rrc_interface_types.h"
#include "test_helpers.h"
#include "srslte/rrc/rrc_cfg_utils.h" #include "srslte/rrc/rrc_cfg_utils.h"
#include "test_helpers.h"
using namespace asn1::rrc; using namespace asn1::rrc;
@ -309,8 +310,10 @@ int test_minimize_meascfg_reordering()
// TEST1: Ensure consistent order of measObjects based on DL-EARFCN // TEST1: Ensure consistent order of measObjects based on DL-EARFCN
TESTASSERT(mcfg1.meas_obj_to_add_mod_list_present and mcfg2.meas_obj_to_add_mod_list_present); TESTASSERT(mcfg1.meas_obj_to_add_mod_list_present and mcfg2.meas_obj_to_add_mod_list_present);
TESTASSERT(mcfg1.meas_obj_to_add_mod_list.size() == mcfg2.meas_obj_to_add_mod_list.size()); TESTASSERT(mcfg1.meas_obj_to_add_mod_list.size() == mcfg2.meas_obj_to_add_mod_list.size());
TESTASSERT(get_earfcn(mcfg1.meas_obj_to_add_mod_list[0]) == get_earfcn(mcfg2.meas_obj_to_add_mod_list[0])); TESTASSERT(srslte::get_carrier_freq(mcfg1.meas_obj_to_add_mod_list[0]) ==
TESTASSERT(get_earfcn(mcfg1.meas_obj_to_add_mod_list[1]) == get_earfcn(mcfg2.meas_obj_to_add_mod_list[1])); srslte::get_carrier_freq(mcfg2.meas_obj_to_add_mod_list[0]));
TESTASSERT(srslte::get_carrier_freq(mcfg1.meas_obj_to_add_mod_list[1]) ==
srslte::get_carrier_freq(mcfg2.meas_obj_to_add_mod_list[1]));
TESTASSERT(std::is_sorted( TESTASSERT(std::is_sorted(
mcfg1.meas_obj_to_add_mod_list.begin(), mcfg1.meas_obj_to_add_mod_list.end(), srslte::rrc_obj_id_cmp{})); mcfg1.meas_obj_to_add_mod_list.begin(), mcfg1.meas_obj_to_add_mod_list.end(), srslte::rrc_obj_id_cmp{}));
TESTASSERT(std::is_sorted( TESTASSERT(std::is_sorted(

@ -29,7 +29,6 @@ using namespace asn1::rrc;
typedef std::vector<phy_cell_t> cell_triggered_t; typedef std::vector<phy_cell_t> cell_triggered_t;
// TODO make this agnostic with srsenb // TODO make this agnostic with srsenb
int get_carrier_freq(const meas_obj_to_add_mod_s& obj);
meas_obj_to_add_mod_s* find_meas_obj_map(std::map<uint32_t, meas_obj_to_add_mod_s>& l, uint32_t earfcn); meas_obj_to_add_mod_s* find_meas_obj_map(std::map<uint32_t, meas_obj_to_add_mod_s>& l, uint32_t earfcn);
// RRC Measurements class // RRC Measurements class

@ -27,20 +27,10 @@ using namespace asn1::rrc;
namespace srsue { namespace srsue {
int get_carrier_freq(const meas_obj_to_add_mod_s& obj)
{
if (obj.meas_obj.type().value != meas_obj_to_add_mod_s::meas_obj_c_::types_opts::meas_obj_eutra) {
return -1;
}
return obj.meas_obj.meas_obj_eutra().carrier_freq;
}
meas_obj_to_add_mod_s* find_meas_obj_map(std::map<uint32_t, meas_obj_to_add_mod_s>& l, uint32_t earfcn) meas_obj_to_add_mod_s* find_meas_obj_map(std::map<uint32_t, meas_obj_to_add_mod_s>& l, uint32_t earfcn)
{ {
auto same_earfcn = [earfcn](const std::pair<uint32_t, meas_obj_to_add_mod_s>& c) { auto same_earfcn = [earfcn](const std::pair<uint32_t, meas_obj_to_add_mod_s>& c) {
return (int)earfcn == get_carrier_freq(c.second); return (int)earfcn == srslte::get_carrier_freq(c.second);
}; };
auto it = std::find_if(l.begin(), l.end(), same_earfcn); auto it = std::find_if(l.begin(), l.end(), same_earfcn);
if (it == l.end()) { if (it == l.end()) {

Loading…
Cancel
Save