From 289c724a4706e6f5ec2e73353502384671940c1c Mon Sep 17 00:00:00 2001 From: sdesai Date: Thu, 2 Mar 2023 14:20:52 -0600 Subject: Support Portal Case #5086148: use Cellular Radio timeas alternative to GPS or NTP --- src/MTS_IO_CellularRadio.cpp | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 3ce97ec..1c385ae 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -581,6 +581,7 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi std::string sCmd("AT+CCLK?"); std::string sResult = sendCommand(sCmd); size_t end = sResult.find(ICellularRadio::RSP_OK); + if (end == std::string::npos) { printWarning("%s| Unable to get Time from radio using command [%s]", m_sName.c_str(), sCmd.c_str()); return FAILURE; @@ -605,37 +606,15 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi return FAILURE; } - //The Date format is YY/MM/DD -> Change to MM/DD/YY - sDate = vDateParts[1] + "/" + vDateParts[2] + "/" + vDateParts[0]; + // Append "20" to the year. format is YYYY-MM-DD + sDate = "20" + vDateParts[0] + "-" + vDateParts[1] + "-" + vDateParts[2]; vParts = MTS::Text::split(vParts[1], '-'); - if(vParts.size() != 2) { + if(vParts.size() != 1) { printWarning("%s| Unable to parse Time from response [%s]", m_sName.c_str(), sResult.c_str()); return FAILURE; } sTime = vParts[0]; - - int32_t iZoneUnits; //the difference, expressed in quarters of an hour, between the local time and GMT - if(!MTS::Text::parse(iZoneUnits, MTS::Text::strip(vParts[1], '+'))) { - printWarning("%s| Unable to parse Time Zone from response [%s]", m_sName.c_str(), sResult.c_str()); - return FAILURE; - } - - int32_t iZone = iZoneUnits/4; //Divide by 4 to get hours difference - int32_t iZonePartial = (iZoneUnits % 4) * 15; //Remainder in minutes - std::string sPlusSign = "+"; - if(iZonePartial < 0) { - //Remove negative sign from partial and clear plus sign component - iZonePartial *= -1; - sPlusSign = ""; - } - std::stringstream ss; - ss << sPlusSign << iZone; - if(iZonePartial != 0) { - ss << ":" << iZonePartial; - } - - sTimeZone = ss.str(); return SUCCESS; } else { -- cgit v1.2.3 From 2e2359fd17c4d1fb7e7ef37aceccf766dd262d0b Mon Sep 17 00:00:00 2001 From: Mykola Salomatin Date: Wed, 15 Mar 2023 10:46:04 +0200 Subject: Fixed use of uninitialized variable --- src/MTS_IO_SequansRadio.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/MTS_IO_SequansRadio.cpp b/src/MTS_IO_SequansRadio.cpp index 8133bbf..380dd80 100644 --- a/src/MTS_IO_SequansRadio.cpp +++ b/src/MTS_IO_SequansRadio.cpp @@ -282,7 +282,6 @@ ICellularRadio::CODE SequansRadio::getNetworkStatusTxPower(Json::Value& jData, J std::string sResult; std::string sPrefix; std::vector vParts; - int iValue; CODE rc; sCmd = "AT+SQNQRUP?"; @@ -312,7 +311,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][%d]", getName().c_str(), sCmd.c_str(), iValue); + printDebug("%s| Network Status command returned unexpected value of txPower: [%s][%f]", getName().c_str(), sCmd.c_str(), fTxPow); break; } jDebug[ICellularRadio::KEY_TXPWR] = vParts[0]; -- cgit v1.2.3 From 050834e3cdd0f5f56ba15b09ca568ac6312c7699 Mon Sep 17 00:00:00 2001 From: sdesai Date: Wed, 15 Mar 2023 15:22:04 -0500 Subject: GP-139:Support Portal Case #5086148: use Cellular Radio timeas alternative to GPS or NTP --- include/mts/MTS_IO_ICellularRadio.h | 2 +- include/mts/MTS_IO_QuectelRadio.h | 2 +- include/mts/MTS_IO_SequansRadio.h | 2 +- include/mts/MTS_IO_TelitRadio.h | 2 +- src/MTS_IO_CellularRadio.cpp | 57 ++++++++++++++++++++++++++++++------- src/MTS_IO_QuectelRadio.cpp | 25 ++++++++++++++++ src/MTS_IO_SequansRadio.cpp | 25 ++++++++++++++++ src/MTS_IO_TelitRadio.cpp | 36 +++++++++++++++++++++++ 8 files changed, 137 insertions(+), 14 deletions(-) diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index 0523236..da8e130 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -717,7 +717,7 @@ namespace MTS { * CODE::FAILURE otherwise. */ virtual CODE getDiagnostics(std::string& sDiagReport) = 0; - + virtual CODE getTimeUTC(void) = 0; }; } } diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h index 4315cb3..7015acb 100644 --- a/include/mts/MTS_IO_QuectelRadio.h +++ b/include/mts/MTS_IO_QuectelRadio.h @@ -86,7 +86,7 @@ namespace MTS { CODE setRxDiversity(const Json::Value& jArgs) override; const std::vector& getDiagCommands(bool bIsSimReady = true) override; - + CODE getTimeUTC(void) override; private: // private variable to save old firmware versions during FOTA std::string m_sQuectelFirmware; diff --git a/include/mts/MTS_IO_SequansRadio.h b/include/mts/MTS_IO_SequansRadio.h index 11f2c91..d61ae67 100644 --- a/include/mts/MTS_IO_SequansRadio.h +++ b/include/mts/MTS_IO_SequansRadio.h @@ -49,7 +49,7 @@ namespace MTS { CODE setRxDiversity(const Json::Value& jArgs) override; const std::vector getRegistrationCommands() override; - + CODE getTimeUTC(void) override; protected: SequansRadio(const std::string& sName, const std::string& sRadioPort); diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index d198969..01897ac 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -51,7 +51,7 @@ namespace MTS { CODE fumoLocalApply(UpdateCb& stepCb) override; CODE getSelectedBandsRaw(std::string& sRawBands) override; - + CODE getTimeUTC(void) override; protected: TelitRadio(const std::string& sName, const std::string& sRadioPort); diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 1c385ae..8cdaf44 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -577,6 +577,13 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi sDate = ""; sTime = ""; sTimeZone = ""; + std::vector vTimeParts; + std::string sSign = "+"; + + if(getTimeUTC() == FAILURE) { + printWarning("%s| Unable to set Time Parameters for radio [%s]", m_sName.c_str()); + return FAILURE;; + } std::string sCmd("AT+CCLK?"); std::string sResult = sendCommand(sCmd); @@ -588,7 +595,7 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi } size_t start = sResult.find("CCLK: "); - if(start != std::string::npos) { + if (start != std::string::npos) { start += sizeof("CCLK: "); std::string sValue = MTS::Text::trim(sResult.substr(start, end - start)); sValue = MTS::Text::strip(sValue, '"'); @@ -599,26 +606,56 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi return FAILURE; } - std::vector vDateParts = MTS::Text::split(vParts[0], '/'); if(vDateParts.size() != 3) { - printWarning("%s| Unable to parse Date from response [%s]", m_sName.c_str(), sResult.c_str()); + printWarning("%s| Unable to parse Date parts from response [%s]", m_sName.c_str(), sResult.c_str()); return FAILURE; } - // Append "20" to the year. format is YYYY-MM-DD - sDate = "20" + vDateParts[0] + "-" + vDateParts[1] + "-" + vDateParts[2]; + // The format is YYYY-MM-DD + sDate = vDateParts[0] + "-" + vDateParts[1] + "-" + vDateParts[2]; + + sTime = (vParts[1]); + + //E.g. 20:39:34-16. Split time and zone with + or - sign. + size_t psign = sTime.find("+"); + size_t nsign = sTime.find("-"); + + if (psign != std::string::npos) { + vTimeParts = MTS::Text::split(vParts[1], '+'); + } else if (nsign != std::string::npos) { + vTimeParts = MTS::Text::split(vParts[1], '-'); + sSign = "-"; + } - vParts = MTS::Text::split(vParts[1], '-'); - if(vParts.size() != 1) { - printWarning("%s| Unable to parse Time from response [%s]", m_sName.c_str(), sResult.c_str()); + if(vTimeParts.size() != 2) { + printWarning("%s| Unable to parse Time Zone from response [%s], size %d", m_sName.c_str(), sResult.c_str(),vTimeParts.size()); return FAILURE; } - sTime = vParts[0]; + + //Get just the UTC time without zone info + sTime = (vTimeParts[0]); + + int32_t iZoneUnits = stoi(vTimeParts[1]); //the difference, expressed in quarters of an hour, between the local time and GMT + int32_t iZone = iZoneUnits/4; //Divide by 4 to get hours difference + int32_t iZonePartial = (iZoneUnits % 4) * 15; //Remainder in minutes + + if (iZonePartial < 0) { + //Remove negative sign from partial and clear sign component + iZonePartial *= -1; + sSign = ""; + } + std::stringstream ss; + ss << sSign << iZone; + if(iZonePartial != 0) { + ss << ":" << iZonePartial; + } + + sTimeZone = ss.str(); return SUCCESS; } else { - printWarning("%s| Unable to get Time from radio using command [%s]", m_sName.c_str(), sCmd.c_str()); + printWarning("%s| Unable to parse Time from radio using command [%s]", m_sName.c_str(), sCmd.c_str()); } return FAILURE; diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index 0c0c8ab..655fb38 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -1675,3 +1675,28 @@ const std::vector& QuectelRadio::getDiagCommands(bool) { return vCommands; } + +ICellularRadio::CODE QuectelRadio::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 command enables/disables the automatic time zone update + 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 diff --git a/src/MTS_IO_SequansRadio.cpp b/src/MTS_IO_SequansRadio.cpp index a48a309..33bd068 100644 --- a/src/MTS_IO_SequansRadio.cpp +++ b/src/MTS_IO_SequansRadio.cpp @@ -568,3 +568,28 @@ const std::vector& 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 diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp index 21af65d..2c50208 100644 --- a/src/MTS_IO_TelitRadio.cpp +++ b/src/MTS_IO_TelitRadio.cpp @@ -1212,3 +1212,39 @@ const std::vector& TelitRadio::getDiagCommands(bool) { return vCommands; } + +ICellularRadio::CODE TelitRadio::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 command enables/disables the automatic time zone update via NITZ. + 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 year format for radio using command [%s]", getName().c_str(), sCmdCTZU.c_str()); + return FAILURE; + } + + //Enables/disables the automatic date/time updating and the + //Full Network Name applying. It enables also the #NITZ URC in the format. + std::string sCmdNITZ("AT#NITZ"); + sRes = sendCommand(sCmdNITZ); + size_t endn = sRes.find(ICellularRadio::RSP_OK); + + if (endn == std::string::npos) { + printWarning("%s| Unable to set automatic time zone update for radio using command [%s]", getName().c_str(), sCmdNITZ.c_str()); + return FAILURE; + } + return SUCCESS; +} \ No newline at end of file -- cgit v1.2.3 From 8fce7442bbc63b744905f9febc21aad9cf5074fd Mon Sep 17 00:00:00 2001 From: sdesai Date: Mon, 20 Mar 2023 14:32:37 -0500 Subject: Support Portal Case #5086148: use Cellular Radio timeas alternative to GPS or NTP --- include/mts/MTS_IO_CellularRadio.h | 1 + include/mts/MTS_IO_ICellularRadio.h | 1 - include/mts/MTS_IO_QuectelRadio.h | 2 +- include/mts/MTS_IO_SequansRadio.h | 3 ++- include/mts/MTS_IO_TelitRadio.h | 3 +-- src/MTS_IO_CellularRadio.cpp | 2 +- src/MTS_IO_QuectelRadio.cpp | 28 +++++++++++++--------------- src/MTS_IO_SequansRadio.cpp | 26 ++++++++++++-------------- src/MTS_IO_TelitRadio.cpp | 37 ++++++++++++------------------------- 9 files changed, 43 insertions(+), 60 deletions(-) diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index 68c1394..0af531b 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -277,6 +277,7 @@ namespace MTS { * @return the list of AT commands (strings). */ virtual const std::vector& getDiagCommands(bool bIsSimReady = true) = 0; + virtual CODE setTimeFormat () = 0; class RadioBandMap : public MTS::NonCopyable { public: diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index da8e130..d5b5f18 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -717,7 +717,6 @@ namespace MTS { * CODE::FAILURE otherwise. */ virtual CODE getDiagnostics(std::string& sDiagReport) = 0; - virtual CODE getTimeUTC(void) = 0; }; } } diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h index 7015acb..a8d37f2 100644 --- a/include/mts/MTS_IO_QuectelRadio.h +++ b/include/mts/MTS_IO_QuectelRadio.h @@ -86,7 +86,7 @@ namespace MTS { CODE setRxDiversity(const Json::Value& jArgs) override; const std::vector& getDiagCommands(bool bIsSimReady = true) override; - CODE getTimeUTC(void) override; + CODE setTimeFormat() override; private: // private variable to save old firmware versions during FOTA std::string m_sQuectelFirmware; diff --git a/include/mts/MTS_IO_SequansRadio.h b/include/mts/MTS_IO_SequansRadio.h index d61ae67..30f4875 100644 --- a/include/mts/MTS_IO_SequansRadio.h +++ b/include/mts/MTS_IO_SequansRadio.h @@ -49,7 +49,7 @@ namespace MTS { CODE setRxDiversity(const Json::Value& jArgs) override; const std::vector getRegistrationCommands() override; - CODE getTimeUTC(void) override; + protected: SequansRadio(const std::string& sName, const std::string& sRadioPort); @@ -57,6 +57,7 @@ namespace MTS { CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; const std::vector& getDiagCommands(bool bIsSimReady = true) override; + virtual CODE setTimeFormat() override; private: /* diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index 01897ac..7011ef3 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -51,7 +51,6 @@ namespace MTS { CODE fumoLocalApply(UpdateCb& stepCb) override; CODE getSelectedBandsRaw(std::string& sRawBands) override; - CODE getTimeUTC(void) override; protected: TelitRadio(const std::string& sName, const std::string& sRadioPort); @@ -76,7 +75,7 @@ namespace MTS { const std::vector& getDiagCommands(bool bIsSimReady = true) override; static bool isContainsSignChar(const std::string& str); - + virtual CODE setTimeFormat() override; private: virtual CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk, const std::string& sLockStatus); ICellularRadio::CODE wdsList(std::set &wds); diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 8cdaf44..0b90b55 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -580,7 +580,7 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi std::vector vTimeParts; std::string sSign = "+"; - if(getTimeUTC() == FAILURE) { + if(setTimeFormat() == FAILURE) { printWarning("%s| Unable to set Time Parameters for radio [%s]", m_sName.c_str()); return FAILURE;; } diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index 655fb38..760cf6d 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -1676,27 +1676,25 @@ const std::vector& QuectelRadio::getDiagCommands(bool) { return vCommands; } -ICellularRadio::CODE QuectelRadio::getTimeUTC(void) { - printTrace("%s| Get Time in UTC", getName().c_str()); - +ICellularRadio::CODE QuectelRadio::setTimeFormat(void) { + printTrace("%s| Set standard time format", getName().c_str()); + ICellularRadio::CODE rc; // 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); + rc = sendBasicCommand(sCmdCSDF); - 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; + if (rc != SUCCESS) { + printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + return rc; } - // Set command enables/disables the automatic time zone update - std::string sCmdCTZU("AT+CTZU=1"); - sRes = sendCommand(sCmdCTZU); - size_t endc = sRes.find(ICellularRadio::RSP_OK); + // Set command enables the automatic time zone update + std::string sCmdCTZU("AT+CTZU=3"); + rc = sendBasicCommand(sCmdCTZU); - 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; + if (rc != SUCCESS) { + printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + return rc; } return SUCCESS; } \ No newline at end of file diff --git a/src/MTS_IO_SequansRadio.cpp b/src/MTS_IO_SequansRadio.cpp index 33bd068..31c736f 100644 --- a/src/MTS_IO_SequansRadio.cpp +++ b/src/MTS_IO_SequansRadio.cpp @@ -569,27 +569,25 @@ const std::vector& SequansRadio::getDiagCommands(bool) { return vCommands; } -ICellularRadio::CODE SequansRadio::getTimeUTC(void) { - printTrace("%s| Get Time in UTC", getName().c_str()); - +ICellularRadio::CODE SequansRadio::setTimeFormat() { + printTrace("%s| Set standard time format", getName().c_str()); + ICellularRadio::CODE rc; // 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); + rc = sendBasicCommand(sCmdCSDF); - 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; + if (rc != SUCCESS) { + printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + return rc; } - // Set year format in YYYY first, in case it is in YY format to get accurate year + // Set command enables the automatic time zone update std::string sCmdCTZU("AT+CTZU=1"); - sRes = sendCommand(sCmdCTZU); - size_t endc = sRes.find(ICellularRadio::RSP_OK); + rc = sendBasicCommand(sCmdCTZU); - 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; + if (rc != SUCCESS) { + printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + return rc; } return SUCCESS; } \ No newline at end of file diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp index 2c50208..261fd34 100644 --- a/src/MTS_IO_TelitRadio.cpp +++ b/src/MTS_IO_TelitRadio.cpp @@ -1213,38 +1213,25 @@ const std::vector& TelitRadio::getDiagCommands(bool) { return vCommands; } -ICellularRadio::CODE TelitRadio::getTimeUTC(void) { - printTrace("%s| Get Time in UTC", getName().c_str()); - +ICellularRadio::CODE TelitRadio::setTimeFormat(void) { + printTrace("%s| Set standard time format", getName().c_str()); + ICellularRadio::CODE rc; // 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); + rc = sendBasicCommand(sCmdCSDF); - 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; + if (rc != SUCCESS) { + printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + return rc; } - // Set command enables/disables the automatic time zone update via NITZ. + // Set command enables the automatic time zone update 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 year format for radio using command [%s]", getName().c_str(), sCmdCTZU.c_str()); - return FAILURE; - } - - //Enables/disables the automatic date/time updating and the - //Full Network Name applying. It enables also the #NITZ URC in the format. - std::string sCmdNITZ("AT#NITZ"); - sRes = sendCommand(sCmdNITZ); - size_t endn = sRes.find(ICellularRadio::RSP_OK); + rc = sendBasicCommand(sCmdCTZU); - if (endn == std::string::npos) { - printWarning("%s| Unable to set automatic time zone update for radio using command [%s]", getName().c_str(), sCmdNITZ.c_str()); - return FAILURE; + if (rc != SUCCESS) { + printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + return rc; } return SUCCESS; } \ No newline at end of file -- cgit v1.2.3 From 96a6958ec2242d1ff7bc0afa83e25044e61800e1 Mon Sep 17 00:00:00 2001 From: sdesai Date: Mon, 20 Mar 2023 15:19:05 -0500 Subject: Support Portal Case #5086148: use Cellular Radio timeas alternative to GPS or NTP --- src/MTS_IO_QuectelRadio.cpp | 4 ++-- src/MTS_IO_SequansRadio.cpp | 4 ++-- src/MTS_IO_TelitRadio.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index 760cf6d..2bc4fb6 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -1684,7 +1684,7 @@ ICellularRadio::CODE QuectelRadio::setTimeFormat(void) { rc = sendBasicCommand(sCmdCSDF); if (rc != SUCCESS) { - printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + printError("%s| Unable to set year format for radio using command [%s]", getName().c_str(), sCmdCSDF.c_str()); return rc; } @@ -1693,7 +1693,7 @@ ICellularRadio::CODE QuectelRadio::setTimeFormat(void) { rc = sendBasicCommand(sCmdCTZU); if (rc != SUCCESS) { - printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + printError("%s| Unable to set automatic time zone update for radio using command [%s]", getName().c_str(), sCmdCTZU.c_str()); return rc; } return SUCCESS; diff --git a/src/MTS_IO_SequansRadio.cpp b/src/MTS_IO_SequansRadio.cpp index 31c736f..d2a2efb 100644 --- a/src/MTS_IO_SequansRadio.cpp +++ b/src/MTS_IO_SequansRadio.cpp @@ -577,7 +577,7 @@ ICellularRadio::CODE SequansRadio::setTimeFormat() { rc = sendBasicCommand(sCmdCSDF); if (rc != SUCCESS) { - printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + printError("%s| Unable to set year format for radio using command [%s]", getName().c_str(), sCmdCSDF.c_str()); return rc; } @@ -586,7 +586,7 @@ ICellularRadio::CODE SequansRadio::setTimeFormat() { rc = sendBasicCommand(sCmdCTZU); if (rc != SUCCESS) { - printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + printError("%s| Unable to set automatic time zone update for radio using command [%s]", getName().c_str(), sCmdCTZU.c_str()); return rc; } return SUCCESS; diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp index 261fd34..d73dc0a 100644 --- a/src/MTS_IO_TelitRadio.cpp +++ b/src/MTS_IO_TelitRadio.cpp @@ -1221,7 +1221,7 @@ ICellularRadio::CODE TelitRadio::setTimeFormat(void) { rc = sendBasicCommand(sCmdCSDF); if (rc != SUCCESS) { - printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + printError("%s| Unable to set year format for radio using command [%s]", getName().c_str(), sCmdCSDF.c_str()); return rc; } @@ -1230,7 +1230,7 @@ ICellularRadio::CODE TelitRadio::setTimeFormat(void) { rc = sendBasicCommand(sCmdCTZU); if (rc != SUCCESS) { - printError("%s| Failed to set diversity for WCDMA network mode: [%d]", getName().c_str(), rc); + printError("%s| Unable to set automatic time zone update for radio using command [%s]", getName().c_str(), sCmdCTZU.c_str()); return rc; } return SUCCESS; -- cgit v1.2.3 From 91c623896442013d82f59e6e06e70523e9046b8c Mon Sep 17 00:00:00 2001 From: sdesai Date: Thu, 23 Mar 2023 16:37:24 -0500 Subject: Support Portal Case #5086148: use Cellular Radio time as alternative to GPS or NTP --- include/mts/MTS_IO_CellularRadio.h | 2 +- include/mts/MTS_IO_QuectelRadio.h | 6 ++++++ include/mts/MTS_IO_SequansRadio.h | 4 +++- include/mts/MTS_IO_TelitRadio.h | 7 ++++++- src/MTS_IO_CellularRadio.cpp | 29 +++++++++++++++-------------- src/MTS_IO_QuectelRadio.cpp | 4 ++-- 6 files changed, 33 insertions(+), 19 deletions(-) diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index 0af531b..555a5a7 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -277,7 +277,7 @@ namespace MTS { * @return the list of AT commands (strings). */ virtual const std::vector& getDiagCommands(bool bIsSimReady = true) = 0; - virtual CODE setTimeFormat () = 0; + virtual CODE setTimeFormat() = 0; class RadioBandMap : public MTS::NonCopyable { public: diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h index a8d37f2..5f1d70c 100644 --- a/include/mts/MTS_IO_QuectelRadio.h +++ b/include/mts/MTS_IO_QuectelRadio.h @@ -69,16 +69,21 @@ namespace MTS { QuectelRadio(const std::string& sName, const std::string& sRadioPort); CODE getIsSimInserted(bool& bData) override; + CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; virtual CODE getServiceDomain(SERVICEDOMAIN& sd); + virtual CODE convertToActiveBand(const std::string& sQuectelBand, ACTIVEBAND& band); virtual CODE uploadFile(int fd, const std::string& sTargetFilename, UpdateCb& stepCb); + virtual CODE removeFile(const std::string& sTargetFilename); + virtual CODE checkFile(bool& bFilePresent, const std::string& sTargetFilename); virtual CODE getUeUsageSetting(QuectelRadio::UE_USAGE_SETTING& us); + virtual CODE convertToUeUsageSetting(const std::string& sSetting, QuectelRadio::UE_USAGE_SETTING& us); static bool isContainsSignChar(const std::string& str); @@ -86,6 +91,7 @@ namespace MTS { CODE setRxDiversity(const Json::Value& jArgs) override; const std::vector& getDiagCommands(bool bIsSimReady = true) override; + CODE setTimeFormat() override; private: // private variable to save old firmware versions during FOTA diff --git a/include/mts/MTS_IO_SequansRadio.h b/include/mts/MTS_IO_SequansRadio.h index 30f4875..d3efda5 100644 --- a/include/mts/MTS_IO_SequansRadio.h +++ b/include/mts/MTS_IO_SequansRadio.h @@ -54,10 +54,12 @@ namespace MTS { SequansRadio(const std::string& sName, const std::string& sRadioPort); CODE getIsSimInserted(bool& bData) override; + CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; const std::vector& getDiagCommands(bool bIsSimReady = true) override; - virtual CODE setTimeFormat() override; + + CODE setTimeFormat() override; private: /* diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index 7011ef3..dc8ece8 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -55,9 +55,11 @@ namespace MTS { TelitRadio(const std::string& sName, const std::string& sRadioPort); bool getCarrierFromFirmware(const std::string& sFirmware, std::string& sCarrier) override; + bool getHardwareVersionFromFirmware(const std::string& sFirmware, std::string& sHardware) override; CODE getIsSimInserted(bool& bData) override; + CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; enum FOTA_GROUP : uint8_t { @@ -69,13 +71,16 @@ namespace MTS { }; virtual FOTA_GROUP getFotaGroup(); + virtual CODE fumoWriteGroupsABD(int fd, UpdateCb& stepCb); + //virtual CODE fumoWriteGroupC(int fd, UpdateCb& stepCb); const std::vector& getDiagCommands(bool bIsSimReady = true) override; static bool isContainsSignChar(const std::string& str); - virtual CODE setTimeFormat() override; + + CODE setTimeFormat() override; private: virtual CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk, const std::string& sLockStatus); ICellularRadio::CODE wdsList(std::set &wds); diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 0b90b55..bc1fee1 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -580,9 +580,9 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi std::vector vTimeParts; std::string sSign = "+"; - if(setTimeFormat() == FAILURE) { + if (setTimeFormat() == FAILURE) { printWarning("%s| Unable to set Time Parameters for radio [%s]", m_sName.c_str()); - return FAILURE;; + return FAILURE; } std::string sCmd("AT+CCLK?"); @@ -601,13 +601,13 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi sValue = MTS::Text::strip(sValue, '"'); std::vector vParts = MTS::Text::split(sValue, ','); - if(vParts.size() != 2) { + if (vParts.size() != 2) { printWarning("%s| Unable to parse Date from response [%s]", m_sName.c_str(), sResult.c_str()); return FAILURE; } std::vector vDateParts = MTS::Text::split(vParts[0], '/'); - if(vDateParts.size() != 3) { + if (vDateParts.size() != 3) { printWarning("%s| Unable to parse Date parts from response [%s]", m_sName.c_str(), sResult.c_str()); return FAILURE; } @@ -622,32 +622,33 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi size_t nsign = sTime.find("-"); if (psign != std::string::npos) { - vTimeParts = MTS::Text::split(vParts[1], '+'); + vTimeParts = MTS::Text::split(vParts[1], '+'); } else if (nsign != std::string::npos) { vTimeParts = MTS::Text::split(vParts[1], '-'); sSign = "-"; + } else { + sSign = ""; } - if(vTimeParts.size() != 2) { + if (vTimeParts.size() != 2) { printWarning("%s| Unable to parse Time Zone from response [%s], size %d", m_sName.c_str(), sResult.c_str(),vTimeParts.size()); return FAILURE; } - //Get just the UTC time without zone info + //Get local time sTime = (vTimeParts[0]); - int32_t iZoneUnits = stoi(vTimeParts[1]); //the difference, expressed in quarters of an hour, between the local time and GMT + int32_t iZoneUnits = 0; //the difference, expressed in quarters of an hour, between the local time and GMT + if (!MTS::Text::parse(iZoneUnits, vTimeParts[1])) { + printWarning("%s| Unable to parse Time Zone units from response [%s], size %d", m_sName.c_str(), sResult.c_str(),vTimeParts.size()); + return FAILURE; + } int32_t iZone = iZoneUnits/4; //Divide by 4 to get hours difference int32_t iZonePartial = (iZoneUnits % 4) * 15; //Remainder in minutes - if (iZonePartial < 0) { - //Remove negative sign from partial and clear sign component - iZonePartial *= -1; - sSign = ""; - } std::stringstream ss; ss << sSign << iZone; - if(iZonePartial != 0) { + if (iZonePartial != 0) { ss << ":" << iZonePartial; } diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index 2bc4fb6..defe863 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -1676,7 +1676,7 @@ const std::vector& QuectelRadio::getDiagCommands(bool) { return vCommands; } -ICellularRadio::CODE QuectelRadio::setTimeFormat(void) { +ICellularRadio::CODE QuectelRadio::setTimeFormat() { printTrace("%s| Set standard time format", getName().c_str()); ICellularRadio::CODE rc; // Set year format in YYYY first, in case it is in YY format to get accurate year @@ -1689,7 +1689,7 @@ ICellularRadio::CODE QuectelRadio::setTimeFormat(void) { } // Set command enables the automatic time zone update - std::string sCmdCTZU("AT+CTZU=3"); + std::string sCmdCTZU("AT+CTZU=1"); rc = sendBasicCommand(sCmdCTZU); if (rc != SUCCESS) { -- cgit v1.2.3 From a7c338b07cbdb706998ccead56673a3dd1cbdb0e Mon Sep 17 00:00:00 2001 From: sdesai Date: Thu, 23 Mar 2023 16:50:31 -0500 Subject: Support Portal Case #5086148: use Cellular Radio time as alternative to GPS or NTP --- include/mts/MTS_IO_CellularRadio.h | 1 + include/mts/MTS_IO_QuectelRadio.h | 1 + include/mts/MTS_IO_TelitRadio.h | 1 + 3 files changed, 3 insertions(+) diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index 555a5a7..c2aa346 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -277,6 +277,7 @@ namespace MTS { * @return the list of AT commands (strings). */ virtual const std::vector& getDiagCommands(bool bIsSimReady = true) = 0; + virtual CODE setTimeFormat() = 0; class RadioBandMap : public MTS::NonCopyable { diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h index 5f1d70c..b7796d9 100644 --- a/include/mts/MTS_IO_QuectelRadio.h +++ b/include/mts/MTS_IO_QuectelRadio.h @@ -93,6 +93,7 @@ namespace MTS { const std::vector& getDiagCommands(bool bIsSimReady = true) override; CODE setTimeFormat() override; + private: // private variable to save old firmware versions during FOTA std::string m_sQuectelFirmware; diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index dc8ece8..305a764 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -81,6 +81,7 @@ namespace MTS { static bool isContainsSignChar(const std::string& str); CODE setTimeFormat() override; + private: virtual CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk, const std::string& sLockStatus); ICellularRadio::CODE wdsList(std::set &wds); -- cgit v1.2.3 From 23f75ed608922db0c22a01d74f1b38f0bfed43dd Mon Sep 17 00:00:00 2001 From: sdesai Date: Fri, 24 Mar 2023 17:40:31 -0500 Subject: Support Portal Case #5086148: use Cellular Radio time as alternative to GPS or NTP --- src/MTS_IO_SequansRadio.cpp | 24 +++--------------------- src/MTS_IO_TelitRadio.cpp | 4 ++-- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/src/MTS_IO_SequansRadio.cpp b/src/MTS_IO_SequansRadio.cpp index d2a2efb..5f85b58 100644 --- a/src/MTS_IO_SequansRadio.cpp +++ b/src/MTS_IO_SequansRadio.cpp @@ -570,24 +570,6 @@ const std::vector& SequansRadio::getDiagCommands(bool) { } ICellularRadio::CODE SequansRadio::setTimeFormat() { - printTrace("%s| Set standard time format", getName().c_str()); - ICellularRadio::CODE rc; - // Set year format in YYYY first, in case it is in YY format to get accurate year - std::string sCmdCSDF("AT+CSDF=1,2"); - rc = sendBasicCommand(sCmdCSDF); - - if (rc != SUCCESS) { - printError("%s| Unable to set year format for radio using command [%s]", getName().c_str(), sCmdCSDF.c_str()); - return rc; - } - - // Set command enables the automatic time zone update - std::string sCmdCTZU("AT+CTZU=1"); - rc = sendBasicCommand(sCmdCTZU); - - if (rc != SUCCESS) { - printError("%s| Unable to set automatic time zone update for radio using command [%s]", getName().c_str(), sCmdCTZU.c_str()); - return rc; - } - return SUCCESS; -} \ No newline at end of file + // AT+CSDF does not work on CB610L. Also, since CB610L does not return the correct time anyway. + return NOT_APPLICABLE; +} diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp index d73dc0a..be307e6 100644 --- a/src/MTS_IO_TelitRadio.cpp +++ b/src/MTS_IO_TelitRadio.cpp @@ -1213,7 +1213,7 @@ const std::vector& TelitRadio::getDiagCommands(bool) { return vCommands; } -ICellularRadio::CODE TelitRadio::setTimeFormat(void) { +ICellularRadio::CODE TelitRadio::setTimeFormat() { printTrace("%s| Set standard time format", getName().c_str()); ICellularRadio::CODE rc; // Set year format in YYYY first, in case it is in YY format to get accurate year @@ -1234,4 +1234,4 @@ ICellularRadio::CODE TelitRadio::setTimeFormat(void) { return rc; } return SUCCESS; -} \ No newline at end of file +} -- cgit v1.2.3 From 83344ddef6063f0bfcbb96dae171237eae5ca3ba Mon Sep 17 00:00:00 2001 From: sdesai Date: Fri, 24 Mar 2023 17:43:49 -0500 Subject: Support Portal Case #5086148: use Cellular Radio time as alternative to GPS or NTP --- include/mts/MTS_IO_SequansRadio.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/mts/MTS_IO_SequansRadio.h b/include/mts/MTS_IO_SequansRadio.h index d3efda5..804d473 100644 --- a/include/mts/MTS_IO_SequansRadio.h +++ b/include/mts/MTS_IO_SequansRadio.h @@ -54,7 +54,6 @@ namespace MTS { SequansRadio(const std::string& sName, const std::string& sRadioPort); CODE getIsSimInserted(bool& bData) override; - CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; const std::vector& getDiagCommands(bool bIsSimReady = true) override; -- cgit v1.2.3 From 5a0bc9dda829197048155380c3e344e28365aebc Mon Sep 17 00:00:00 2001 From: sdesai Date: Mon, 27 Mar 2023 09:00:20 -0500 Subject: Support Portal Case #5086148: use Cellular Radio time as alternative to GPS or NTP --- include/mts/MTS_IO_QuectelRadio.h | 5 ----- include/mts/MTS_IO_TelitRadio.h | 5 +---- src/MTS_IO_QuectelRadio.cpp | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h index b7796d9..8e75c12 100644 --- a/include/mts/MTS_IO_QuectelRadio.h +++ b/include/mts/MTS_IO_QuectelRadio.h @@ -69,21 +69,16 @@ namespace MTS { QuectelRadio(const std::string& sName, const std::string& sRadioPort); CODE getIsSimInserted(bool& bData) override; - CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; virtual CODE getServiceDomain(SERVICEDOMAIN& sd); - virtual CODE convertToActiveBand(const std::string& sQuectelBand, ACTIVEBAND& band); virtual CODE uploadFile(int fd, const std::string& sTargetFilename, UpdateCb& stepCb); - virtual CODE removeFile(const std::string& sTargetFilename); - virtual CODE checkFile(bool& bFilePresent, const std::string& sTargetFilename); virtual CODE getUeUsageSetting(QuectelRadio::UE_USAGE_SETTING& us); - virtual CODE convertToUeUsageSetting(const std::string& sSetting, QuectelRadio::UE_USAGE_SETTING& us); static bool isContainsSignChar(const std::string& str); diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index 305a764..d5e8bac 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -51,15 +51,14 @@ namespace MTS { CODE fumoLocalApply(UpdateCb& stepCb) override; CODE getSelectedBandsRaw(std::string& sRawBands) override; + protected: TelitRadio(const std::string& sName, const std::string& sRadioPort); bool getCarrierFromFirmware(const std::string& sFirmware, std::string& sCarrier) override; - bool getHardwareVersionFromFirmware(const std::string& sFirmware, std::string& sHardware) override; CODE getIsSimInserted(bool& bData) override; - CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; enum FOTA_GROUP : uint8_t { @@ -71,9 +70,7 @@ namespace MTS { }; virtual FOTA_GROUP getFotaGroup(); - virtual CODE fumoWriteGroupsABD(int fd, UpdateCb& stepCb); - //virtual CODE fumoWriteGroupC(int fd, UpdateCb& stepCb); const std::vector& getDiagCommands(bool bIsSimReady = true) override; diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index defe863..c4b6ac4 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -1689,7 +1689,7 @@ ICellularRadio::CODE QuectelRadio::setTimeFormat() { } // Set command enables the automatic time zone update - std::string sCmdCTZU("AT+CTZU=1"); + std::string sCmdCTZU("AT+CTZU=3"); rc = sendBasicCommand(sCmdCTZU); if (rc != SUCCESS) { -- cgit v1.2.3 From 582634c91a778dba7047a69b5559f849d03be112 Mon Sep 17 00:00:00 2001 From: sdesai Date: Mon, 27 Mar 2023 11:53:13 -0500 Subject: Support Portal Case #5086148: use Cellular Radio time as alternative to GPS or NTP --- src/MTS_IO_CellularRadio.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index bc1fee1..f0df7fd 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -577,12 +577,14 @@ ICellularRadio::CODE CellularRadio::getTime(std::string& sDate, std::string& sTi sDate = ""; sTime = ""; sTimeZone = ""; + CODE rc; std::vector vTimeParts; std::string sSign = "+"; - if (setTimeFormat() == FAILURE) { + rc = setTimeFormat(); + if (rc != SUCCESS) { printWarning("%s| Unable to set Time Parameters for radio [%s]", m_sName.c_str()); - return FAILURE; + return rc; } std::string sCmd("AT+CCLK?"); -- cgit v1.2.3