diff options
| author | Jeff Hatch <jhatch@multitech.com> | 2023-01-31 13:54:52 -0600 |
|---|---|---|
| committer | Jeff Hatch <jhatch@multitech.com> | 2023-01-31 13:54:52 -0600 |
| commit | b504ed673fa55ae1a429fd468079ee8c16c4a04a (patch) | |
| tree | 620e1d7509ddfe0e9b7102485ce01a0ff4549964 | |
| parent | 430506fb7757d6736988d75c8ea53c85f6c97da9 (diff) | |
| parent | 23d702dfaaa6ef20a02e410a09ae6f67e967464f (diff) | |
| download | libmts-io-b504ed673fa55ae1a429fd468079ee8c16c4a04a.tar.gz libmts-io-b504ed673fa55ae1a429fd468079ee8c16c4a04a.tar.bz2 libmts-io-b504ed673fa55ae1a429fd468079ee8c16c4a04a.zip | |
Merge branch 'ym/GP-1733/add_sequans_support' into 'master'
[GP-1733] mPower R.6.3.X: L6G1 Support
See merge request !53
32 files changed, 878 insertions, 58 deletions
@@ -38,12 +38,14 @@ OBJS += \ src/MTS_IO_ME910Radio.o \ src/MTS_IO_LockFile.o \ src/MTS_IO_MccMncTable.o \ - src/MTS_IO_SerialConnection.o + src/MTS_IO_SerialConnection.o \ + src/MTS_IO_SequansRadio.o \ + src/MTS_IO_CB610LRadio.o CC := $(CXX) CXXFLAGS += -Wall -Werror -std=c++0x -fmessage-length=0 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden CPPFLAGS += -I=/usr/include/jsoncpp -Iinclude -LDFLAGS += -s -shared -Wl,-soname,$(APPNAME).so.0 +LDFLAGS += -shared -Wl,-soname,$(APPNAME).so.0 .PHONY: all clean install diff --git a/data/MccMncTable.csv b/data/MccMncTable.csv index e79ef10..4c6f986 100644 --- a/data/MccMncTable.csv +++ b/data/MccMncTable.csv @@ -718,6 +718,7 @@ "313","130","us","United States","1","AT&T Wireless Inc.","att-first" "313","140","us","United States","1","FirstNet","att-first" "313","210","us","United States","1","AT&T Wireless Inc.","att" +"315","010","us","United States","1","Generic CBRS","cbrs-generic" "316","010","us","United States","1","Sprint Spectrum", "316","011","us","United States","1","Southern Communications Services Inc.", "330","11","pr","Puerto Rico","1787","Puerto Rico Telephone Company Inc. (PRTC)", diff --git a/include/mts/MTS_IO_CB610LRadio.h b/include/mts/MTS_IO_CB610LRadio.h new file mode 100644 index 0000000..b802a2b --- /dev/null +++ b/include/mts/MTS_IO_CB610LRadio.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2023 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/>. + * + */ + +#ifndef MTS_IO_CB610LRADIO_H_ +#define MTS_IO_CB610LRADIO_H_ + +#include <mts/MTS_IO_SequansRadio.h> + +namespace MTS { + namespace IO { + + class CB610LRadio : public SequansRadio { + + public: + static const std::string MODEL_NAME; + + CB610LRadio(const std::string& sPort); + virtual ~CB610LRadio(); + + CODE setCellularMode(CELLULAR_MODES networks) override; + CODE getSupportedCellularModes(CELLULAR_MODES &networks) override; + + protected: + + private: + + }; + } +} + +#endif /* MTS_IO_CB610LRADIO_H_ */
\ No newline at end of file diff --git a/include/mts/MTS_IO_CE910Radio.h b/include/mts/MTS_IO_CE910Radio.h index 58642cb..8d3b912 100644 --- a/include/mts/MTS_IO_CE910Radio.h +++ b/include/mts/MTS_IO_CE910Radio.h @@ -43,6 +43,8 @@ namespace MTS { virtual ~CE910Radio(){}; CODE setRxDiversity(const Json::Value& jArgs); + virtual const std::vector<std::string> getRegistrationCommands() override; + protected: private: diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index e985c21..68c1394 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -262,7 +262,7 @@ namespace MTS { virtual std::string queryCGREGstring(); virtual void setCGREG(std::string value); - const std::vector<std::string> getRegistrationCommands(); + virtual const std::vector<std::string> getRegistrationCommands() = 0; REGISTRATION parseRegResponse(std::string sResult); CODE getRegistration(REGISTRATION& eRegistration, const std::string& sType); diff --git a/include/mts/MTS_IO_CellularRadioFactory.h b/include/mts/MTS_IO_CellularRadioFactory.h index 13f3993..127be65 100644 --- a/include/mts/MTS_IO_CellularRadioFactory.h +++ b/include/mts/MTS_IO_CellularRadioFactory.h @@ -56,6 +56,7 @@ namespace MTS { ICellularRadio* createLE866A1JS(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT) const; ICellularRadio* createEG95Radio(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT) const; ICellularRadio* createEG25Radio(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT) const; + ICellularRadio* createCB610LRadio(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT) const; protected: typedef MTS::IO::ICellularRadio* (CellularRadioFactory::*CREATEFUNCPTR)(const std::string& sPort) const; diff --git a/include/mts/MTS_IO_DE910Radio.h b/include/mts/MTS_IO_DE910Radio.h index 9f9b9ae..67964fc 100644 --- a/include/mts/MTS_IO_DE910Radio.h +++ b/include/mts/MTS_IO_DE910Radio.h @@ -41,7 +41,9 @@ namespace MTS { DE910Radio(const std::string& sPort); virtual ~DE910Radio(){}; - CODE setRxDiversity(const Json::Value& jArgs); + CODE setRxDiversity(const Json::Value& jArgs); + + const std::vector<std::string> getRegistrationCommands() override; protected: diff --git a/include/mts/MTS_IO_EG25Radio.h b/include/mts/MTS_IO_EG25Radio.h index e05fa7d..326b192 100644 --- a/include/mts/MTS_IO_EG25Radio.h +++ b/include/mts/MTS_IO_EG25Radio.h @@ -35,6 +35,8 @@ namespace MTS { EG25Radio(const std::string& sPort); virtual ~EG25Radio(); + const std::vector<std::string> getRegistrationCommands() override; + protected: private: diff --git a/include/mts/MTS_IO_EG95Radio.h b/include/mts/MTS_IO_EG95Radio.h index 6fb47c8..a238e94 100644 --- a/include/mts/MTS_IO_EG95Radio.h +++ b/include/mts/MTS_IO_EG95Radio.h @@ -35,6 +35,8 @@ namespace MTS { EG95Radio(const std::string& sPort); virtual ~EG95Radio(); + const std::vector<std::string> getRegistrationCommands() override; + protected: private: diff --git a/include/mts/MTS_IO_GE910Radio.h b/include/mts/MTS_IO_GE910Radio.h index 4904ea7..499933c 100644 --- a/include/mts/MTS_IO_GE910Radio.h +++ b/include/mts/MTS_IO_GE910Radio.h @@ -41,7 +41,8 @@ namespace MTS { GE910Radio(const std::string& sPort); virtual ~GE910Radio(){}; - CODE setRxDiversity(const Json::Value& jArgs); + CODE setRxDiversity(const Json::Value& jArgs); + const std::vector<std::string> getRegistrationCommands() override; protected: diff --git a/include/mts/MTS_IO_HE910Radio.h b/include/mts/MTS_IO_HE910Radio.h index c8700da..54ad5a3 100644 --- a/include/mts/MTS_IO_HE910Radio.h +++ b/include/mts/MTS_IO_HE910Radio.h @@ -39,10 +39,12 @@ namespace MTS { public: virtual ~HE910Radio(){}; - CODE setRxDiversity(const Json::Value& jArgs); + CODE setRxDiversity(const Json::Value& jArgs); + const std::vector<std::string> getRegistrationCommands() override; protected: HE910Radio(const std::string& sHE910Model, const std::string& sPort); + private: }; diff --git a/include/mts/MTS_IO_LE866Radio.h b/include/mts/MTS_IO_LE866Radio.h index 2775e4d..a127f63 100644 --- a/include/mts/MTS_IO_LE866Radio.h +++ b/include/mts/MTS_IO_LE866Radio.h @@ -48,6 +48,8 @@ namespace MTS { LE866Radio(const std::string& sLE866Model, const std::string& sPort); virtual ~LE866Radio(){}; + const std::vector<std::string> getRegistrationCommands() override; + protected: private: diff --git a/include/mts/MTS_IO_LE910Radio.h b/include/mts/MTS_IO_LE910Radio.h index 6700ee3..e509c95 100644 --- a/include/mts/MTS_IO_LE910Radio.h +++ b/include/mts/MTS_IO_LE910Radio.h @@ -48,6 +48,8 @@ namespace MTS { CODE setUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION mode) override; CODE getUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION& mode) override; + const std::vector<std::string> getRegistrationCommands() override; + protected: const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) override; diff --git a/include/mts/MTS_IO_ME910Radio.h b/include/mts/MTS_IO_ME910Radio.h index 93af86f..7c34009 100644 --- a/include/mts/MTS_IO_ME910Radio.h +++ b/include/mts/MTS_IO_ME910Radio.h @@ -36,6 +36,8 @@ namespace MTS { virtual CODE setRxDiversity(const Json::Value& jArgs); + const std::vector<std::string> getRegistrationCommands() override; + protected: private: diff --git a/include/mts/MTS_IO_SequansRadio.h b/include/mts/MTS_IO_SequansRadio.h new file mode 100644 index 0000000..11f2c91 --- /dev/null +++ b/include/mts/MTS_IO_SequansRadio.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2023 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/>. + * + */ + +#ifndef MTS_IO_SEQUANSRADIO +#define MTS_IO_SEQUANSRADIO + +#include <mts/MTS_IO_CellularRadio.h> + +namespace MTS { + namespace IO { + + class SequansRadio : public CellularRadio { + + public: + bool resetRadio(uint32_t iTimeoutMillis = 5000) override; + + CODE getVendorFirmware(std::string& sVendorFirmware) override; + CODE getModel(std::string& sModel) override; + CODE getIccid(std::string& sIccid) override; + CODE getService(std::string& sService) override; + CODE getNetwork(std::string& sNetwork) override; + CODE getNetworkStatus(Json::Value& jData) override; + + CODE convertSignalStrengthTodBm(const int32_t& iRssi, int32_t& iDBm) override; + CODE convertdBmToSignalStrength(const int32_t& dBm, int32_t& iRssi) override; + + CODE setMdn(const Json::Value& jArgs) override; + + CODE setUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION mode) override; + CODE getUeModeOfOperation(ICellularRadio::UE_MODES_OF_OPERATION& mode) override; + + CODE setRxDiversity(const Json::Value& jArgs) override; + + const std::vector<std::string> getRegistrationCommands() override; + + protected: + SequansRadio(const std::string& sName, const std::string& sRadioPort); + + CODE getIsSimInserted(bool& bData) override; + CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; + + const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) override; + + private: + /* + * @brief getSimLockAttemptsByType - get the number of remaining attempts to + * enter the specified SIM password type + * + * @param sType - SIM password type, "SIM PIN", "SIM PUK", "SIM PIN2" or "SIM PUK2". + * @param iAttempts - the number of remaining attempts for this password type. + * @return CODE::SUCCESS when fetched successfully, + * CODE::NOT_APPLICABLE when the modem doesn't support this feature, + * CODE::NO_RESPONSE when the modem doesn't respond, + * CODE::ERROR when the radio returns "ERROR" (SIM card removed, etc), + * CODE::FAILURE otherwise (modem is inaccessible, etc). + */ + CODE getSimLockAttemptsByType(const std::string& sType, int& iAttempts); + CODE getNetworkStatusSQN(Json::Value& jData, Json::Value& jDebug); + CODE getNetworkStatusSignal(Json::Value& jData, Json::Value& jDebug); + CODE getNetworkStatusTxPower(Json::Value& jData, Json::Value& jDebug); + + }; + } +} + +#endif /* MTS_IO_SEQUANSRADIO */ diff --git a/src/MTS_IO_CB610LRadio.cpp b/src/MTS_IO_CB610LRadio.cpp new file mode 100644 index 0000000..7fbd884 --- /dev/null +++ b/src/MTS_IO_CB610LRadio.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2023 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/>. + * + */ + +#include <mts/MTS_IO_CB610LRadio.h> + +#include <mts/MTS_Logger.h> +#include <mts/MTS_Thread.h> +#include <mts/MTS_Text.h> +#include <mts/MTS_Timer.h> + +using namespace MTS::IO; + +const std::string CB610LRadio::MODEL_NAME("CB610L"); + +CB610LRadio::CB610LRadio(const std::string& sPort) +: SequansRadio(MODEL_NAME, sPort) { + +} + +CB610LRadio::~CB610LRadio() { + +} + +ICellularRadio::CODE CB610LRadio::setCellularMode(CELLULAR_MODES networks) { + if (networks != CELLULAR_MODE_4G) { + printError("%s| The CB610L radios support only the 4G cellular mode", getName().c_str()); + return FAILURE; + } + std::string sCmd("AT+WS46=28"); + std::string cmdResult = sendCommand(sCmd); + if (cmdResult.find(ICellularRadio::RSP_OK) == std::string::npos) { + printError("%s| AT+WS46=28 returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), cmdResult.c_str()); + return FAILURE; + } + return SUCCESS; +} + +ICellularRadio::CODE CB610LRadio::getSupportedCellularModes(CELLULAR_MODES &networks) { + networks = CELLULAR_MODE_4G; + return SUCCESS; +}
\ No newline at end of file diff --git a/src/MTS_IO_CE910Radio.cpp b/src/MTS_IO_CE910Radio.cpp index d1cad9b..f0ec560 100644 --- a/src/MTS_IO_CE910Radio.cpp +++ b/src/MTS_IO_CE910Radio.cpp @@ -41,5 +41,9 @@ CE910Radio::CE910Radio(const std::string& sPort) ICellularRadio::CODE CE910Radio::setRxDiversity(const Json::Value& jArgs) { /* Command string for CE radios: N/A */ - return FAILURE; + return NOT_APPLICABLE; +} + +const std::vector<std::string> CE910Radio::getRegistrationCommands() { + return { "CREG" }; } diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 069d5fa..3ce97ec 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -64,27 +64,41 @@ namespace { // http://niviuk.free.fr/lte_band.php const nameRangeMap EULTRAband[] = { - {"EUTRAN BAND1", 0, 599}, {"EUTRAN BAND2", 600, 1199}, - {"EUTRAN BAND3", 1200, 1949}, {"EUTRAN BAND4", 1950, 2399}, - {"EUTRAN BAND5", 2400, 2649}, {"EUTRAN BAND6", 2650, 2749}, - {"EUTRAN BAND7", 2750, 3449}, {"EUTRAN BAND8", 3450, 3799}, - {"EUTRAN BAND9", 3800, 4149}, {"EUTRAN BAND10", 4150, 4749}, - {"EUTRAN BAND11", 4750, 4999}, {"EUTRAN BAND12", 5000, 5179}, - {"EUTRAN BAND13", 5180, 5279}, {"EUTRAN BAND14", 5280, 5379}, - {"EUTRAN BAND17", 5730, 5849}, {"EUTRAN BAND18", 5850, 5999}, - {"EUTRAN BAND19", 6000, 6149}, {"EUTRAN BAND20", 6150, 6449}, - {"EUTRAN BAND21", 6450, 6525}, {"EUTRAN BAND22", 6600, 7399}, - {"EUTRAN BAND23", 7500, 7699}, {"EUTRAN BAND24", 7700, 8039}, - {"EUTRAN BAND25", 8040, 8689}, {"EUTRAN BAND26", 8690, 9039}, - {"EUTRAN BAND27", 9040, 9209}, {"EUTRAN BAND28", 9210, 9659}, - {"EUTRAN BAND29", 9660, 9769}, {"EUTRAN BAND30", 9770, 9869}, - {"EUTRAN BAND31", 9870, 9919}, {"EUTRAN BAND32", 9920, 10359}, - {"EUTRAN BAND33", 36000, 36199}, {"EUTRAN BAND34", 36200, 36349}, - {"EUTRAN BAND35", 36350, 36949}, {"EUTRAN BAND36", 36950, 37549}, - {"EUTRAN BAND37", 37550, 37749}, {"EUTRAN BAND38", 37750, 38249}, - {"EUTRAN BAND39", 38250, 38649}, {"EUTRAN BAND40", 38650, 39649}, - {"EUTRAN BAND41", 39650, 41589}, {"EUTRAN BAND42", 41590, 43589}, - {"EUTRAN BAND43", 43590, 45589}, {"EUTRAN BAND44", 45590, 46589} + {"EUTRAN BAND1", 0, 599}, {"EUTRAN BAND2", 600, 1199}, + {"EUTRAN BAND3", 1200, 1949}, {"EUTRAN BAND4", 1950, 2399}, + {"EUTRAN BAND5", 2400, 2649}, {"EUTRAN BAND6", 2650, 2749}, + {"EUTRAN BAND7", 2750, 3449}, {"EUTRAN BAND8", 3450, 3799}, + {"EUTRAN BAND9", 3800, 4149}, {"EUTRAN BAND10", 4150, 4749}, + {"EUTRAN BAND11", 4750, 4999}, {"EUTRAN BAND12", 5000, 5179}, + {"EUTRAN BAND13", 5180, 5279}, {"EUTRAN BAND14", 5280, 5379}, + {"EUTRAN BAND17", 5730, 5849}, {"EUTRAN BAND18", 5850, 5999}, + {"EUTRAN BAND19", 6000, 6149}, {"EUTRAN BAND20", 6150, 6449}, + {"EUTRAN BAND21", 6450, 6525}, {"EUTRAN BAND22", 6600, 7399}, + {"EUTRAN BAND23", 7500, 7699}, {"EUTRAN BAND24", 7700, 8039}, + {"EUTRAN BAND25", 8040, 8689}, {"EUTRAN BAND26", 8690, 9039}, + {"EUTRAN BAND27", 9040, 9209}, {"EUTRAN BAND28", 9210, 9659}, + {"EUTRAN BAND29", 9660, 9769}, {"EUTRAN BAND30", 9770, 9869}, + {"EUTRAN BAND31", 9870, 9919}, {"EUTRAN BAND32", 9920, 10359}, + {"EUTRAN BAND33", 36000, 36199}, {"EUTRAN BAND34", 36200, 36349}, + {"EUTRAN BAND35", 36350, 36949}, {"EUTRAN BAND36", 36950, 37549}, + {"EUTRAN BAND37", 37550, 37749}, {"EUTRAN BAND38", 37750, 38249}, + {"EUTRAN BAND39", 38250, 38649}, {"EUTRAN BAND40", 38650, 39649}, + {"EUTRAN BAND41", 39650, 41589}, {"EUTRAN BAND42", 41590, 43589}, + {"EUTRAN BAND43", 43590, 45589}, {"EUTRAN BAND44", 45590, 46589}, + {"EUTRAN BAND45", 46590, 46789}, {"EUTRAN BAND46", 46790, 54539}, + {"EUTRAN BAND47", 54540, 55239}, {"EUTRAN BAND48", 55240, 56739}, + {"EUTRAN BAND49", 56740, 58239}, {"EUTRAN BAND50", 58240, 59089}, + {"EUTRAN BAND51", 59090, 59139}, {"EUTRAN BAND52", 59140, 60139}, + {"EUTRAN BAND53", 60140, 60254}, + {"EUTRAN BAND65", 65536, 66435}, {"EUTRAN BAND66", 66436, 67335}, + {"EUTRAN BAND67", 67336, 67535}, {"EUTRAN BAND68", 67536, 67835}, + {"EUTRAN BAND69", 67836, 68335}, {"EUTRAN BAND70", 68336, 68585}, + {"EUTRAN BAND71", 68586, 68935}, {"EUTRAN BAND72", 68936, 68985}, + {"EUTRAN BAND73", 68986, 69035}, {"EUTRAN BAND74", 69036, 69465}, + {"EUTRAN BAND75", 69466, 70315}, {"EUTRAN BAND76", 70316, 70365}, + {"EUTRAN BAND85", 70366, 70545}, + {"EUTRAN BAND87", 70546, 70595}, {"EUTRAN BAND88", 70596, 70645}, + {"EUTRAN BAND103", 70646, 70655} }; } @@ -225,7 +239,7 @@ ICellularRadio::CODE CellularRadio::getHardware(std::string& sHardware) { ICellularRadio::CODE CellularRadio::getManufacturer(std::string& sManufacturer) { printTrace("%s| Get Manufacturer", m_sName.c_str()); sManufacturer = ICellularRadio::VALUE_NOT_SUPPORTED; - std::string sCmd("AT+GMI"); + std::string sCmd("AT+CGMI"); std::string sResult = sendCommand(sCmd); size_t pos = sResult.find(ICellularRadio::RSP_OK); if (pos == std::string::npos) { @@ -309,6 +323,13 @@ ICellularRadio::CODE CellularRadio::getSimStatusSummary(Json::Value& jData) { do { retCode = getIsSimInserted(bIsSimInserted); + + // Some radio modems do not have separate commands for the SIM presence check + if (retCode == NOT_APPLICABLE) { + retCode = SUCCESS; + bIsSimInserted = true; + } + if (retCode != SUCCESS) { break; } @@ -841,17 +862,6 @@ void CellularRadio::initMipProfile(Json::Value& jData) { jData[ICellularRadio::KEY_MIP_MNHASS] = false; } -const std::vector<std::string> CellularRadio::getRegistrationCommands() { - std::string sType; - convertModelToType(getName(), sType); - - if (sType == VALUE_TYPE_LTE) { - return { "CREG", "CGREG", "CEREG" }; - } else { - return { "CREG", "CGREG" }; - } -} - ICellularRadio::REGISTRATION CellularRadio::parseRegResponse(std::string sResult) { size_t start = sResult.find(','); size_t stop = sResult.find(' ', start); diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index 1a2cee2..f545599 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -38,6 +38,7 @@ #include <mts/MTS_IO_DE910Radio.h> #include "mts/MTS_IO_EG95Radio.h" #include "mts/MTS_IO_EG25Radio.h" +#include "mts/MTS_IO_CB610LRadio.h" #include <mts/MTS_Logger.h> using namespace MTS::IO; @@ -62,6 +63,7 @@ CellularRadioFactory::CellularRadioFactory() { m_mCreationMap[LE866A1JSRadio::MODEL_NAME] = &CellularRadioFactory::createLE866A1JS; m_mCreationMap[EG95Radio::MODEL_NAME] = &CellularRadioFactory::createEG95Radio; m_mCreationMap[EG25Radio::MODEL_NAME] = &CellularRadioFactory::createEG25Radio; + m_mCreationMap[CB610LRadio::MODEL_NAME] = &CellularRadioFactory::createCB610LRadio; } ICellularRadio* CellularRadioFactory::create(const std::string& sModel, const std::string& sPort) { @@ -101,7 +103,7 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { //Get model int count = 0; - std::string sCmd("AT+GMM"); + std::string sCmd("AT+CGMM"); std::string sResult; do { sResult = ICellularRadio::sendCommand(apIo, sCmd, ICellularRadio::DEFAULT_BAIL_STRINGS, 1000, ICellularRadio::CR); @@ -120,7 +122,7 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) { } std::string sModel = ICellularRadio::extractModelFromResult(sResult); - printDebug("RADIO| Extracted [%s] from AT+GMM query", sModel.c_str()); + printDebug("RADIO| Extracted [%s] from AT+CGMM query", sModel.c_str()); apIo->close(); return sModel; } @@ -200,3 +202,7 @@ ICellularRadio* CellularRadioFactory::createEG95Radio(const std::string& sPort) ICellularRadio* CellularRadioFactory::createEG25Radio(const std::string& sPort) const { return new EG25Radio(sPort); } + +ICellularRadio* CellularRadioFactory::createCB610LRadio(const std::string& sPort) const { + return new CB610LRadio(sPort); +}
\ No newline at end of file diff --git a/src/MTS_IO_DE910Radio.cpp b/src/MTS_IO_DE910Radio.cpp index 26668f1..d45515d 100644 --- a/src/MTS_IO_DE910Radio.cpp +++ b/src/MTS_IO_DE910Radio.cpp @@ -50,3 +50,7 @@ ICellularRadio::CODE DE910Radio::setRxDiversity(const Json::Value& jArgs) { return sendBasicCommand(sCmd); } + +const std::vector<std::string> DE910Radio::getRegistrationCommands() { + return { "CREG" }; +}
\ No newline at end of file diff --git a/src/MTS_IO_EG25Radio.cpp b/src/MTS_IO_EG25Radio.cpp index c6d1c34..effac4c 100644 --- a/src/MTS_IO_EG25Radio.cpp +++ b/src/MTS_IO_EG25Radio.cpp @@ -38,4 +38,8 @@ EG25Radio::~EG25Radio() { ICellularRadio::CODE EG25Radio::getSupportedCellularModes(CELLULAR_MODES &networks) { networks = static_cast<CELLULAR_MODES>(CELLULAR_MODE_2G | CELLULAR_MODE_3G | CELLULAR_MODE_4G); return SUCCESS; +} + +const std::vector<std::string> EG25Radio::getRegistrationCommands() { + return { "CREG", "CGREG", "CEREG" }; }
\ No newline at end of file diff --git a/src/MTS_IO_EG95Radio.cpp b/src/MTS_IO_EG95Radio.cpp index 83d6489..8dc79a3 100644 --- a/src/MTS_IO_EG95Radio.cpp +++ b/src/MTS_IO_EG95Radio.cpp @@ -52,4 +52,8 @@ ICellularRadio::CODE EG95Radio::getSupportedCellularModes(CELLULAR_MODES &networ } return SUCCESS; +} + +const std::vector<std::string> EG95Radio::getRegistrationCommands() { + return { "CREG", "CGREG", "CEREG" }; }
\ No newline at end of file diff --git a/src/MTS_IO_GE910Radio.cpp b/src/MTS_IO_GE910Radio.cpp index 61332b5..22a6482 100644 --- a/src/MTS_IO_GE910Radio.cpp +++ b/src/MTS_IO_GE910Radio.cpp @@ -41,5 +41,9 @@ GE910Radio::GE910Radio(const std::string& sPort) ICellularRadio::CODE GE910Radio::setRxDiversity(const Json::Value& jArgs) { /* Command string for GE radios: N/A */ - return FAILURE; + return NOT_APPLICABLE; } + +const std::vector<std::string> GE910Radio::getRegistrationCommands() { + return { "CREG", "CGREG" }; +}
\ No newline at end of file diff --git a/src/MTS_IO_HE910Radio.cpp b/src/MTS_IO_HE910Radio.cpp index 4c0a759..a1fddbd 100644 --- a/src/MTS_IO_HE910Radio.cpp +++ b/src/MTS_IO_HE910Radio.cpp @@ -48,3 +48,7 @@ ICellularRadio::CODE HE910Radio::setRxDiversity(const Json::Value& jArgs) { return sendBasicCommand(sCmd); } + +const std::vector<std::string> HE |
