diff options
author | Jeff Hatch <Jeff.Hatch@multitech.com> | 2018-05-02 14:55:40 -0500 |
---|---|---|
committer | Jeff Hatch <Jeff.Hatch@multitech.com> | 2018-05-02 14:55:40 -0500 |
commit | 1b8146c578dbea3868e16e560f5800007d104b5f (patch) | |
tree | 1c583bef4092c961c8c87d6d7daf3796a0e94f15 /src/MTS_IO_ME910Radio.cpp | |
parent | 9fc7c4094a2d1cfa9f23ed8e3ac80d111fd4e87f (diff) | |
download | libmts-io-1b8146c578dbea3868e16e560f5800007d104b5f.tar.gz libmts-io-1b8146c578dbea3868e16e560f5800007d104b5f.tar.bz2 libmts-io-1b8146c578dbea3868e16e560f5800007d104b5f.zip |
Add support for getting the Firmware Build Version from the Telit radio1.0.6
Diffstat (limited to 'src/MTS_IO_ME910Radio.cpp')
-rw-r--r-- | src/MTS_IO_ME910Radio.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/MTS_IO_ME910Radio.cpp b/src/MTS_IO_ME910Radio.cpp index 5ffb191..2e46164 100644 --- a/src/MTS_IO_ME910Radio.cpp +++ b/src/MTS_IO_ME910Radio.cpp @@ -25,6 +25,8 @@ A more elaborate description */ +#include <mts/MTS_Text.h> +#include <mts/MTS_Logger.h> #include <mts/MTS_IO_ME910Radio.h> using namespace MTS::IO; @@ -38,3 +40,35 @@ ME910Radio::ME910Radio(const std::string& sME910Model, const std::string& sPort) CellularRadio::CODE ME910Radio::setRxDiversity(const Json::Value& jArgs) { return FAILURE; } + + +CellularRadio::CODE ME910Radio::getFirmwareBuild(std::string& sFirmwareBuild) { + std::string sCmd("AT#CFVR"); + + std::string sResult = sendCommand(sCmd); + + size_t end = sResult.find(RSP_OK); + if (end == std::string::npos) { + printWarning("%s| Unable to get firmware build number [%s]", + getName().c_str(), + sCmd.c_str()); + return FAILURE; + } + + size_t start = sResult.find("#CFVR:"); + if (start == std::string::npos) { + printWarning("%s| Command returned unexpected response [%s]", + getName().c_str(), + sCmd.c_str()); + return FAILURE; + } + + start += sizeof("#CFVR:"); + + sFirmwareBuild = MTS::Text::trim(sResult.substr(start, end-start)); + if(sFirmwareBuild.size() == 0) { + printWarning("%s| Firmware Build Version is empty", getName().c_str()); + return FAILURE; + } + return SUCCESS; +} |