summaryrefslogtreecommitdiff
path: root/src/MTS_IO_CellularRadio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MTS_IO_CellularRadio.cpp')
-rw-r--r--src/MTS_IO_CellularRadio.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp
index 03baf48..1850a60 100644
--- a/src/MTS_IO_CellularRadio.cpp
+++ b/src/MTS_IO_CellularRadio.cpp
@@ -425,26 +425,21 @@ ICellularRadio::CODE CellularRadio::getType(std::string& sType) {
ICellularRadio::CODE CellularRadio::getCarrier(std::string& sCarrier) {
printTrace("%s| Get Carrier", m_sName.c_str());
- if(m_sCarrier == "") {
- Json::Value jData;
- if(getNetworkStatus(jData) == SUCCESS) {
- if(jData.isMember(ICellularRadio::KEY_MCC) && jData.isMember(ICellularRadio::KEY_MNC)) {
- std::string sMcc = jData[ICellularRadio::KEY_MCC].asString();
- std::string sMnc = jData[ICellularRadio::KEY_MNC].asString();
- Json::Value jLookup = MccMncTable::getInstance()->lookup(sMcc, sMnc);
- printTrace("%s| MCC-MNC Lookup: [%s][%s][%s]", m_sName.c_str(),
- sMcc.c_str(), sMnc.c_str(), jLookup.toStyledString().c_str());
- if(jLookup.isMember(ICellularRadio::KEY_CARRIER)) {
- m_sCarrier = jLookup[ICellularRadio::KEY_CARRIER].asString();
- } else {
- printWarning("%s| MCC-MNC Lookup did not contain carrier", m_sName.c_str());
- return FAILURE;
- }
+ if (m_sCarrier == "") {
+ std::string sMcc;
+ std::string sMnc;
+ if (getSimMccMnc(sMcc, sMnc) == CODE::SUCCESS) {
+ Json::Value jLookup = MccMncTable::getInstance()->lookup(sMcc, sMnc);
+ printTrace("%s| MCC-MNC Lookup: [%s][%s][%s]", m_sName.c_str(),
+ sMcc.c_str(), sMnc.c_str(), jLookup.toStyledString().c_str());
+ if (jLookup.isMember(ICellularRadio::KEY_CARRIER)) {
+ m_sCarrier = jLookup[ICellularRadio::KEY_CARRIER].asString();
} else {
- printWarning("%s| Network Status did no contain MCC or MNC", m_sName.c_str());
+ printWarning("%s| MCC-MNC Lookup did not contain carrier", m_sName.c_str());
return FAILURE;
}
} else {
+ printWarning("%s| SIM did no contain MCC or MNC", m_sName.c_str());
return FAILURE;
}
}