From c02aa8f12498090ad6f41a2569dfd3c159e667a9 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 15 Jul 2019 11:24:38 +0200 Subject: [PATCH] liblte_mme: add DCNR UE capabilties packing --- lib/include/srslte/asn1/liblte_mme.h | 2 ++ lib/src/asn1/liblte_mme.cc | 48 +++++++--------------------- 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/lib/include/srslte/asn1/liblte_mme.h b/lib/include/srslte/asn1/liblte_mme.h index cea9ddd6f..99c501feb 100644 --- a/lib/include/srslte/asn1/liblte_mme.h +++ b/lib/include/srslte/asn1/liblte_mme.h @@ -1340,6 +1340,8 @@ typedef struct { bool onexsrvcc_present; bool nf; bool nf_present; + bool dc_nr; + bool dc_nr_present; } LIBLTE_MME_UE_NETWORK_CAPABILITY_STRUCT; // Functions LIBLTE_ERROR_ENUM liblte_mme_pack_ue_network_capability_ie(LIBLTE_MME_UE_NETWORK_CAPABILITY_STRUCT* ue_network_cap, diff --git a/lib/src/asn1/liblte_mme.cc b/lib/src/asn1/liblte_mme.cc index c65a3729d..6cde713ce 100644 --- a/lib/src/asn1/liblte_mme.cc +++ b/lib/src/asn1/liblte_mme.cc @@ -2631,14 +2631,8 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_ue_network_capability_ie(LIBLTE_MME_UE_NETWORK LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS; if (ue_network_cap != NULL && ie_ptr != NULL) { - if (ue_network_cap->uea_present && (ue_network_cap->ucs2_present || ue_network_cap->uia_present) && - (ue_network_cap->lpp_present || ue_network_cap->lcs_present || ue_network_cap->onexsrvcc_present || - ue_network_cap->nf_present)) { - **ie_ptr = 5; - } else if (ue_network_cap->uea_present && (ue_network_cap->ucs2_present || ue_network_cap->uia_present)) { - **ie_ptr = 4; - } else if (ue_network_cap->uea_present) { - **ie_ptr = 3; + if (ue_network_cap->dc_nr_present) { + **ie_ptr = 7; } else { **ie_ptr = 2; } @@ -2661,34 +2655,16 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_ue_network_capability_ie(LIBLTE_MME_UE_NETWORK **ie_ptr |= ue_network_cap->eia[6] << 1; **ie_ptr |= ue_network_cap->eia[7]; *ie_ptr += 1; - if (ue_network_cap->uea_present) { - **ie_ptr = ue_network_cap->uea[0] << 7; - **ie_ptr |= ue_network_cap->uea[1] << 6; - **ie_ptr |= ue_network_cap->uea[2] << 5; - **ie_ptr |= ue_network_cap->uea[3] << 4; - **ie_ptr |= ue_network_cap->uea[4] << 3; - **ie_ptr |= ue_network_cap->uea[5] << 2; - **ie_ptr |= ue_network_cap->uea[6] << 1; - **ie_ptr |= ue_network_cap->uea[7]; - *ie_ptr += 1; - } - if (ue_network_cap->ucs2_present || ue_network_cap->uia_present) { - **ie_ptr = ue_network_cap->ucs2 << 7; - **ie_ptr |= ue_network_cap->uia[1] << 6; - **ie_ptr |= ue_network_cap->uia[2] << 5; - **ie_ptr |= ue_network_cap->uia[3] << 4; - **ie_ptr |= ue_network_cap->uia[4] << 3; - **ie_ptr |= ue_network_cap->uia[5] << 2; - **ie_ptr |= ue_network_cap->uia[6] << 1; - **ie_ptr |= ue_network_cap->uia[7]; - *ie_ptr += 1; - } - if (ue_network_cap->lpp_present || ue_network_cap->lcs_present || ue_network_cap->onexsrvcc_present || - ue_network_cap->nf_present) { - **ie_ptr = ue_network_cap->lpp << 3; - **ie_ptr |= ue_network_cap->lcs << 2; - **ie_ptr |= ue_network_cap->onexsrvcc << 1; - **ie_ptr |= ue_network_cap->nf; + + if (ue_network_cap->dc_nr_present) { + // skip empty caps + for (int i = 0; i < 4; i++) { + **ie_ptr = 0; + *ie_ptr += 1; + } + + // set dcnr bit + **ie_ptr = ue_network_cap->dc_nr << 4; *ie_ptr += 1; }