diff options
Diffstat (limited to 'src/gprs_coding_scheme.cpp')
-rw-r--r-- | src/gprs_coding_scheme.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/gprs_coding_scheme.cpp b/src/gprs_coding_scheme.cpp index 04eb3b6f..a4601039 100644 --- a/src/gprs_coding_scheme.cpp +++ b/src/gprs_coding_scheme.cpp @@ -120,3 +120,59 @@ GprsCodingScheme::HeaderType GprsCodingScheme::headerTypeData() const { return mcs_info[m_scheme].data_hdr; } + +void GprsCodingScheme::inc(Mode mode) +{ + if (!isCompatible(mode)) + /* This should not happen. TODO: Use assert? */ + return; + + Scheme new_cs(Scheme(m_scheme + 1)); + if (!GprsCodingScheme(new_cs).isCompatible(mode)) + /* Clipping, do not change the value */ + return; + + m_scheme = new_cs; +} + +void GprsCodingScheme::dec(Mode mode) +{ + if (!isCompatible(mode)) + /* This should not happen. TODO: Use assert? */ + return; + + Scheme new_cs(Scheme(m_scheme - 1)); + if (!GprsCodingScheme(new_cs).isCompatible(mode)) + /* Clipping, do not change the value */ + return; + + m_scheme = new_cs; +} + +void GprsCodingScheme::inc() +{ + if (isGprs() && m_scheme == CS4) + return; + + if (isEgprs() && m_scheme == MCS9) + return; + + if (!isValid()) + return; + + m_scheme = Scheme(m_scheme + 1); +} + +void GprsCodingScheme::dec() +{ + if (isGprs() && m_scheme == CS1) + return; + + if (isEgprs() && m_scheme == MCS1) + return; + + if (!isValid()) + return; + + m_scheme = Scheme(m_scheme - 1); +} |