summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/MTS_IO_CellularRadio.cpp32
-rw-r--r--src/MTS_IO_ICellularRadio.cpp1
2 files changed, 33 insertions, 0 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp
index 8bdd00e..191299b 100644
--- a/src/MTS_IO_CellularRadio.cpp
+++ b/src/MTS_IO_CellularRadio.cpp
@@ -694,6 +694,14 @@ void CellularRadio::getCommonNetworkStats(Json::Value& jData) {
jData[ICellularRadio::KEY_NETWORK_REG] = sNetworkReg;
}
}
+
+ std::string sCurrentCellMode;
+ CELLULAR_MODES eModes;
+ if (getCellularMode(eModes) == SUCCESS) {
+ if (convertCellModesToString(eModes, sCurrentCellMode) == SUCCESS) {
+ jData[ICellularRadio::KEY_CELL_MODE] = sCurrentCellMode;
+ }
+ }
}
ICellularRadio::CODE CellularRadio::getSimLockStatus(std::string& sData)
@@ -851,6 +859,30 @@ ICellularRadio::CODE CellularRadio::convertRegistrationToString(REGISTRATION eRe
return eCode;
}
+ICellularRadio::CODE CellularRadio::convertCellModesToString(ICellularRadio::CELLULAR_MODES eCellModes, std::string& sCellModes) {
+ std::string sResult;
+
+ if (eCellModes & CELLULAR_MODE_2G) {
+ sResult += "2g,";
+ }
+ if (eCellModes & CELLULAR_MODE_3G) {
+ sResult += "3g,";
+ }
+ if (eCellModes & CELLULAR_MODE_4G) {
+ sResult += "4g,";
+ }
+ if (eCellModes & CELLULAR_MODE_5G) {
+ sResult += "5g,";
+ }
+
+ if (!sResult.empty()) {
+ sResult.pop_back(); // remove trailing comma
+ }
+
+ sCellModes = sResult;
+ return SUCCESS;
+}
+
ICellularRadio::CODE CellularRadio::unlockSimCard(const Json::Value& jArgs) {
printTrace("%s| Unlock the SIM card using PIN code", m_sName.c_str());
diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp
index 339294d..53c8faa 100644
--- a/src/MTS_IO_ICellularRadio.cpp
+++ b/src/MTS_IO_ICellularRadio.cpp
@@ -55,6 +55,7 @@ const char *MTS::IO::ICellularRadio::KEY_SUPPORTED_CELL_MODES = "supportedCellul
const char *MTS::IO::ICellularRadio::KEY_ROAMING = "roaming"; //!< Indicates whether or not using Home Network
const char *MTS::IO::ICellularRadio::KEY_DATETIME = "datetime"; //!< Date and Time from tower
const char *MTS::IO::ICellularRadio::KEY_SERVICE = "service"; //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO]
+const char *MTS::IO::ICellularRadio::KEY_CELL_MODE = "cellularMode"; //!< Specifies the cellular mode that is currently used by the modem [2g, 3g, 4g]
const char *MTS::IO::ICellularRadio::KEY_NETWORK = "network"; //!< Cellular Service Provider
const char *MTS::IO::ICellularRadio::KEY_NETWORK_REG = "netreg"; //!< Network Registration
const char *MTS::IO::ICellularRadio::KEY_CID = "cid"; //!< Cellular ID = Tower in HEX