diff options
| author | Maksym Telychko <maksym.telychko@globallogic.com> | 2019-06-11 16:47:11 +0300 | 
|---|---|---|
| committer | Maksym Telychko <maksym.telychko@globallogic.com> | 2019-06-11 16:47:11 +0300 | 
| commit | fe1c1e2e87da96fbbc432a35a903fff40f52713a (patch) | |
| tree | 29564afdf7397347dca7847ade029c9474da31f0 | |
| parent | 6848f0470159df2318c2377a08766a3bb9dcb4c3 (diff) | |
| download | libmts-io-fe1c1e2e87da96fbbc432a35a903fff40f52713a.tar.gz libmts-io-fe1c1e2e87da96fbbc432a35a903fff40f52713a.tar.bz2 libmts-io-fe1c1e2e87da96fbbc432a35a903fff40f52713a.zip | |
[MTS-MTQ] refactoring: cellular factory namespaces
| -rw-r--r-- | include/mts/MTS_IO_ICellularRadio.h | 2 | ||||
| -rw-r--r-- | src/MTS_IO_CellularRadioFactory.cpp | 12 | ||||
| -rw-r--r-- | src/MTS_IO_TelitRadio.cpp | 2 | 
3 files changed, 7 insertions, 9 deletions
| diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index 11ad193..d74ad15 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -60,7 +60,6 @@ namespace MTS {                      NOT_INSERTED                  }; -                // TODO: convert functions                  static CODE convertModelToType(const std::string& sModel, std::string& sType);                  static CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, ICellularRadio *radioObj = NULL);                  static CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd); @@ -79,7 +78,6 @@ namespace MTS {                  static CODE test(MTS::AutoPtr<MTS::IO::Connection>& apIo, uint32_t timeoutSeconds = 30);                  static std::string extractModelFromResult(const std::string& sResult);                  static std::string getCodeAsString(CODE code); -                // XXX                  static const char *DEFAULT_RADIO_PORT;                  static const char *DEFAULT_RADIO_DIR; 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; diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp index 6ce240e..ee96ff2 100644 --- a/src/MTS_IO_TelitRadio.cpp +++ b/src/MTS_IO_TelitRadio.cpp @@ -56,7 +56,7 @@ CellularRadio::CODE TelitRadio::getModel(std::string& sModel) {          printWarning("%s| Unable to get model from radio.  Returning [%s]", getName().c_str(), getName().c_str());          return SUCCESS;      } else { -        sModel = CellularRadio::extractModelFromResult(sResult); +        sModel = extractModelFromResult(sResult);          if(sModel.size() == 0) {              printWarning("%s| Unable to get model from radio.  Returning [%s]", getName().c_str(), getName().c_str());              return SUCCESS; | 
