summaryrefslogtreecommitdiff
path: root/src/MTS_IO_EG95Radio.cpp
diff options
context:
space:
mode:
authorAndrii Pientsov <andrii.pientsov@globallogic.com>2020-02-13 15:59:34 +0200
committerMykyta Dorokhin <mykyta.dorokhin@globallogic.com>2020-02-13 16:57:01 +0200
commit24310f73209b97dd805d09dcaa504d02740d1c23 (patch)
treea0d3033fae481fd3393bae759fe76b8ad2fe805f /src/MTS_IO_EG95Radio.cpp
parent53f54b1929d08869494d1f724814cd7ae77820f5 (diff)
downloadlibmts-io-24310f73209b97dd805d09dcaa504d02740d1c23.tar.gz
libmts-io-24310f73209b97dd805d09dcaa504d02740d1c23.tar.bz2
libmts-io-24310f73209b97dd805d09dcaa504d02740d1c23.zip
Commands CREG, CGREG and CEREG should be utilized to get registered status
Diffstat (limited to 'src/MTS_IO_EG95Radio.cpp')
-rw-r--r--src/MTS_IO_EG95Radio.cpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/MTS_IO_EG95Radio.cpp b/src/MTS_IO_EG95Radio.cpp
index cdd750e..f1c040a 100644
--- a/src/MTS_IO_EG95Radio.cpp
+++ b/src/MTS_IO_EG95Radio.cpp
@@ -87,74 +87,3 @@ ICellularRadio::CODE EG95Radio::setCellularMode(CELLULAR_MODES networks) {
}
return SUCCESS;
}
-
-ICellularRadio::REGISTRATION parseRegResponse(std::string sResult)
-{
- size_t start = sResult.find(',');
- size_t stop = sResult.find(' ', start);
- std::string sRegStat = sResult.substr(start + 1, stop - start - 1);
- int32_t value;
- sscanf(sRegStat.c_str(), "%d", &value);
-
- return (ICellularRadio::REGISTRATION)value;
-}
-
-ICellularRadio::CODE EG95Radio::getRegistration(REGISTRATION& eRegistration) {
- std::string sCmd;
- std::string sResp;
-
- // On the EG95 we need to check CREG, CGREG, and CEREG for possible success.
- // Depending on the carrier, roaming, and some other factors the registration
- // will come back differently depending on the type of connection that is possible.
-
- sCmd = "AT+CREG?";
- sResp = "+CREG: ";
- std::string sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 5000);
- if (sResult.find(sResp) == std::string::npos) {
- if(sResult.size() == 0) {
- printDebug("%s| Registration command returned no response: [EG95]");
- }
- printDebug("%s| Registration command returned unexpected response: [EG95]");
- }
-
- eRegistration = parseRegResponse(sResult);
- if (eRegistration == REGISTERED) {
- return SUCCESS;
- }
-
-
- sCmd = "AT+CGREG?";
- sResp = "+CGREG: ";
- sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 5000);
- if (sResult.find(sResp) == std::string::npos) {
- if(sResult.size() == 0) {
- printDebug("%s| Registration command returned no response: [EG95]");
- }
- printDebug("%s| Registration command returned unexpected response: [EG95]");
- }
-
-
- eRegistration = parseRegResponse(sResult);
- if (eRegistration == REGISTERED) {
- return SUCCESS;
- }
-
- sCmd = "AT+CEREG?";
- sResp = "+CEREG: ";
- sResult = sendCommand(sCmd, DEFAULT_BAIL_STRINGS, 5000);
- if (sResult.find(sResp) == std::string::npos) {
- if(sResult.size() == 0) {
- printDebug("%s| Registration command returned no response: [EG95]");
- return NO_RESPONSE;
- }
- printDebug("%s| Registration command returned unexpected response: [EG95]");
- return FAILURE;
- }
-
- eRegistration = parseRegResponse(sResult);
- if (eRegistration == REGISTERED) {
- return SUCCESS;
- }
-
- return SUCCESS;
-}