MCS: add mcs_is_*() helpers
In preparation for Channel Coding Command encoder in follow-up patches
let's add necessary helpers. Those are similar to previously used
helpers from GprsCodingScheme class but without CamelCase and with less
typo chances between Gprs and Egprs cases.
Change-Id: I6699cbc8d7ae766fa4d2b3d37e5f9ff1cf158b7e
diff --git a/src/gprs_coding_scheme.h b/src/gprs_coding_scheme.h
index 6f965d6..728ffd6 100644
--- a/src/gprs_coding_scheme.h
+++ b/src/gprs_coding_scheme.h
@@ -45,9 +45,7 @@
GprsCodingScheme& operator =(GprsCodingScheme o);
bool isValid() const {return UNKNOWN <= m_scheme && m_scheme <= MCS9;}
- bool isGprs() const {return CS1 <= m_scheme && m_scheme <= CS4;}
- bool isEgprs() const {return m_scheme >= MCS1;}
- bool isEgprsGmsk() const {return isEgprs() && m_scheme <= MCS4;}
+
bool isCompatible(enum mcs_kind mode) const;
bool isCompatible(GprsCodingScheme o) const;
bool isFamilyCompatible(GprsCodingScheme o) const;
@@ -86,10 +84,10 @@
inline uint8_t GprsCodingScheme::to_num() const
{
- if (isGprs())
+ if (mcs_is_gprs(m_scheme))
return (m_scheme - CS1) + 1;
- if (isEgprs())
+ if (mcs_is_edge(m_scheme))
return (m_scheme - MCS1) + 1;
return 0;
@@ -98,9 +96,9 @@
inline bool GprsCodingScheme::isCompatible(enum mcs_kind mode) const
{
switch (mode) {
- case GPRS: return isGprs();
- case EGPRS_GMSK: return isEgprsGmsk();
- case EGPRS: return isEgprs();
+ case GPRS: return mcs_is_gprs(m_scheme);
+ case EGPRS_GMSK: return mcs_is_edge_gmsk(m_scheme);
+ case EGPRS: return mcs_is_edge(m_scheme);
}
return false;
@@ -108,7 +106,7 @@
inline bool GprsCodingScheme::isCompatible(GprsCodingScheme o) const
{
- return (isGprs() && o.isGprs()) || (isEgprs() && o.isEgprs());
+ return (mcs_is_gprs(m_scheme) && mcs_is_gprs(o)) || (mcs_is_edge(m_scheme) && mcs_is_edge(o));
}
inline GprsCodingScheme::GprsCodingScheme(CodingScheme s)