summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYevhen Mykhno <yevhen.mykhno@globallogic.com>2023-01-31 13:26:34 +0200
committerYevhen Mykhno <yevhen.mykhno@globallogic.com>2023-01-31 14:42:13 +0200
commit5da5645c2dad56eb9654e4fbe7b9c070cb997e5d (patch)
tree1679304e1b5858dfc092edaaaec9de7a0f3ed69b
parent430506fb7757d6736988d75c8ea53c85f6c97da9 (diff)
downloadlibmts-io-5da5645c2dad56eb9654e4fbe7b9c070cb997e5d.tar.gz
libmts-io-5da5645c2dad56eb9654e4fbe7b9c070cb997e5d.tar.bz2
libmts-io-5da5645c2dad56eb9654e4fbe7b9c070cb997e5d.zip
[GP-1733] mPower R.6.3.X: L6G1 Support - libmts-io, radio-cmd, radio-query
- function getRegistrationCommands() implemented as pure virtual and overrided for every base radio model - minor indentation fixes - function getSimStatusSummary(Json::Value& jData) changed to process radio modems that do not have separate commands for the SIM presence check - function getManufacturer(std::string& sManufacturer) changed: AT command changet to 'AT+CGMI' - src/MTS_IO_QuectelRadio.cpp -- comments correction
-rw-r--r--include/mts/MTS_IO_CE910Radio.h2
-rw-r--r--include/mts/MTS_IO_CellularRadio.h2
-rw-r--r--include/mts/MTS_IO_DE910Radio.h4
-rw-r--r--include/mts/MTS_IO_EG25Radio.h2
-rw-r--r--include/mts/MTS_IO_EG95Radio.h2
-rw-r--r--include/mts/MTS_IO_GE910Radio.h3
-rw-r--r--include/mts/MTS_IO_HE910Radio.h4
-rw-r--r--include/mts/MTS_IO_LE866Radio.h2
-rw-r--r--include/mts/MTS_IO_LE910Radio.h2
-rw-r--r--include/mts/MTS_IO_ME910Radio.h2
-rw-r--r--src/MTS_IO_CE910Radio.cpp6
-rw-r--r--src/MTS_IO_CellularRadio.cpp76
-rw-r--r--src/MTS_IO_DE910Radio.cpp4
-rw-r--r--src/MTS_IO_EG25Radio.cpp4
-rw-r--r--src/MTS_IO_EG95Radio.cpp4
-rw-r--r--src/MTS_IO_GE910Radio.cpp6
-rw-r--r--src/MTS_IO_HE910Radio.cpp4
-rw-r--r--src/MTS_IO_LE866Radio.cpp4
-rw-r--r--src/MTS_IO_LE910Radio.cpp6
-rw-r--r--src/MTS_IO_ME910Radio.cpp6
-rw-r--r--src/MTS_IO_QuectelRadio.cpp6
-rw-r--r--src/MTS_IO_TelitRadio.cpp14
22 files changed, 112 insertions, 53 deletions
diff --git a/include/mts/MTS_IO_CE910Radio.h b/include/mts/MTS_IO_CE910Radio.h
index 58642cb..8d3b912 100644
--- a/include/mts/MTS_IO_CE910Radio.h
+++ b/include/mts/MTS_IO_CE910Radio.h
@@ -43,6 +43,8 @@ namespace MTS {
virtual ~CE910Radio(){};
CODE setRxDiversity(const Json::Value& jArgs);
+ virtual const std::vector<std::string> getRegistrationCommands() override;
+
protected:
private:
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h
index e985c21..68c1394 100644
--- a/include/mts/MTS_IO_CellularRadio.h
+++ b/include/mts/MTS_IO_CellularRadio.h
@@ -262,7 +262,7 @@ namespace MTS {
virtual std::string queryCGREGstring();
virtual void setCGREG(std::string value);
- const std::vector<std::string> getRegistrationCommands();
+ virtual const std::vector<std::string> getRegistrationCommands() = 0;
REGISTRATION parseRegResponse(std::string sResult);
CODE getRegistration(REGISTRATION& eRegistration, const std::string& sType);
diff --git a/include/mts/MTS_IO_DE910Radio.h b/include/mts/MTS_IO_DE910Radio.h
index 9f9b9ae..67964fc 100644
--- a/include/mts/MTS_IO_DE910Radio.h
+++ b/include/mts/MTS_IO_DE910Radio.h
@@ -41,7 +41,9 @@ namespace MTS {
DE910Radio(const std::string& sPort);
virtual ~DE910Radio(){};
- CODE setRxDiversity(const Json::Value& jArgs);
+ CODE setRxDiversity(const Json::Value& jArgs);
+
+ const std::vector<std::string> getRegistrationCommands() override;
protected:
diff --git a/include/mts/MTS_IO_EG25Radio.h b/include/mts/MTS_IO_EG25Radio.h
index e05fa7d..326b192 100644
--- a/include/mts/MTS_IO_EG25Radio.h
+++ b/include/mts/MTS_IO_EG25Radio.h
@@ -35,6 +35,8 @@ namespace MTS {
EG25Radio(const std::string& sPort);
virtual ~EG25Radio();
+ const std::vector<std::string> getRegistrationCommands() override;
+
protected:
private:
diff --git a/include/mts/MTS_IO_EG95Radio.h b/include/mts/MTS_IO_EG95Radio.h
index 6fb47c8..a238e94 100644
--- a/include/mts/MTS_IO_EG95Radio.h
+++ b/include/mts/MTS_IO_EG95Radio.h
@@ -35,6 +35,8 @@ namespace MTS {
EG95Radio(const std::string& sPort);
virtual ~EG95Radio();
+ const std::vector<std::string> getRegistrationCommands() override;
+
protected:
private:
diff --git a/include/mts/MTS_IO_GE910Radio.h b/include/mts/MTS_IO_GE910Radio.h
index 4904ea7..499933c 100644
--- a/include/mts/MTS_IO_GE910Radio.h
+++ b/include/mts/MTS_IO_GE910Radio.h
@@ -41,7 +41,8 @@ namespace MTS {
GE910Radio(const std::string& sPort);
virtual ~GE910Radio(){};
- CODE setRxDiversity(const Json::Value& jArgs);
+ CODE setRxDiversity(const Json::Value& jArgs);
+ const std::vector<std::string> getRegistrationCommands() override;
protected:
diff --git a/include/mts/MTS_IO_HE910Radio.h b/include/mts/MTS_IO_HE910Radio.h
index c8700da..54ad5a3 100644
--- a/include/mts/MTS_IO_HE910Radio.h
+++ b/include/mts/MTS_IO_HE910Radio.h
@@ -39,10 +39,12 @@ namespace MTS {
public:
virtual ~HE910Radio(){};
- CODE setRxDiversity(const Json::Value& jArgs);
+ CODE setRxDiversity(const Json::Value& jArgs);
+ const std::vector<std::string> getRegistrationCommands() override;
protected:
HE910Radio(const std::string& sHE910Model, const std::string& sPort);
+
private:
};
diff --git a/include/mts/MTS_IO_LE866Radio.h b/include/mts/MTS_IO_LE866Radio.h
index 2775e4d..a127f63 100644
--- a/include/mts/MTS_IO_LE866Radio.h
+++ b/include/mts/MTS_IO_LE866Radio.h
@@ -48,6 +48,8 @@ namespace MTS {
LE866Radio(const std::string& sLE866Model, const std::string& sPort);
virtual ~LE866Radio(){};
+ const std::vector<std::string> getRegistrationCommands() override;
+
protected:
private:
diff --git a/include/mts/MTS_IO_LE910Radio.h b/include/mts/MTS_IO_LE910Radio.h
index 6700ee3..e509c95 100644
--- a/include/mts/MTS_IO_LE910Radio.h
+++ b/include/mts/MTS_IO_LE910Radio.h
@@ -48,6 +48,8 @@ namespace MTS {
CODE setUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION mode) override;
CODE getUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION& mode) override;
+ const std::vector<std::string> getRegistrationCommands() override;
+
protected:
const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) override;
diff --git a/include/mts/MTS_IO_ME910Radio.h b/include/mts/MTS_IO_ME910Radio.h
index 93af86f..7c34009 100644
--- a/include/mts/MTS_IO_ME910Radio.h
+++ b/include/mts/MTS_IO_ME910Radio.h
@@ -36,6 +36,8 @@ namespace MTS {
virtual CODE setRxDiversity(const Json::Value& jArgs);
+ const std::vector<std::string> getRegistrationCommands() override;
+
protected:
private:
diff --git a/src/MTS_IO_CE910Radio.cpp b/src/MTS_IO_CE910Radio.cpp
index d1cad9b..f0ec560 100644
--- a/src/MTS_IO_CE910Radio.cpp
+++ b/src/MTS_IO_CE910Radio.cpp
@@ -41,5 +41,9 @@ CE910Radio::CE910Radio(const std::string& sPort)
ICellularRadio::CODE CE910Radio::setRxDiversity(const Json::Value& jArgs) {
/* Command string for CE radios: N/A */
- return FAILURE;
+ return NOT_APPLICABLE;
+}
+
+const std::vector<std::string> CE910Radio::getRegistrationCommands() {
+ return { "CREG" };
}
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp
index 069d5fa..3ce97ec 100644
--- a/src/MTS_IO_CellularRadio.cpp
+++ b/src/MTS_IO_CellularRadio.cpp
@@ -64,27 +64,41 @@ namespace {
// http://niviuk.free.fr/lte_band.php
const nameRangeMap EULTRAband[] =
{
- {"EUTRAN BAND1", 0, 599}, {"EUTRAN BAND2", 600, 1199},
- {"EUTRAN BAND3", 1200, 1949}, {"EUTRAN BAND4", 1950, 2399},
- {"EUTRAN BAND5", 2400, 2649}, {"EUTRAN BAND6", 2650, 2749},
- {"EUTRAN BAND7", 2750, 3449}, {"EUTRAN BAND8", 3450, 3799},
- {"EUTRAN BAND9", 3800, 4149}, {"EUTRAN BAND10", 4150, 4749},
- {"EUTRAN BAND11", 4750, 4999}, {"EUTRAN BAND12", 5000, 5179},
- {"EUTRAN BAND13", 5180, 5279}, {"EUTRAN BAND14", 5280, 5379},
- {"EUTRAN BAND17", 5730, 5849}, {"EUTRAN BAND18", 5850, 5999},
- {"EUTRAN BAND19", 6000, 6149}, {"EUTRAN BAND20", 6150, 6449},
- {"EUTRAN BAND21", 6450, 6525}, {"EUTRAN BAND22", 6600, 7399},
- {"EUTRAN BAND23", 7500, 7699}, {"EUTRAN BAND24", 7700, 8039},
- {"EUTRAN BAND25", 8040, 8689}, {"EUTRAN BAND26", 8690, 9039},
- {"EUTRAN BAND27", 9040, 9209}, {"EUTRAN BAND28", 9210, 9659},
- {"EUTRAN BAND29", 9660, 9769}, {"EUTRAN BAND30", 9770, 9869},
- {"EUTRAN BAND31", 9870, 9919}, {"EUTRAN BAND32", 9920, 10359},
- {"EUTRAN BAND33", 36000, 36199}, {"EUTRAN BAND34", 36200, 36349},
- {"EUTRAN BAND35", 36350, 36949}, {"EUTRAN BAND36", 36950, 37549},
- {"EUTRAN BAND37", 37550, 37749}, {"EUTRAN BAND38", 37750, 38249},
- {"EUTRAN BAND39", 38250, 38649}, {"EUTRAN BAND40", 38650, 39649},
- {"EUTRAN BAND41", 39650, 41589}, {"EUTRAN BAND42", 41590, 43589},
- {"EUTRAN BAND43", 43590, 45589}, {"EUTRAN BAND44", 45590, 46589}
+ {"EUTRAN BAND1", 0, 599}, {"EUTRAN BAND2", 600, 1199},
+ {"EUTRAN BAND3", 1200, 1949}, {"EUTRAN BAND4", 1950, 2399},
+ {"EUTRAN BAND5", 2400, 2649}, {"EUTRAN BAND6", 2650, 2749},
+ {"EUTRAN BAND7", 2750, 3449}, {"EUTRAN BAND8", 3450, 3799},
+ {"EUTRAN BAND9", 3800, 4149}, {"EUTRAN BAND10", 4150, 4749},
+ {"EUTRAN BAND11", 4750, 4999}, {"EUTRAN BAND12", 5000, 5179},
+ {"EUTRAN BAND13", 5180, 5279}, {"EUTRAN BAND14", 5280, 5379},
+ {"EUTRAN BAND17", 5730, 5849}, {"EUTRAN BAND18", 5850, 5999},
+ {"EUTRAN BAND19", 6000, 6149}, {"EUTRAN BAND20", 6150, 6449},
+ {"EUTRAN BAND21", 6450, 6525}, {"EUTRAN BAND22", 6600, 7399},
+ {"EUTRAN BAND23", 7500, 7699}, {"EUTRAN BAND24", 7700, 8039},
+ {"EUTRAN BAND25", 8040, 8689}, {"EUTRAN BAND26", 8690, 9039},
+ {"EUTRAN BAND27", 9040, 9209}, {"EUTRAN BAND28", 9210, 9659},
+ {"EUTRAN BAND29", 9660, 9769}, {"EUTRAN BAND30", 9770, 9869},
+ {"EUTRAN BAND31", 9870, 9919}, {"EUTRAN BAND32", 9920, 10359},
+ {"EUTRAN BAND33", 36000, 36199}, {"EUTRAN BAND34", 36200, 36349},
+ {"EUTRAN BAND35", 36350, 36949}, {"EUTRAN BAND36", 36950, 37549},
+ {"EUTRAN BAND37", 37550, 37749}, {"EUTRAN BAND38", 37750, 38249},
+ {"EUTRAN BAND39", 38250, 38649}, {"EUTRAN BAND40", 38650, 39649},
+ {"EUTRAN BAND41", 39650, 41589}, {"EUTRAN BAND42", 41590, 43589},
+ {"EUTRAN BAND43", 43590, 45589}, {"EUTRAN BAND44", 45590, 46589},
+ {"EUTRAN BAND45", 46590, 46789}, {"EUTRAN BAND46", 46790, 54539},
+ {"EUTRAN BAND47", 54540, 55239}, {"EUTRAN BAND48", 55240, 56739},
+ {"EUTRAN BAND49", 56740, 58239}, {"EUTRAN BAND50", 58240, 59089},
+ {"EUTRAN BAND51", 59090, 59139}, {"EUTRAN BAND52", 59140, 60139},
+ {"EUTRAN BAND53", 60140, 60254},
+ {"EUTRAN BAND65", 65536, 66435}, {"EUTRAN BAND66", 66436, 67335},
+ {"EUTRAN BAND67", 67336, 67535}, {"EUTRAN BAND68", 67536, 67835},
+ {"EUTRAN BAND69", 67836, 68335}, {"EUTRAN BAND70", 68336, 68585},
+ {"EUTRAN BAND71", 68586, 68935}, {"EUTRAN BAND72", 68936, 68985},
+ {"EUTRAN BAND73", 68986, 69035}, {"EUTRAN BAND74", 69036, 69465},
+ {"EUTRAN BAND75", 69466, 70315}, {"EUTRAN BAND76", 70316, 70365},
+ {"EUTRAN BAND85", 70366, 70545},
+ {"EUTRAN BAND87", 70546, 70595}, {"EUTRAN BAND88", 70596, 70645},
+ {"EUTRAN BAND103", 70646, 70655}
};
}
@@ -225,7 +239,7 @@ ICellularRadio::CODE CellularRadio::getHardware(std::string& sHardware) {
ICellularRadio::CODE CellularRadio::getManufacturer(std::string& sManufacturer) {
printTrace("%s| Get Manufacturer", m_sName.c_str());
sManufacturer = ICellularRadio::VALUE_NOT_SUPPORTED;
- std::string sCmd("AT+GMI");
+ std::string sCmd("AT+CGMI");
std::string sResult = sendCommand(sCmd);
size_t pos = sResult.find(ICellularRadio::RSP_OK);
if (pos == std::string::npos) {
@@ -309,6 +323,13 @@ ICellularRadio::CODE CellularRadio::getSimStatusSummary(Json::Value& jData) {
do {
retCode = getIsSimInserted(bIsSimInserted);
+
+ // Some radio modems do not have separate commands for the SIM presence check
+ if (retCode == NOT_APPLICABLE) {
+ retCode = SUCCESS;
+ bIsSimInserted = true;
+ }
+
if (retCode != SUCCESS) {
break;
}
@@ -841,17 +862,6 @@ void CellularRadio::initMipProfile(Json::Value& jData) {
jData[ICellularRadio::KEY_MIP_MNHASS] = false;
}
-const std::vector<std::string> CellularRadio::getRegistrationCommands() {
- std::string sType;
- convertModelToType(getName(), sType);
-
- if (sType == VALUE_TYPE_LTE) {
- return { "CREG", "CGREG", "CEREG" };
- } else {
- return { "CREG", "CGREG" };
- }
-}
-
ICellularRadio::REGISTRATION CellularRadio::parseRegResponse(std::string sResult) {
size_t start = sResult.find(',');
size_t stop = sResult.find(' ', start);
diff --git a/src/MTS_IO_DE910Radio.cpp b/src/MTS_IO_DE910Radio.cpp
index 26668f1..d45515d 100644
--- a/src/MTS_IO_DE910Radio.cpp
+++ b/src/MTS_IO_DE910Radio.cpp
@@ -50,3 +50,7 @@ ICellularRadio::CODE DE910Radio::setRxDiversity(const Json::Value& jArgs) {
return sendBasicCommand(sCmd);
}
+
+const std::vector<std::string> DE910Radio::getRegistrationCommands() {
+ return { "CREG" };
+} \ No newline at end of file
diff --git a/src/MTS_IO_EG25Radio.cpp b/src/MTS_IO_EG25Radio.cpp
index c6d1c34..effac4c 100644
--- a/src/MTS_IO_EG25Radio.cpp
+++ b/src/MTS_IO_EG25Radio.cpp
@@ -38,4 +38,8 @@ EG25Radio::~EG25Radio() {
ICellularRadio::CODE EG25Radio::getSupportedCellularModes(CELLULAR_MODES &networks) {
networks = static_cast<CELLULAR_MODES>(CELLULAR_MODE_2G | CELLULAR_MODE_3G | CELLULAR_MODE_4G);
return SUCCESS;
+}
+
+const std::vector<std::string> EG25Radio::getRegistrationCommands() {
+ return { "CREG", "CGREG", "CEREG" };
} \ No newline at end of file
diff --git a/src/MTS_IO_EG95Radio.cpp b/src/MTS_IO_EG95Radio.cpp
index 83d6489..8dc79a3 100644
--- a/src/MTS_IO_EG95Radio.cpp
+++ b/src/MTS_IO_EG95Radio.cpp
@@ -52,4 +52,8 @@ ICellularRadio::CODE EG95Radio::getSupportedCellularModes(CELLULAR_MODES &networ
}
return SUCCESS;
+}
+
+const std::vector<std::string> EG95Radio::getRegistrationCommands() {
+ return { "CREG", "CGREG", "CEREG" };
} \ No newline at end of file
diff --git a/src/MTS_IO_GE910Radio.cpp b/src/MTS_IO_GE910Radio.cpp
index 61332b5..22a6482 100644
--- a/src/MTS_IO_GE910Radio.cpp
+++ b/src/MTS_IO_GE910Radio.cpp
@@ -41,5 +41,9 @@ GE910Radio::GE910Radio(const std::string& sPort)
ICellularRadio::CODE GE910Radio::setRxDiversity(const Json::Value& jArgs) {
/* Command string for GE radios: N/A */
- return FAILURE;
+ return NOT_APPLICABLE;
}
+
+const std::vector<std::string> GE910Radio::getRegistrationCommands() {
+ return { "CREG", "CGREG" };
+} \ No newline at end of file
diff --git a/src/MTS_IO_HE910Radio.cpp b/src/MTS_IO_HE910Radio.cpp
index 4c0a759..a1fddbd 100644
--- a/src/MTS_IO_HE910Radio.cpp
+++ b/src/MTS_IO_HE910Radio.cpp
@@ -48,3 +48,7 @@ ICellularRadio::CODE HE910Radio::setRxDiversity(const Json::Value& jArgs) {
return sendBasicCommand(sCmd);
}
+
+const std::vector<std::string> HE910Radio::getRegistrationCommands() {
+ return { "CREG", "CGREG" };
+}
diff --git a/src/MTS_IO_LE866Radio.cpp b/src/MTS_IO_LE866Radio.cpp
index 85b8dc3..f695707 100644
--- a/src/MTS_IO_LE866Radio.cpp
+++ b/src/MTS_IO_LE866Radio.cpp
@@ -36,4 +36,6 @@ LE866Radio::LE866Radio(const std::string& sLE866Model, const std::string& sPort)
}
-
+const std::vector<std::string> LE866Radio::getRegistrationCommands() {
+ return { "CREG", "CGREG", "CEREG" };
+}
diff --git a/src/MTS_IO_LE910Radio.cpp b/src/MTS_IO_LE910Radio.cpp
index 2f1debb..3b2864b 100644
--- a/src/MTS_IO_LE910Radio.cpp
+++ b/src/MTS_IO_LE910Radio.cpp
@@ -64,7 +64,7 @@ ICellularRadio::CODE LE910Radio::getModemLocation(std::string& sLocation) {
}
printDebug("modem reply: [%s]", sResult.c_str());
size_t start = sResult.find(':');
- if (start==std::string::npos){
+ if (start==std::string::npos) {
start = 0;
} else {
start++;
@@ -230,3 +230,7 @@ const std::vector<std::string>& LE910Radio::getDiagCommands(bool bIsSimReady) {
return vSimLockedCommands;
}
}
+
+const std::vector<std::string> LE910Radio::getRegistrationCommands() {
+ return { "CREG", "CGREG", "CEREG" };
+}
diff --git a/src/MTS_IO_ME910Radio.cpp b/src/MTS_IO_ME910Radio.cpp
index ad3e7ec..1f4ff58 100644
--- a/src/MTS_IO_ME910Radio.cpp
+++ b/src/MTS_IO_ME910Radio.cpp
@@ -31,5 +31,9 @@ ME910Radio::ME910Radio(const std::string& sME910Model, const std::string& sPort)
}
ICellularRadio::CODE ME910Radio::setRxDiversity(const Json::Value& jArgs) {
- return FAILURE;
+ return NOT_APPLICABLE;
+}
+
+const std::vector<std::string> ME910Radio::getRegistrationCommands() {
+ return { "CREG", "CGREG", "CEREG" };
}
diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp
index 3a5924c..af7adde 100644
--- a/src/MTS_IO_QuectelRadio.cpp
+++ b/src/MTS_IO_QuectelRadio.cpp
@@ -288,7 +288,7 @@ CellularRadio::CODE QuectelRadio::getNetworkStatus(Json::Value& jData) {
Json::Value jQuectelDebug;
if (vParts.size() < 3) {
- printDebug("%s| Network Status command reponse is an unknown format: [%s][%s]", getName().c_str(), sCmd.c_str(), sResult.c_str());
+ printDebug("%s| Network Status command response is an unknown format: [%s][%s]", getName().c_str(), sCmd.c_str(), sResult.c_str());
printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str());
return SUCCESS; //return SUCCESS because getCommonNetworkStats() succeeded at top of this function
} else {
@@ -410,7 +410,7 @@ CellularRadio::CODE QuectelRadio::getNetworkStatus(Json::Value& jData) {
jDebug[ICellularRadio::KEY_SD] = sValue;
}
- // LAC is not provided by AT+QENG in WCDMA mode. Use another command instead
+ // LAC is not provided by AT+QENG in LTE mode. Use another command instead
jData[ICellularRadio::KEY_LAC] = queryLteLac();
jData["quectelDebug"] = jQuectelDebug;
@@ -842,7 +842,7 @@ ICellularRadio::CODE QuectelRadio::convertToActiveBand(const std::string& sQuect
ICellularRadio::CODE QuectelRadio::setCellularMode(CELLULAR_MODES networks) {
std::string prefNet;
unsigned int prefOnly = 0, prefCount = 0;
- for (int i = sizeof(networks)*CHAR_BIT-1; i>=0; --i){
+ for (int i = sizeof(networks)*CHAR_BIT-1; i>=0; --i) {
switch (1<<i & networks) {
case ICellularRadio::CELLULAR_MODE_2G: prefNet += "01" ; prefOnly = 1; prefCount++; break;
case ICellularRadio::CELLULAR_MODE_3G: prefNet += "0302"; prefOnly = 2; prefCount++; break;
diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp
index 4a0a8b2..704f692 100644
--- a/src/MTS_IO_TelitRadio.cpp
+++ b/src/MTS_IO_TelitRadio.cpp
@@ -110,12 +110,12 @@ ICellularRadio::CODE TelitRadio::getVendorFirmware(std::string& sVendorFirmware)
// Not Found. Then we will use "AT+CGMR" + "AT#CFVR"
rc = getFirmware(sFirmware);
- if (rc != SUCCESS){
+ if (rc != SUCCESS) {
break;
}
rc = getFirmwareBuild(sFirmwareBuild);
- if (rc != SUCCESS){
+ if (rc != SUCCESS) {
break;
}
@@ -714,7 +714,7 @@ ICellularRadio::CODE TelitRadio::getSupportedCellularModes(CELLULAR_MODES &netwo
networks = CELLULAR_MODE_NA;
std::set<int> wds;
- if ( TelitRadio::wdsList(wds) != SUCCESS ) {
+ if ( wdsList(wds) != SUCCESS ) {
return FAILURE;
}
for(const auto &it : wds) {
@@ -729,8 +729,7 @@ ICellularRadio::CODE TelitRadio::getSupportedCellularModes(CELLULAR_MODES &netwo
return SUCCESS;
}
-ICellularRadio::CODE TelitRadio::wdsList(std::set<int> &wds)
-{
+ICellularRadio::CODE TelitRadio::wdsList(std::set<int> &wds) {
std::string sCmd("AT+WS46=?");
std::string cmdResult = sendCommand(sCmd);
if (cmdResult.find("+WS46:") == std::string::npos) {
@@ -745,8 +744,7 @@ ICellularRadio::CODE TelitRadio::wdsList(std::set<int> &wds)
std::string s = MTS::Text::split(cmdResult, '(')[1];
s = MTS::Text::split(s, ')')[0];
std::vector<std::string>v = MTS::Text::split(s, ',');
- for(const auto &it : v)
- {
+ for(const auto &it : v) {
if (it.find("-") != std::string::npos) {
const std::vector<std::string> &r = MTS::Text::split(it, "-");
int begin, end;
@@ -778,7 +776,7 @@ ICellularRadio::CODE TelitRadio::wdsList(std::set<int> &wds)
ICellularRadio::CODE TelitRadio::setCellularMode(CELLULAR_MODES networks) {
std::set<int> supportedWds;
- if ( TelitRadio::wdsList(supportedWds) != SUCCESS ) {
+ if ( wdsList(supportedWds) != SUCCESS ) {
return FAILURE;
}