diff options
author | Jeff Hatch <Jeff.Hatch@multitech.com> | 2017-05-24 09:28:28 -0500 |
---|---|---|
committer | Jeff Hatch <Jeff.Hatch@multitech.com> | 2017-05-24 09:28:28 -0500 |
commit | 646b36e1e1f26e01b4675e2265ee83a5aca55cf2 (patch) | |
tree | 333cb9ed3897b557fe0ad1c1b30710198332eae7 | |
parent | e68fa064ad6414e57d0d7244f2c9fcdd3f502f84 (diff) | |
download | libmts-io-646b36e1e1f26e01b4675e2265ee83a5aca55cf2.tar.gz libmts-io-646b36e1e1f26e01b4675e2265ee83a5aca55cf2.tar.bz2 libmts-io-646b36e1e1f26e01b4675e2265ee83a5aca55cf2.zip |
Add support for LE910NA1 Radio1.0.0
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | include/mts/MTS_IO_CellularRadioFactory.h | 1 | ||||
-rw-r--r-- | include/mts/MTS_IO_LE910NA1Radio.h | 51 | ||||
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 21 | ||||
-rw-r--r-- | src/MTS_IO_CellularRadioFactory.cpp | 6 | ||||
-rw-r--r-- | src/MTS_IO_LE910NA1Radio.cpp | 38 |
6 files changed, 115 insertions, 4 deletions
@@ -16,6 +16,7 @@ MTS_IO_HE910DRadio.o \ MTS_IO_HE910EUDRadio.o \ MTS_IO_LE910Radio.o \ MTS_IO_LE910NAGRadio.o \ +MTS_IO_LE910NA1Radio.o \ MTS_IO_LE910SVGRadio.o \ MTS_IO_LE910EUGRadio.o \ MTS_IO_LockFile.o \ @@ -35,6 +36,7 @@ MTS_IO_HE910DRadio.d \ MTS_IO_HE910EUDRadio.d \ MTS_IO_LE910Radio.d \ MTS_IO_LE910NAGRadio.d \ +MTS_IO_LE910NA1Radio.d \ MTS_IO_LE910SVGRadio.d \ MTS_IO_LE910EUGRadio.d \ MTS_IO_LockFile.d \ diff --git a/include/mts/MTS_IO_CellularRadioFactory.h b/include/mts/MTS_IO_CellularRadioFactory.h index d3616be..bcdcac0 100644 --- a/include/mts/MTS_IO_CellularRadioFactory.h +++ b/include/mts/MTS_IO_CellularRadioFactory.h @@ -52,6 +52,7 @@ namespace MTS { virtual CellularRadio* createHE910D(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT); virtual CellularRadio* createHE910EUD(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT); virtual CellularRadio* createLE910NAG(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT); + virtual CellularRadio* createLE910NA1(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT); virtual CellularRadio* createLE910SVG(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT); virtual CellularRadio* createLE910EUG(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT); virtual CellularRadio* createGE910(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT); diff --git a/include/mts/MTS_IO_LE910NA1Radio.h b/include/mts/MTS_IO_LE910NA1Radio.h new file mode 100644 index 0000000..d9e9694 --- /dev/null +++ b/include/mts/MTS_IO_LE910NA1Radio.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2017 by Multi-Tech Systems + * + * This file is part of libmts-io. + * + * libmts-io is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * libmts-io is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libmts-io. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/*! + \file MTS_IO_LE910NA1Radio.h + \brief A brief description + + A more elaborate description +*/ +#ifndef MTS_IO_LE910NA1RADIO_H_ +#define MTS_IO_LE910NA1RADIO_H_ + +#include <mts/MTS_IO_LE910Radio.h> + +namespace MTS { + namespace IO { + + class LE910NA1Radio : public LE910Radio { + + public: + static const std::string MODEL_NAME; + + LE910NA1Radio(const std::string& sPort); + virtual ~LE910NA1Radio(){}; + + protected: + + private: + + }; + } +} + +#endif /* MTS_IO_LE910NA1RADIO_H_ */ diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 46a3aa9..cd957a9 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -289,6 +289,9 @@ CellularRadio::CODE CellularRadio::convertModelToMtsShortCode(const std::string& } else if (sModel.find("LE910-NAG") == 0) { sCode = "LAT1"; eCode = SUCCESS; + } else if (sModel.find("LE910-NA1") == 0) { + sCode = "LNA3"; + eCode = SUCCESS; } else if (sModel.find("LE910-SVG") == 0) { sCode = "LVW2"; eCode = SUCCESS; @@ -349,6 +352,9 @@ CellularRadio::CODE CellularRadio::convertModelToType(const std::string& sModel, } else if (sModel.find("LE910-NAG") == 0) { sType = VALUE_TYPE_LTE; eCode = SUCCESS; + } else if (sModel.find("LE910-NA1") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; } else if (sModel.find("LE910-SVG") == 0) { sType = VALUE_TYPE_LTE; eCode = SUCCESS; @@ -1062,12 +1068,14 @@ CellularRadio::CODE CellularRadio::getNetworkStatus(Json::Value& jData) { // // <PLMN>,<EARFCN>,<RSRP>,<RSSI>,<RSRQ>,<TAC>,<RAC>,[<TXPWR>],<DRX>,<MM>,<RRC>,<CID>,<IMSI>,[<NetNameAsc>],<SD>,<ABND> // Ex 2: #RFSTS:"310 410",5780,-105,-73,-14,4603,255,,128,19,0,0000098,"310410536498694","AT&T",3,17 + // #RFSTS:"311 480",1150,-96,-66,-9.0,bf35,FF,0,0,19,1,"2ED1B0E","311480148817753","Verizon",2,2,720000,10800 + // #RFSTS:"310 410",2175,-120,-89,-17.5,4612,FF,0,0,19,1,"4E5E916","310410807276607","AT&T",3,4 // // Additional <RAC> parameter in the second example shifts the rest of the parameters. Here we are trying to figure out - // which format is currently produced based on <IMSI> field position which always has double quotation marks. + // which format is currently produced based on <NetNameAsc> field position which always has double quotation marks. // - if (vParts[11].find("\"") == std::string::npos) { - // read the RAC and remove it from the vector + if (vParts[13].find("\"") != std::string::npos) { + // parse the RAC and then remove it from the vector jData[KEY_RAC] = vParts[6]; vParts.erase(vParts.begin() + 6); } @@ -1081,7 +1089,7 @@ CellularRadio::CODE CellularRadio::getNetworkStatus(Json::Value& jData) { jData[KEY_DRX] = vParts[7]; jDebug[KEY_MM] = vParts[8]; jDebug["rrc"] = vParts[9]; - jData[KEY_CID] = vParts[10]; + jData[KEY_CID] = MTS::Text::strip(vParts[10], '"'); jData[KEY_IMSI] = MTS::Text::strip(vParts[11], '"'); jData[KEY_NETWORK] = MTS::Text::strip(vParts[12], '"'); @@ -1489,12 +1497,17 @@ CellularRadio::CODE CellularRadio::test(MTS::AutoPtr<MTS::IO::Connection>& apIo, std::string CellularRadio::extractModelFromResult(const std::string& sResult) { std::string sModel(CellularRadio::VALUE_NOT_SUPPORTED); + + printWarning("MYKYTA| ATI4 result: [%s]", sResult.c_str()); + if(sResult.find("HE910-D") != std::string::npos) { sModel = "HE910-D"; } else if(sResult.find("HE910-EUD") != std::string::npos) { sModel = "HE910-EUD"; } else if(sResult.find("LE910-NAG") != std::string::npos) { sModel = "LE910-NAG"; + } else if(sResult.find("LE910-NA1") != std::string::npos) { + sModel = "LE910-NA1"; } else if(sResult.find("LE910-SVG") != std::string::npos) { sModel = "LE910-SVG"; } else if(sResult.find("LE910-EUG") != std::string::npos) { diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index 5928467..13f7335 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -31,6 +31,7 @@ #include <mts/MTS_IO_HE910DRadio.h> #include <mts/MTS_IO_HE910EUDRadio.h> #include <mts/MTS_IO_LE910NAGRadio.h> +#include <mts/MTS_IO_LE910NA1Radio.h> #include <mts/MTS_IO_LE910SVGRadio.h> #include <mts/MTS_IO_LE910EUGRadio.h> #include <mts/MTS_IO_GE910Radio.h> @@ -44,6 +45,7 @@ CellularRadioFactory::CellularRadioFactory() { m_mCreationMap[HE910DRadio::MODEL_NAME] = &CellularRadioFactory::createHE910D; m_mCreationMap[HE910EUDRadio::MODEL_NAME] = &CellularRadioFactory::createHE910EUD; m_mCreationMap[LE910NAGRadio::MODEL_NAME] = &CellularRadioFactory::createLE910NAG; + m_mCreationMap[LE910NA1Radio::MODEL_NAME] = &CellularRadioFactory::createLE910NA1; m_mCreationMap[LE910SVGRadio::MODEL_NAME] = &CellularRadioFactory::createLE910SVG; m_mCreationMap[LE910EUGRadio::MODEL_NAME] = &CellularRadioFactory::createLE910EUG; m_mCreationMap[GE910Radio::MODEL_NAME] = &CellularRadioFactory::createGE910; @@ -124,6 +126,10 @@ CellularRadio* CellularRadioFactory::createLE910NAG(const std::string& sPort) { return new LE910NAGRadio(sPort); } +CellularRadio* CellularRadioFactory::createLE910NA1(const std::string& sPort) { + return new LE910NA1Radio(sPort); +} + CellularRadio* CellularRadioFactory::createLE910SVG(const std::string& sPort) { return new LE910SVGRadio(sPort); } diff --git a/src/MTS_IO_LE910NA1Radio.cpp b/src/MTS_IO_LE910NA1Radio.cpp new file mode 100644 index 0000000..d58483f --- /dev/null +++ b/src/MTS_IO_LE910NA1Radio.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2017 by Multi-Tech Systems + * + * This file is part of libmts-io. + * + * libmts-io is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * libmts-io is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libmts-io. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/*! + \file MTS_IO_LE910NA1Radio.cpp + \brief A brief description + + A more elaborate description +*/ + +#include <mts/MTS_IO_LE910NA1Radio.h> + +using namespace MTS::IO; + +const std::string LE910NA1Radio::MODEL_NAME("LE910-NA1"); + +LE910NA1Radio::LE910NA1Radio(const std::string& sPort) +: LE910Radio(MODEL_NAME, sPort) +{ + +} |