From da563a985ccb0b5f316b44e35aabd511687ff4bf Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Thu, 6 Jun 2019 16:03:44 +0300 Subject: [MTS-MTQ] refactoring: added quectel empty classes, CellularRadio moved to TelitRadio --- src/MTS_IO_CellularRadioFactory.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/MTS_IO_CellularRadioFactory.cpp') diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index ef87f0e..17cbd05 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -87,14 +87,14 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { apIo.reset(new SerialConnection(SerialConnection::Builder(sPort).baudRate(115200).useLockFile().build())); while(!apIo->open(30000)) { printError("CellularRadioFactory| Failed to open radio port [%s]", sPort.c_str()); - return CellularRadio::VALUE_UNKNOWN; + return TelitRadio::VALUE_UNKNOWN; } //Attempt basic radio communication - if(CellularRadio::test(apIo) != CellularRadio::SUCCESS) { + if(TelitRadio::test(apIo) != TelitRadio::SUCCESS) { printError("CellularRadioFactory| Failed to communicate with radio on port [%s]", sPort.c_str()); apIo->close(); - return CellularRadio::VALUE_UNKNOWN; + return TelitRadio::VALUE_UNKNOWN; } //Get model @@ -102,7 +102,7 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { std::string sCmd("ATI4"); std::string sResult; do { - sResult = CellularRadio::sendCommand(apIo, sCmd, CellularRadio::DEFAULT_BAIL_STRINGS, 1000, CellularRadio::CR); + sResult = TelitRadio::sendCommand(apIo, sCmd, TelitRadio::DEFAULT_BAIL_STRINGS, 1000, TelitRadio::CR); if (sResult.find("OK") == std::string::npos) { printDebug("RADIO| Attempting to get radio model [%s] ...", sResult.c_str()); } else { @@ -114,10 +114,10 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { if(count == 30) { printDebug("RADIO| Unable to get radio model"); apIo->close(); - return CellularRadio::VALUE_UNKNOWN; + return TelitRadio::VALUE_UNKNOWN; } - std::string sModel = CellularRadio::extractModelFromResult(sResult); + std::string sModel = TelitRadio::extractModelFromResult(sResult); printDebug("RADIO| Extracted [%s] from ATI4 query", sModel.c_str()); apIo->close(); return sModel; -- cgit v1.2.3 From 402354f2410917888a7d4b04a2cbc3a76a321549 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Fri, 7 Jun 2019 13:56:26 +0300 Subject: [MTS-MTQ] refactoring: factory interface --- src/MTS_IO_CellularRadioFactory.cpp | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/MTS_IO_CellularRadioFactory.cpp') diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index 17cbd05..130d3ed 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -62,7 +62,7 @@ CellularRadioFactory::CellularRadioFactory() { m_mCreationMap[LE866A1JSRadio::MODEL_NAME] = &CellularRadioFactory::createLE866A1JS; } -MTS::IO::CellularRadio* CellularRadioFactory::create(const std::string& sModel, const std::string& sPort) { +ICellularRadio* CellularRadioFactory::create(const std::string& sModel, const std::string& sPort) { std::string model(sModel); @@ -123,74 +123,74 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { return sModel; } -CellularRadio* CellularRadioFactory::createHE910D(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createHE910D(const std::string& sPort) { return new HE910DRadio(sPort); } -CellularRadio* CellularRadioFactory::createHE910EUD(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createHE910EUD(const std::string& sPort) { return new HE910EUDRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910NAG(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910NAG(const std::string& sPort) { return new LE910NAGRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910C4NF(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C4NF(const std::string& sPort) { return new LE910C4NFRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910NA1(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910NA1(const std::string& sPort) { return new LE910NA1Radio(sPort); } -CellularRadio* CellularRadioFactory::createLE910SVG(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910SVG(const std::string& sPort) { return new LE910SVGRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910EUG(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910EUG(const std::string& sPort) { return new LE910EUGRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910C4EU(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C4EU(const std::string& sPort) { return new LE910C4EURadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910EU1(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910EU1(const std::string& sPort) { return new LE910EU1Radio(sPort); } -CellularRadio* CellularRadioFactory::createLE910C1NS(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C1NS(const std::string& sPort) { return new LE910C1NSRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910C1AP(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C1AP(const std::string& sPort) { return new LE910C1APRadio(sPort); } -CellularRadio* CellularRadioFactory::createME910C1NA(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createME910C1NA(const std::string& sPort) { return new ME910C1NARadio(sPort); } -CellularRadio* CellularRadioFactory::createME910C1NV(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createME910C1NV(const std::string& sPort) { return new ME910C1NVRadio(sPort); } -CellularRadio* CellularRadioFactory::createME910C1WW(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createME910C1WW(const std::string& sPort) { return new ME910C1WWRadio(sPort); } -CellularRadio* CellularRadioFactory::createGE910(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createGE910(const std::string& sPort) { return new GE910Radio(sPort); } -CellularRadio* CellularRadioFactory::createDE910(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createDE910(const std::string& sPort) { return new DE910Radio(sPort); } -CellularRadio* CellularRadioFactory::createCE910(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createCE910(const std::string& sPort) { return new CE910Radio(sPort); } -CellularRadio* CellularRadioFactory::createLE866A1JS(const std::string &sPort) { +ICellularRadio* CellularRadioFactory::createLE866A1JS(const std::string &sPort) { return new LE866A1JSRadio(sPort); } -- cgit v1.2.3 From 5a7d8772ea898b3567685431b5a6be13015e5887 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Mon, 10 Jun 2019 11:27:27 +0300 Subject: [MTS-MTQ] refactoring: static function moved to ICellularRadio --- src/MTS_IO_CellularRadioFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/MTS_IO_CellularRadioFactory.cpp') diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index 130d3ed..0c64221 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -102,7 +102,7 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { std::string sCmd("ATI4"); std::string sResult; do { - sResult = TelitRadio::sendCommand(apIo, sCmd, TelitRadio::DEFAULT_BAIL_STRINGS, 1000, TelitRadio::CR); + sResult = ICellularRadio::sendCommand(apIo, sCmd, TelitRadio::DEFAULT_BAIL_STRINGS, 1000, TelitRadio::CR); if (sResult.find("OK") == std::string::npos) { printDebug("RADIO| Attempting to get radio model [%s] ...", sResult.c_str()); } else { -- cgit v1.2.3 From fe1c1e2e87da96fbbc432a35a903fff40f52713a Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 11 Jun 2019 16:47:11 +0300 Subject: [MTS-MTQ] refactoring: cellular factory namespaces --- src/MTS_IO_CellularRadioFactory.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/MTS_IO_CellularRadioFactory.cpp') diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index 0c64221..146b112 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -87,14 +87,14 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { apIo.reset(new SerialConnection(SerialConnection::Builder(sPort).baudRate(115200).useLockFile().build())); while(!apIo->open(30000)) { printError("CellularRadioFactory| Failed to open radio port [%s]", sPort.c_str()); - return TelitRadio::VALUE_UNKNOWN; + return ICellularRadio::VALUE_UNKNOWN; } //Attempt basic radio communication - if(TelitRadio::test(apIo) != TelitRadio::SUCCESS) { + if(ICellularRadio::test(apIo) != ICellularRadio::SUCCESS) { printError("CellularRadioFactory| Failed to communicate with radio on port [%s]", sPort.c_str()); apIo->close(); - return TelitRadio::VALUE_UNKNOWN; + return ICellularRadio::VALUE_UNKNOWN; } //Get model @@ -102,7 +102,7 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { std::string sCmd("ATI4"); std::string sResult; do { - sResult = ICellularRadio::sendCommand(apIo, sCmd, TelitRadio::DEFAULT_BAIL_STRINGS, 1000, TelitRadio::CR); + sResult = ICellularRadio::sendCommand(apIo, sCmd, ICellularRadio::DEFAULT_BAIL_STRINGS, 1000, ICellularRadio::CR); if (sResult.find("OK") == std::string::npos) { printDebug("RADIO| Attempting to get radio model [%s] ...", sResult.c_str()); } else { @@ -114,10 +114,10 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { if(count == 30) { printDebug("RADIO| Unable to get radio model"); apIo->close(); - return TelitRadio::VALUE_UNKNOWN; + return ICellularRadio::VALUE_UNKNOWN; } - std::string sModel = TelitRadio::extractModelFromResult(sResult); + std::string sModel = ICellularRadio::extractModelFromResult(sResult); printDebug("RADIO| Extracted [%s] from ATI4 query", sModel.c_str()); apIo->close(); return sModel; -- cgit v1.2.3 From 2fe0784ab57aa5571e5cd70c1776eecda635b3c0 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 11 Jun 2019 16:49:09 +0300 Subject: [MTS-MTQ] cellular factory: quectel eg95 instance creation --- src/MTS_IO_CellularRadioFactory.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/MTS_IO_CellularRadioFactory.cpp') diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index 146b112..8b2353a 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -37,6 +37,7 @@ #include #include #include +#include "mts/MTS_IO_EG95Radio.h" #include using namespace MTS::IO; @@ -60,6 +61,7 @@ CellularRadioFactory::CellularRadioFactory() { m_mCreationMap[DE910Radio::MODEL_NAME] = &CellularRadioFactory::createDE910; m_mCreationMap[CE910Radio::MODEL_NAME] = &CellularRadioFactory::createCE910; m_mCreationMap[LE866A1JSRadio::MODEL_NAME] = &CellularRadioFactory::createLE866A1JS; + m_mCreationMap[EG95Radio::MODEL_NAME] = &CellularRadioFactory::createEG95Radio; } ICellularRadio* CellularRadioFactory::create(const std::string& sModel, const std::string& sPort) { @@ -194,3 +196,10 @@ ICellularRadio* CellularRadioFactory::createCE910(const std::string& sPort) { ICellularRadio* CellularRadioFactory::createLE866A1JS(const std::string &sPort) { return new LE866A1JSRadio(sPort); } + +ICellularRadio* CellularRadioFactory::createEG95Radio(const std::string& sPort) +{ + // TODO: return new EG95Radio(sPort); + printError("TODO: EG95Radio"); + return new HE910DRadio(sPort); +} -- cgit v1.2.3 From 1dae6b4045d1683c4410d5a2b0c315574ece7d01 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 11 Jun 2019 16:53:40 +0300 Subject: [MTS-MTQ] cellular factory: radio identification by AT+GMM --- src/MTS_IO_CellularRadioFactory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/MTS_IO_CellularRadioFactory.cpp') diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index 8b2353a..47367eb 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -101,7 +101,7 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { //Get model int count = 0; - std::string sCmd("ATI4"); + std::string sCmd("AT+GMM"); std::string sResult; do { sResult = ICellularRadio::sendCommand(apIo, sCmd, ICellularRadio::DEFAULT_BAIL_STRINGS, 1000, ICellularRadio::CR); @@ -120,7 +120,7 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { } std::string sModel = ICellularRadio::extractModelFromResult(sResult); - printDebug("RADIO| Extracted [%s] from ATI4 query", sModel.c_str()); + printDebug("RADIO| Extracted [%s] from AT+GMM query", sModel.c_str()); apIo->close(); return sModel; } -- cgit v1.2.3 From 5c8318bea803966f5b883c986919787e77e514a5 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 11 Jun 2019 16:55:28 +0300 Subject: [MTS-MTQ] refactoring cellular factory: non interface class shouldn't have such virtual methods --- src/MTS_IO_CellularRadioFactory.cpp | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/MTS_IO_CellularRadioFactory.cpp') diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index 47367eb..8ebd8dc 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -125,79 +125,79 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { return sModel; } -ICellularRadio* CellularRadioFactory::createHE910D(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createHE910D(const std::string& sPort) const { return new HE910DRadio(sPort); } -ICellularRadio* CellularRadioFactory::createHE910EUD(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createHE910EUD(const std::string& sPort) const { return new HE910EUDRadio(sPort); } -ICellularRadio* CellularRadioFactory::createLE910NAG(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910NAG(const std::string& sPort) const { return new LE910NAGRadio(sPort); } -ICellularRadio* CellularRadioFactory::createLE910C4NF(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C4NF(const std::string& sPort) const { return new LE910C4NFRadio(sPort); } -ICellularRadio* CellularRadioFactory::createLE910NA1(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910NA1(const std::string& sPort) const { return new LE910NA1Radio(sPort); } -ICellularRadio* CellularRadioFactory::createLE910SVG(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910SVG(const std::string& sPort) const { return new LE910SVGRadio(sPort); } -ICellularRadio* CellularRadioFactory::createLE910EUG(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910EUG(const std::string& sPort) const { return new LE910EUGRadio(sPort); } -ICellularRadio* CellularRadioFactory::createLE910C4EU(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C4EU(const std::string& sPort) const { return new LE910C4EURadio(sPort); } -ICellularRadio* CellularRadioFactory::createLE910EU1(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910EU1(const std::string& sPort) const { return new LE910EU1Radio(sPort); } -ICellularRadio* CellularRadioFactory::createLE910C1NS(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C1NS(const std::string& sPort) const { return new LE910C1NSRadio(sPort); } -ICellularRadio* CellularRadioFactory::createLE910C1AP(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C1AP(const std::string& sPort) const { return new LE910C1APRadio(sPort); } -ICellularRadio* CellularRadioFactory::createME910C1NA(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createME910C1NA(const std::string& sPort) const { return new ME910C1NARadio(sPort); } -ICellularRadio* CellularRadioFactory::createME910C1NV(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createME910C1NV(const std::string& sPort) const { return new ME910C1NVRadio(sPort); } -ICellularRadio* CellularRadioFactory::createME910C1WW(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createME910C1WW(const std::string& sPort) const { return new ME910C1WWRadio(sPort); } -ICellularRadio* CellularRadioFactory::createGE910(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createGE910(const std::string& sPort) const { return new GE910Radio(sPort); } -ICellularRadio* CellularRadioFactory::createDE910(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createDE910(const std::string& sPort) const { return new DE910Radio(sPort); } -ICellularRadio* CellularRadioFactory::createCE910(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createCE910(const std::string& sPort) const { return new CE910Radio(sPort); } -ICellularRadio* CellularRadioFactory::createLE866A1JS(const std::string &sPort) { +ICellularRadio* CellularRadioFactory::createLE866A1JS(const std::string &sPort) const { return new LE866A1JSRadio(sPort); } -ICellularRadio* CellularRadioFactory::createEG95Radio(const std::string& sPort) +ICellularRadio* CellularRadioFactory::createEG95Radio(const std::string& sPort) const { // TODO: return new EG95Radio(sPort); printError("TODO: EG95Radio"); -- cgit v1.2.3 From 5649cebb23edc7ef20456e76b959e4a217a08594 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Wed, 12 Jun 2019 09:51:50 +0300 Subject: [MTS-MTQ] QuectelRadio implementation Updated the following functions to support Quectel radios: - CellularRadioFactory::createEG95Radio - fixed to build a EG95Radio instance; - ICellularRadio::extractModelFromResult - returning EG95 for EG95 radios; - ICellularRadio::convertModelToType - returning VALUE_TYPE_LTE for EG95. --- src/MTS_IO_CellularRadioFactory.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/MTS_IO_CellularRadioFactory.cpp') diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index 8ebd8dc..4ee8756 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -199,7 +199,5 @@ ICellularRadio* CellularRadioFactory::createLE866A1JS(const std::string &sPort) ICellularRadio* CellularRadioFactory::createEG95Radio(const std::string& sPort) const { - // TODO: return new EG95Radio(sPort); - printError("TODO: EG95Radio"); - return new HE910DRadio(sPort); + return new EG95Radio(sPort); } -- cgit v1.2.3