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 | |
| 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')
| -rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 28 | ||||
| -rw-r--r-- | src/MTS_IO_ME910Radio.cpp | 34 | 
2 files changed, 55 insertions, 7 deletions
| diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 2b15194..7366166 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -75,12 +75,13 @@ const std::string CellularRadio::VALUE_DENIED("DENIED");  const std::string CellularRadio::VALUE_ROAMING("ROAMING");  //Static Data -const std::string CellularRadio::KEY_TYPE("type");                  //!< GSM or CDMA -const std::string CellularRadio::KEY_CODE("code");                  //!< Product Code : H5, H6, C2, EV3, G3 -const std::string CellularRadio::KEY_MODEL("model");                //!< Model : HE910, LE910, CE910, DE910, GE910 -const std::string CellularRadio::KEY_MANUFACTURER("manufacturer");  //!< Manufacturer: Telit -const std::string CellularRadio::KEY_HARDWARE("hardware");          //!< Radio Hardware Version -const std::string CellularRadio::KEY_FIRMWARE("firmware");          //!< Radio Firmware Version +const std::string CellularRadio::KEY_TYPE("type");                    //!< GSM or CDMA +const std::string CellularRadio::KEY_CODE("code");                    //!< Product Code : H5, H6, C2, EV3, G3 +const std::string CellularRadio::KEY_MODEL("model");                  //!< Model : HE910, LE910, CE910, DE910, GE910 +const std::string CellularRadio::KEY_MANUFACTURER("manufacturer");    //!< Manufacturer: Telit +const std::string CellularRadio::KEY_HARDWARE("hardware");            //!< Radio Hardware Version +const std::string CellularRadio::KEY_FIRMWARE("firmware");            //!< Radio Firmware Version +const std::string CellularRadio::KEY_FIRMWARE_BUILD("firmwarebuild"); //!< Radio Firmware Build  const std::string CellularRadio::KEY_CARRIER("carrier");   //!< Cellular Service Provider (Home Network)  const std::string CellularRadio::VALUE_CARRIER_VERIZON("Verizon"); @@ -103,6 +104,7 @@ const std::string CellularRadio::KEY_ROAMING("roaming");    //!< Indicates wheth  const std::string CellularRadio::KEY_DATETIME("datetime");  //!< Date and Time from tower  const std::string CellularRadio::KEY_SERVICE("service");    //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO]  const std::string CellularRadio::KEY_NETWORK("network");    //!< Cellular Service Provider +const std::string CellularRadio::KEY_NETWORK_REG("netreg"); //!< Network Registration  const std::string CellularRadio::KEY_CID("cid");            //!< Cellular ID (Tower) in HEX  const std::string CellularRadio::KEY_LAC("lac");            //!< Location Area Code in HEX  const std::string CellularRadio::KEY_RAC("rac");            //!< Routing Area Code in HEX @@ -419,6 +421,11 @@ CellularRadio::CODE CellularRadio::getFirmware(std::string& sFirmware) {      return SUCCESS;  } +CellularRadio::CODE CellularRadio::getFirmwareBuild(std::string& sFirmwareBuild) { +    sFirmwareBuild = VALUE_NOT_SUPPORTED; +    return FAILURE; +} +  CellularRadio::CODE CellularRadio::getHardware(std::string& sHardware) {      printTrace("%s| Get Hardware", m_sName.c_str());      sHardware = VALUE_NOT_SUPPORTED; @@ -1209,9 +1216,16 @@ void CellularRadio::getCommonNetworkStats(Json::Value& jData) {      }      std::string sDate, sTime, sTimeZone;      if(getTime(sDate, sTime, sTimeZone) == SUCCESS) { -          jData[KEY_DATETIME] = sDate + " " + sTime + " GMT" + sTimeZone;      } + +    std::string sNetworkReg; +    CellularRadio::REGISTRATION eReg; +    if (getRegistration(eReg) == SUCCESS) { +        if (convertRegistrationToString(eReg, sNetworkReg) == SUCCESS) { +            jData[CellularRadio::KEY_NETWORK_REG] = sNetworkReg; +        } +    }  }  void CellularRadio::initMipProfile(Json::Value& jData) { 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; +} | 
