diff options
-rw-r--r-- | include/mts/MTS_IO_CellularRadio.h | 3 | ||||
-rw-r--r-- | include/mts/MTS_IO_ME910Radio.h | 2 | ||||
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 28 | ||||
-rw-r--r-- | src/MTS_IO_ME910Radio.cpp | 34 |
4 files changed, 60 insertions, 7 deletions
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index bc7c437..ca3eeb2 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -170,6 +170,7 @@ namespace MTS { static const std::string KEY_MANUFACTURER; //!< Manufacturer: Telit static const std::string KEY_HARDWARE; //!< Radio Hardware Version static const std::string KEY_FIRMWARE; //!< Radio Firmware Version + static const std::string KEY_FIRMWARE_BUILD;//!< Radio Firmware Build static const std::string KEY_IMEI; //!< International Mobile Station Equipment Identity static const std::string KEY_MEID; //!< Mobile Equipment Identifier static const std::string KEY_IMSI; //!< International Mobile Subscriber Identity @@ -185,6 +186,7 @@ namespace MTS { static const std::string KEY_DATETIME; //!< Date and Time from tower static const std::string KEY_SERVICE; //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] static const std::string KEY_NETWORK; //!< Cellular Service Provider + static const std::string KEY_NETWORK_REG; //!< Network Registration static const std::string KEY_CID; //!< Cellular ID (Tower) in HEX static const std::string KEY_LAC; //!< Location Area Code in HEX static const std::string KEY_RAC; //!< Routing Area Code in HEX @@ -264,6 +266,7 @@ namespace MTS { static CODE convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand); virtual CODE getFirmware(std::string& sFirmware); + virtual CODE getFirmwareBuild(std::string& sFirmwareBuild); virtual CODE getHardware(std::string& sHardware); virtual CODE getManufacturer(std::string& sManufacturer); virtual CODE getImei(std::string& sImei); diff --git a/include/mts/MTS_IO_ME910Radio.h b/include/mts/MTS_IO_ME910Radio.h index b3eefcf..e665d19 100644 --- a/include/mts/MTS_IO_ME910Radio.h +++ b/include/mts/MTS_IO_ME910Radio.h @@ -44,6 +44,8 @@ namespace MTS { virtual CODE setRxDiversity(const Json::Value& jArgs); + virtual CODE getFirmwareBuild(std::string& sFirmware); + protected: private: 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; +} |