aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_ms.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-04 18:19:02 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-04 18:26:43 +0100
commit99db40ad2d4bf0569fc460d90132a64724a83a6c (patch)
tree5f1f350bb9e643be4ad2e810f10657bdc62daa7e /src/gprs_ms.cpp
parent22d7e75e1f160e5337140d9f3dcb2679b621b646 (diff)
Revert "Refactor coding scheme assignment code"
Roll-out the refactoring change. The code did not include the necessary update to the test result and there are some concerns about it in itself and the right approach would have been to fix the copy and paste issue, then do the refactoring. This reverts commit 22d7e75e1f160e5337140d9f3dcb2679b621b646.
Diffstat (limited to 'src/gprs_ms.cpp')
-rw-r--r--src/gprs_ms.cpp65
1 files changed, 32 insertions, 33 deletions
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index c10c735f..78f03f84 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -209,46 +209,45 @@ void GprsMs::stop_timer()
unref();
}
-inline static GprsCodingScheme assign_cs(GprsCodingScheme current, BTS *bts, bool uplink, GprsCodingScheme::Mode mode)
-{
- GprsCodingScheme tmp = GprsCodingScheme::UNKNOWN;
- struct gprs_rlcmac_bts * b = bts->bts_data();
-
- if (GprsCodingScheme::GPRS == mode) {
- if (!current.isGprs()) {
- tmp = GprsCodingScheme::getGprsByNum(uplink ? b->initial_cs_ul : b->initial_cs_dl);
- if (!tmp.isValid())
- return GprsCodingScheme::CS1;
- }
- } else {
- if (!current.isEgprs()) {
- tmp = GprsCodingScheme::getEgprsByNum(uplink ? b->initial_mcs_ul : b->initial_mcs_dl);
- if (!tmp.isValid())
- return GprsCodingScheme::MCS1;
- }
- }
-
- return tmp;
-}
-
void GprsMs::set_mode(GprsCodingScheme::Mode mode)
{
- GprsCodingScheme tmp;
m_mode = mode;
if (!m_bts)
return;
- tmp = assign_cs(m_current_cs_ul, m_bts, true, mode);
- if (tmp)
- m_current_cs_ul = tmp;
-
- tmp = assign_cs(m_current_cs_dl, m_bts, false, mode);
- if (tmp)
- m_current_cs_dl = tmp;
-
- LOGP(DRLCMAC, LOGL_DEBUG, "MS IMSI=%s mode set to %s: UL=%s, DL=%s\n",
- imsi(), tmp.modeName(mode), m_current_cs_ul.name(), m_current_cs_dl.name());
+ switch (m_mode) {
+ case GprsCodingScheme::GPRS:
+ if (!m_current_cs_ul.isGprs()) {
+ m_current_cs_ul = GprsCodingScheme::getGprsByNum(
+ m_bts->bts_data()->initial_cs_ul);
+ if (!m_current_cs_ul.isValid())
+ m_current_cs_ul = GprsCodingScheme::CS1;
+ }
+ if (!m_current_cs_dl.isGprs()) {
+ m_current_cs_dl = GprsCodingScheme::getGprsByNum(
+ m_bts->bts_data()->initial_cs_dl);
+ if (!m_current_cs_dl.isValid())
+ m_current_cs_dl = GprsCodingScheme::CS1;
+ }
+ break;
+
+ case GprsCodingScheme::EGPRS_GMSK:
+ case GprsCodingScheme::EGPRS:
+ if (!m_current_cs_ul.isEgprs()) {
+ m_current_cs_ul = GprsCodingScheme::getEgprsByNum(
+ m_bts->bts_data()->initial_mcs_ul);
+ if (!m_current_cs_dl.isValid())
+ m_current_cs_ul = GprsCodingScheme::MCS1;
+ }
+ if (!m_current_cs_dl.isEgprs()) {
+ m_current_cs_dl = GprsCodingScheme::getEgprsByNum(
+ m_bts->bts_data()->initial_mcs_dl);
+ if (!m_current_cs_dl.isValid())
+ m_current_cs_dl = GprsCodingScheme::MCS1;
+ }
+ break;
+ }
}
void GprsMs::attach_tbf(struct gprs_rlcmac_tbf *tbf)