diff options
Diffstat (limited to 'src/MTS_IO_CellularRadioFactory.cpp')
-rw-r--r-- | src/MTS_IO_CellularRadioFactory.cpp | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index ef87f0e..4ee8756 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -37,6 +37,7 @@ #include <mts/MTS_IO_GE910Radio.h> #include <mts/MTS_IO_CE910Radio.h> #include <mts/MTS_IO_DE910Radio.h> +#include "mts/MTS_IO_EG95Radio.h" #include <mts/MTS_Logger.h> using namespace MTS::IO; @@ -60,9 +61,10 @@ 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; } -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); @@ -87,22 +89,22 @@ 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 ICellularRadio::VALUE_UNKNOWN; } //Attempt basic radio communication - if(CellularRadio::test(apIo) != CellularRadio::SUCCESS) { + if(ICellularRadio::test(apIo) != ICellularRadio::SUCCESS) { printError("CellularRadioFactory| Failed to communicate with radio on port [%s]", sPort.c_str()); apIo->close(); - return CellularRadio::VALUE_UNKNOWN; + return ICellularRadio::VALUE_UNKNOWN; } //Get model int count = 0; - std::string sCmd("ATI4"); + std::string sCmd("AT+GMM"); std::string sResult; do { - sResult = CellularRadio::sendCommand(apIo, sCmd, CellularRadio::DEFAULT_BAIL_STRINGS, 1000, CellularRadio::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,83 +116,88 @@ 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 ICellularRadio::VALUE_UNKNOWN; } - std::string sModel = CellularRadio::extractModelFromResult(sResult); - printDebug("RADIO| Extracted [%s] from ATI4 query", sModel.c_str()); + std::string sModel = ICellularRadio::extractModelFromResult(sResult); + printDebug("RADIO| Extracted [%s] from AT+GMM query", sModel.c_str()); apIo->close(); return sModel; } -CellularRadio* CellularRadioFactory::createHE910D(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createHE910D(const std::string& sPort) const { return new HE910DRadio(sPort); } -CellularRadio* CellularRadioFactory::createHE910EUD(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createHE910EUD(const std::string& sPort) const { return new HE910EUDRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910NAG(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910NAG(const std::string& sPort) const { return new LE910NAGRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910C4NF(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C4NF(const std::string& sPort) const { return new LE910C4NFRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910NA1(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910NA1(const std::string& sPort) const { return new LE910NA1Radio(sPort); } -CellularRadio* CellularRadioFactory::createLE910SVG(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910SVG(const std::string& sPort) const { return new LE910SVGRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910EUG(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910EUG(const std::string& sPort) const { return new LE910EUGRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910C4EU(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C4EU(const std::string& sPort) const { return new LE910C4EURadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910EU1(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910EU1(const std::string& sPort) const { return new LE910EU1Radio(sPort); } -CellularRadio* CellularRadioFactory::createLE910C1NS(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C1NS(const std::string& sPort) const { return new LE910C1NSRadio(sPort); } -CellularRadio* CellularRadioFactory::createLE910C1AP(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createLE910C1AP(const std::string& sPort) const { return new LE910C1APRadio(sPort); } -CellularRadio* CellularRadioFactory::createME910C1NA(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createME910C1NA(const std::string& sPort) const { return new ME910C1NARadio(sPort); } -CellularRadio* CellularRadioFactory::createME910C1NV(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createME910C1NV(const std::string& sPort) const { return new ME910C1NVRadio(sPort); } -CellularRadio* CellularRadioFactory::createME910C1WW(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createME910C1WW(const std::string& sPort) const { return new ME910C1WWRadio(sPort); } -CellularRadio* CellularRadioFactory::createGE910(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createGE910(const std::string& sPort) const { return new GE910Radio(sPort); } -CellularRadio* CellularRadioFactory::createDE910(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createDE910(const std::string& sPort) const { return new DE910Radio(sPort); } -CellularRadio* CellularRadioFactory::createCE910(const std::string& sPort) { +ICellularRadio* CellularRadioFactory::createCE910(const std::string& sPort) const { return new CE910Radio(sPort); } -CellularRadio* 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) const +{ + return new EG95Radio(sPort); +} |