diff options
author | sdesai <sdesai@multitech.com> | 2023-03-15 15:22:04 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2023-04-26 17:29:28 -0500 |
commit | 576eb04e2d42e3b9c5fa40748d1d190a457fa1f8 (patch) | |
tree | cee3134469ec1e843dbe337dc65dda934b9728f3 /src/MTS_IO_SequansRadio.cpp | |
parent | 0f15b7265be65cbd9f66a68f6d1685b58b13e501 (diff) | |
download | libmts-io-576eb04e2d42e3b9c5fa40748d1d190a457fa1f8.tar.gz libmts-io-576eb04e2d42e3b9c5fa40748d1d190a457fa1f8.tar.bz2 libmts-io-576eb04e2d42e3b9c5fa40748d1d190a457fa1f8.zip |
GP-139:Support Portal Case #5086148: use Cellular Radio timeas alternative to GPS or NTP
Diffstat (limited to 'src/MTS_IO_SequansRadio.cpp')
-rw-r--r-- | src/MTS_IO_SequansRadio.cpp | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/src/MTS_IO_SequansRadio.cpp b/src/MTS_IO_SequansRadio.cpp index 380dd80..33bd068 100644 --- a/src/MTS_IO_SequansRadio.cpp +++ b/src/MTS_IO_SequansRadio.cpp @@ -282,6 +282,7 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusTxPower(Json::Value& jData, J std::string sResult; std::string sPrefix; std::vector<std::string> vParts; + int iValue; CODE rc; sCmd = "AT+SQNQRUP?"; @@ -311,7 +312,7 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusTxPower(Json::Value& jData, J break; // invalid, not known or not detectable } if (fTxPow < -255 || fTxPow > 99) { - printDebug("%s| Network Status command returned unexpected value of txPower: [%s][%f]", getName().c_str(), sCmd.c_str(), fTxPow); + printDebug("%s| Network Status command returned unexpected value of txPower: [%s][%d]", getName().c_str(), sCmd.c_str(), iValue); break; } jDebug[ICellularRadio::KEY_TXPWR] = vParts[0]; @@ -533,27 +534,6 @@ ICellularRadio::CODE SequansRadio::getSimLockAttemptsByType(const std::string& s return SUCCESS; } -std::vector<std::string> SequansRadio::getSupportedPdpContextAuthTypes() const { - return { - VALUE_PDP_CONTEXT_AUTH_TYPE_NONE, - VALUE_PDP_CONTEXT_AUTH_TYPE_PAP, - VALUE_PDP_CONTEXT_AUTH_TYPE_CHAP - }; -} - -ICellularRadio::CODE SequansRadio::isPdpContextAuthSupported(bool& isSupported) { - isSupported = false; - return SUCCESS; -} - -ICellularRadio::CODE SequansRadio::fillPdpContextAuthFields(Json::Value& jData) { - return NOT_APPLICABLE; -} - -ICellularRadio::CODE SequansRadio::setPdpContextAuth(const PdpContextInfo& pdpContext) { - return NOT_APPLICABLE; -} - const std::vector<std::string>& SequansRadio::getDiagCommands(bool) { // Declare as static to initialize only when used, but cache the results. const static std::vector<std::string> vCommands { @@ -588,3 +568,28 @@ const std::vector<std::string>& SequansRadio::getDiagCommands(bool) { return vCommands; } + +ICellularRadio::CODE SequansRadio::getTimeUTC(void) { + printTrace("%s| Get Time in UTC", getName().c_str()); + + // Set year format in YYYY first, in case it is in YY format to get accurate year + std::string sCmdCSDF("AT+CSDF=1,2"); + std::string sRes = sendCommand(sCmdCSDF); + size_t endr = sRes.find(ICellularRadio::RSP_OK); + + if (endr == std::string::npos) { + printWarning("%s| Unable to set year format for radio using command [%s]", getName().c_str(), sCmdCSDF.c_str()); + return FAILURE; + } + + // Set year format in YYYY first, in case it is in YY format to get accurate year + std::string sCmdCTZU("AT+CTZU=1"); + sRes = sendCommand(sCmdCTZU); + size_t endc = sRes.find(ICellularRadio::RSP_OK); + + if (endc == std::string::npos) { + printWarning("%s| Unable to set automatic time zone update for radio using command [%s]", getName().c_str(), sCmdCTZU.c_str()); + return FAILURE; + } + return SUCCESS; +}
\ No newline at end of file |