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 --- src/MTS_IO_QuectelRadio.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/MTS_IO_QuectelRadio.cpp') 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 -- 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 --- src/MTS_IO_QuectelRadio.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/MTS_IO_QuectelRadio.cpp') 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 -- 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 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/MTS_IO_QuectelRadio.cpp') 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; -- 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 --- src/MTS_IO_QuectelRadio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/MTS_IO_QuectelRadio.cpp') 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 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 --- src/MTS_IO_QuectelRadio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/MTS_IO_QuectelRadio.cpp') 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