diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | include/mts/MTS_IO_ICellularRadio.h | 257 | ||||
-rw-r--r-- | include/mts/MTS_IO_TelitRadio.h | 114 | ||||
-rw-r--r-- | src/MTS_IO_ICellularRadio.cpp | 280 | ||||
-rw-r--r-- | src/MTS_IO_TelitRadio.cpp | 274 |
5 files changed, 401 insertions, 525 deletions
@@ -10,6 +10,7 @@ OBJS += \ src/MTS_IO_CdmaRadio.o \ src/MTS_IO_CE910Radio.o \ src/MTS_IO_CellularRadio.o \ + src/MTS_IO_ICellularRadio.o \ src/MTS_IO_CellularRadioFactory.o \ src/MTS_IO_Connection.o \ src/MTS_IO_DE910Radio.o \ diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index da86946..257ed00 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -12,146 +12,12 @@ namespace MTS { namespace IO { - class ICellularRadio; - namespace { - - static const std::string DEFAULT_RADIO_PORT; - static const std::string DEFAULT_RADIO_DIR; - - static const std::string VALUE_UNKNOWN; - static const std::string VALUE_UNAVAILABLE; - static const std::string VALUE_NOT_SUPPORTED; - - //Special Payload Characters - static const char ETX = 0; //Ends socket connection - static const char DLE = 0; //Escapes ETX and DLE within Payload - static const char CR = 0; - static const char NL = 0; - static const char CTRL_Z = 0; - - static const std::string RSP_OK; - static const std::string RSP_ERROR; - - static const std::string VALUE_NOT_REGISTERED; - static const std::string VALUE_REGISTERED; - static const std::string VALUE_SEARCHING; - static const std::string VALUE_DENIED; - static const std::string VALUE_ROAMING; - - //Static Data - static const std::string KEY_TYPE; //!< GSM or CDMA - static const std::string KEY_CODE; //!< Product Code : H5, H6, C2, EV3, G3 - static const std::string KEY_MODEL; //!< Model : HE910, CE910, DE910, GE910 - 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 - static const std::string KEY_MSID; //!< Mobil Station ID (MSID) aka MIN aka MSIN aka Last few digits of IMSI - static const std::string KEY_MDN; //!< Mobile Directory Number : Actual phone number dialed to reach radio - static const std::string KEY_CARRIER; //!< Cellular Service Provider (Home Network) - static const std::string KEY_ICCID; //!< Integrated Circuit Card Identifier - static const std::string KEY_MSL; //!< Master Subsidy Lock - - - //Network Status Data - static const std::string KEY_ROAMING; //!< Indicates whether or not using Home Network - 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 - static const std::string KEY_RSSI; //!< Received Signal Strength Indication - static const std::string KEY_RSSIDBM; //!< Received Signal Strength Indication in dBm - static const std::string KEY_MCC; //!< Mobile Country Code - static const std::string KEY_MNC; //!< Mobile Network (Operator) Code - static const std::string KEY_CHANNEL; //!< ARFCN or UARFCN Assigned Radio Channel - static const std::string KEY_TXPWR; //!< Transmit Power - static const std::string KEY_PSC; //!< Active Primary Synchronization Code (PSC) - static const std::string KEY_ECIO; //!< Active Ec/Io (chip energy per total wideband power in dBm) - static const std::string KEY_RSCP; //!< Active RSCP (Received Signal Code Power in dBm) - static const std::string KEY_DRX; //!< Discontinuous reception cycle length (ms) - static const std::string KEY_MM; //!< Mobility Management State - static const std::string KEY_RR; //!< Radio Resource State - static const std::string KEY_NOM; //!< Network Operator Mode - static const std::string KEY_ABND; //!< Active Band - static const std::string KEY_BLER; //!< Block Error Rate (percentage) - static const std::string KEY_SD; //!< Service Domain - static const std::string KEY_DEBUG; //!< Debug Information - - static const std::string KEY_MIP; //!< Mobile IP Information - static const std::string KEY_MIP_ID; //!< MIP Profile ID - static const std::string KEY_MIP_ENABLED; //!< MIP Profile Enabled/Disabled - static const std::string KEY_MIP_NAI; //!< Network Access Identifier - static const std::string KEY_MIP_HOMEADDRESS; //!< Home Address - static const std::string KEY_MIP_PRIMARYHA; //!< Primary Home Agent - static const std::string KEY_MIP_SECONDARYHA; //!< Secondary Home Agent - static const std::string KEY_MIP_MNAAASPI; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index - static const std::string KEY_MIP_MNHASPI; //!< Mobile Node Home Agent Security Server Parameter Index - static const std::string KEY_MIP_REVTUN; //!< Reverse Tunneling Enabled - static const std::string KEY_MIP_MNAAASS; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret - static const std::string KEY_MIP_MNHASS; //!< Mobile Node Home Agent Shared Secret - - - //Values - Type - static const std::string VALUE_TYPE_LTE; - static const std::string VALUE_TYPE_GSM; - static const std::string VALUE_TYPE_CDMA; - - //Values - Carrier - static const std::string VALUE_CARRIER_VERIZON; - static const std::string VALUE_CARRIER_AERIS; - static const std::string VALUE_CARRIER_SPRINT; - static const std::string VALUE_CARRIER_USCELLULAR; - static const std::string VALUE_CARRIER_ATT; - static const std::string VALUE_CARRIER_TMOBILE; - - static const std::string VALUE_SD_NO_SERVICE; - static const std::string VALUE_SD_CS_ONLY; - static const std::string VALUE_SD_PS_ONLY; - static const std::string VALUE_SD_CSPS; - - static const std::string VALUE_ABND_GSM_850; - static const std::string VALUE_ABND_GSM_900; - static const std::string VALUE_ABND_DCS_1800; - static const std::string VALUE_ABND_PCS_1900; - - static const std::vector<std::string> DEFAULT_BAIL_STRINGS; - - typedef std::function<bool(const std::string&/*iterationData*/, const std::string&/*allData*/)> IsNeedMoreData; - typedef std::function<void(const Json::Value&)> UpdateCb; - - /* - CODE convertModelToType(const std::string& sModel, std::string& sType); - CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, ICellularRadio *radioObj = NULL); - CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd); - CODE convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand); - - std::string sendCommand(MTS::AutoPtr<MTS::IO::Connection>& apIo, - const std::string& sCmd, - IsNeedMoreData& isNeedMoreData, - int32_t timeoutMillis = 100, - const char& ESC = CR); - - std::string sendCommand(MTS::AutoPtr<MTS::IO::Connection>& apIo, - const std::string& sCmd, - const std::vector<std::string>& vBail = DEFAULT_BAIL_STRINGS, - int32_t timeoutMillis = 100, - const char& ESC = CR); - CODE test(MTS::AutoPtr<MTS::IO::Connection>& apIo, uint32_t timeoutSeconds = 30); - - std::string extractModelFromResult(const std::string& sResult); - std::string getCodeAsString(CODE code); - */ - - } class ICellularRadio { public: + typedef std::function<bool(const std::string&/*iterationData*/, const std::string&/*allData*/)> IsNeedMoreData; + typedef std::function<void(const Json::Value&)> UpdateCb; + //Registration Values enum REGISTRATION : uint8_t { NOT_REGISTERED = 0, @@ -191,6 +57,121 @@ namespace MTS { BLOCKED, 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); + static CODE convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand); + // XXX + + static const std::string DEFAULT_RADIO_PORT; + static const std::string DEFAULT_RADIO_DIR; + + static const std::string VALUE_UNKNOWN; + static const std::string VALUE_UNAVAILABLE; + static const std::string VALUE_NOT_SUPPORTED; + + //Special Payload Characters + static const char ETX; //Ends socket connection + static const char DLE; //Escapes ETX and DLE within Payload + static const char CR; + static const char NL; + static const char CTRL_Z; + + static const std::string RSP_OK; + static const std::string RSP_ERROR; + + static const std::string VALUE_NOT_REGISTERED; + static const std::string VALUE_REGISTERED; + static const std::string VALUE_SEARCHING; + static const std::string VALUE_DENIED; + static const std::string VALUE_ROAMING; + + //Static Data + static const std::string KEY_TYPE; //!< GSM or CDMA + static const std::string KEY_CODE; //!< Product Code : H5, H6, C2, EV3, G3 + static const std::string KEY_MODEL; //!< Model : HE910, CE910, DE910, GE910 + 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 + static const std::string KEY_MSID; //!< Mobil Station ID (MSID) aka MIN aka MSIN aka Last few digits of IMSI + static const std::string KEY_MDN; //!< Mobile Directory Number : Actual phone number dialed to reach radio + static const std::string KEY_CARRIER; //!< Cellular Service Provider (Home Network) + static const std::string KEY_ICCID; //!< Integrated Circuit Card Identifier + static const std::string KEY_MSL; //!< Master Subsidy Lock + + + //Network Status Data + static const std::string KEY_ROAMING; //!< Indicates whether or not using Home Network + 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 + static const std::string KEY_RSSI; //!< Received Signal Strength Indication + static const std::string KEY_RSSIDBM; //!< Received Signal Strength Indication in dBm + static const std::string KEY_MCC; //!< Mobile Country Code + static const std::string KEY_MNC; //!< Mobile Network (Operator) Code + static const std::string KEY_CHANNEL; //!< ARFCN or UARFCN Assigned Radio Channel + static const std::string KEY_TXPWR; //!< Transmit Power + static const std::string KEY_PSC; //!< Active Primary Synchronization Code (PSC) + static const std::string KEY_ECIO; //!< Active Ec/Io (chip energy per total wideband power in dBm) + static const std::string KEY_RSCP; //!< Active RSCP (Received Signal Code Power in dBm) + static const std::string KEY_DRX; //!< Discontinuous reception cycle length (ms) + static const std::string KEY_MM; //!< Mobility Management State + static const std::string KEY_RR; //!< Radio Resource State + static const std::string KEY_NOM; //!< Network Operator Mode + static const std::string KEY_ABND; //!< Active Band + static const std::string KEY_BLER; //!< Block Error Rate (percentage) + static const std::string KEY_SD; //!< Service Domain + static const std::string KEY_DEBUG; //!< Debug Information + + static const std::string KEY_MIP; //!< Mobile IP Information + static const std::string KEY_MIP_ID; //!< MIP Profile ID + static const std::string KEY_MIP_ENABLED; //!< MIP Profile Enabled/Disabled + static const std::string KEY_MIP_NAI; //!< Network Access Identifier + static const std::string KEY_MIP_HOMEADDRESS; //!< Home Address + static const std::string KEY_MIP_PRIMARYHA; //!< Primary Home Agent + static const std::string KEY_MIP_SECONDARYHA; //!< Secondary Home Agent + static const std::string KEY_MIP_MNAAASPI; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index + static const std::string KEY_MIP_MNHASPI; //!< Mobile Node Home Agent Security Server Parameter Index + static const std::string KEY_MIP_REVTUN; //!< Reverse Tunneling Enabled + static const std::string KEY_MIP_MNAAASS; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret + static const std::string KEY_MIP_MNHASS; //!< Mobile Node Home Agent Shared Secret + + + //Values - Type + static const std::string VALUE_TYPE_LTE; + static const std::string VALUE_TYPE_GSM; + static const std::string VALUE_TYPE_CDMA; + + //Values - Carrier + static const std::string VALUE_CARRIER_VERIZON; + static const std::string VALUE_CARRIER_AERIS; + static const std::string VALUE_CARRIER_SPRINT; + static const std::string VALUE_CARRIER_USCELLULAR; + static const std::string VALUE_CARRIER_ATT; + static const std::string VALUE_CARRIER_TMOBILE; + + static const std::string VALUE_SD_NO_SERVICE; + static const std::string VALUE_SD_CS_ONLY; + static const std::string VALUE_SD_PS_ONLY; + static const std::string VALUE_SD_CSPS; + + static const std::string VALUE_ABND_GSM_850; + static const std::string VALUE_ABND_GSM_900; + static const std::string VALUE_ABND_DCS_1800; + static const std::string VALUE_ABND_PCS_1900; + + static const std::vector<std::string> DEFAULT_BAIL_STRINGS; + virtual ~ICellularRadio() = 0; virtual bool initialize(uint32_t iTimeoutMillis = 5000) = 0; @@ -380,6 +361,7 @@ namespace MTS { virtual CODE getStaticInformation(Json::Value& jData) = 0; virtual CODE getNetworkStatus(Json::Value& jData) = 0; + /* virtual CODE sendBasicCommand(const std::string& sCmd, int32_t timeoutMillis = 100, const char& ESC = CR) = 0; virtual std::string sendCommand(const std::string& sCmd, @@ -391,6 +373,7 @@ namespace MTS { IsNeedMoreData& isNeedMoreData, int32_t timeoutMillis = 100, const char& ESC = CR) = 0; + */ }; } diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index f8fce6a..0fdad6b 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -94,116 +94,6 @@ namespace MTS { class TelitRadio : public CellularRadio { public: - static const std::string DEFAULT_RADIO_PORT; - static const std::string DEFAULT_RADIO_DIR; - - static const std::string VALUE_UNKNOWN; - static const std::string VALUE_UNAVAILABLE; - static const std::string VALUE_NOT_SUPPORTED; - - //Special Payload Characters - static const char ETX; //Ends socket connection - static const char DLE; //Escapes ETX and DLE within Payload - static const char CR; - static const char NL; - static const char CTRL_Z; - - static const std::string RSP_OK; - static const std::string RSP_ERROR; - - static const std::string VALUE_NOT_REGISTERED; - static const std::string VALUE_REGISTERED; - static const std::string VALUE_SEARCHING; - static const std::string VALUE_DENIED; - static const std::string VALUE_ROAMING; - - //Static Data - static const std::string KEY_TYPE; //!< GSM or CDMA - static const std::string KEY_CODE; //!< Product Code : H5, H6, C2, EV3, G3 - static const std::string KEY_MODEL; //!< Model : HE910, CE910, DE910, GE910 - 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 - static const std::string KEY_MSID; //!< Mobil Station ID (MSID) aka MIN aka MSIN aka Last few digits of IMSI - static const std::string KEY_MDN; //!< Mobile Directory Number : Actual phone number dialed to reach radio - static const std::string KEY_CARRIER; //!< Cellular Service Provider (Home Network) - static const std::string KEY_ICCID; //!< Integrated Circuit Card Identifier - static const std::string KEY_MSL; //!< Master Subsidy Lock - - - //Network Status Data - static const std::string KEY_ROAMING; //!< Indicates whether or not using Home Network - 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 - static const std::string KEY_RSSI; //!< Received Signal Strength Indication - static const std::string KEY_RSSIDBM; //!< Received Signal Strength Indication in dBm - static const std::string KEY_MCC; //!< Mobile Country Code - static const std::string KEY_MNC; //!< Mobile Network (Operator) Code - static const std::string KEY_CHANNEL; //!< ARFCN or UARFCN Assigned Radio Channel - static const std::string KEY_TXPWR; //!< Transmit Power - static const std::string KEY_PSC; //!< Active Primary Synchronization Code (PSC) - static const std::string KEY_ECIO; //!< Active Ec/Io (chip energy per total wideband power in dBm) - static const std::string KEY_RSCP; //!< Active RSCP (Received Signal Code Power in dBm) - static const std::string KEY_DRX; //!< Discontinuous reception cycle length (ms) - static const std::string KEY_MM; //!< Mobility Management State - static const std::string KEY_RR; //!< Radio Resource State - static const std::string KEY_NOM; //!< Network Operator Mode - static const std::string KEY_ABND; //!< Active Band - static const std::string KEY_BLER; //!< Block Error Rate (percentage) - static const std::string KEY_SD; //!< Service Domain - static const std::string KEY_DEBUG; //!< Debug Information - - static const std::string KEY_MIP; //!< Mobile IP Information - static const std::string KEY_MIP_ID; //!< MIP Profile ID - static const std::string KEY_MIP_ENABLED; //!< MIP Profile Enabled/Disabled - static const std::string KEY_MIP_NAI; //!< Network Access Identifier - static const std::string KEY_MIP_HOMEADDRESS; //!< Home Address - static const std::string KEY_MIP_PRIMARYHA; //!< Primary Home Agent - static const std::string KEY_MIP_SECONDARYHA; //!< Secondary Home Agent - static const std::string KEY_MIP_MNAAASPI; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index - static const std::string KEY_MIP_MNHASPI; //!< Mobile Node Home Agent Security Server Parameter Index - static const std::string KEY_MIP_REVTUN; //!< Reverse Tunneling Enabled - static const std::string KEY_MIP_MNAAASS; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret - static const std::string KEY_MIP_MNHASS; //!< Mobile Node Home Agent Shared Secret - - - //Values - Type - static const std::string VALUE_TYPE_LTE; - static const std::string VALUE_TYPE_GSM; - static const std::string VALUE_TYPE_CDMA; - - //Values - Carrier - static const std::string VALUE_CARRIER_VERIZON; - static const std::string VALUE_CARRIER_AERIS; - static const std::string VALUE_CARRIER_SPRINT; - static const std::string VALUE_CARRIER_USCELLULAR; - static const std::string VALUE_CARRIER_ATT; - static const std::string VALUE_CARRIER_TMOBILE; - - static const std::string VALUE_SD_NO_SERVICE; - static const std::string VALUE_SD_CS_ONLY; - static const std::string VALUE_SD_PS_ONLY; - static const std::string VALUE_SD_CSPS; - - static const std::string VALUE_ABND_GSM_850; - static const std::string VALUE_ABND_GSM_900; - static const std::string VALUE_ABND_DCS_1800; - static const std::string VALUE_ABND_PCS_1900; - - static const std::vector<std::string> DEFAULT_BAIL_STRINGS; - - typedef std::function<bool(const std::string&/*iterationData*/, const std::string&/*allData*/)> IsNeedMoreData; - typedef std::function<void(const Json::Value&)> UpdateCb; - virtual ~TelitRadio(); virtual bool initialize(uint32_t iTimeoutMillis = 5000); @@ -214,10 +104,6 @@ namespace MTS { const std::string& getName() const; virtual CODE getModel(std::string& sModel); - static CODE convertModelToType(const std::string& sModel, std::string& sType); - static CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, TelitRadio *radioObj = NULL); - static CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd); - static CODE convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand); virtual CODE getFirmware(std::string& sFirmware); virtual CODE getFirmwareBuild(std::string& sFirmwareBuild); diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp new file mode 100644 index 0000000..343480a --- /dev/null +++ b/src/MTS_IO_ICellularRadio.cpp @@ -0,0 +1,280 @@ +#include "mts/MTS_IO_ICellularRadio.h" + +const char MTS::IO::ICellularRadio::ETX = 0x03; //Ends socket connection +const char MTS::IO::ICellularRadio::DLE = 0x10; //Escapes ETX and DLE within Payload +const char MTS::IO::ICellularRadio::CR = 0x0D; +const char MTS::IO::ICellularRadio::NL = 0x0A; +const char MTS::IO::ICellularRadio::CTRL_Z = 0x1A; + +const std::string MTS::IO::ICellularRadio::RSP_ERROR("ERROR"); +const std::string MTS::IO::ICellularRadio::RSP_OK("OK"); + + +const std::string MTS::IO::ICellularRadio::DEFAULT_RADIO_PORT("/dev/modem_at1"); +const std::string MTS::IO::ICellularRadio::DEFAULT_RADIO_DIR("/var/run/radio/"); +const std::string MTS::IO::ICellularRadio::VALUE_UNKNOWN("Unknown"); +const std::string MTS::IO::ICellularRadio::VALUE_UNAVAILABLE("Unavailable"); +const std::string MTS::IO::ICellularRadio::VALUE_NOT_SUPPORTED("Not Supported"); + +const std::string MTS::IO::ICellularRadio::VALUE_NOT_REGISTERED("NOT REGISTERED"); +const std::string MTS::IO::ICellularRadio::VALUE_REGISTERED("REGISTERED"); +const std::string MTS::IO::ICellularRadio::VALUE_SEARCHING("SEARCHING"); +const std::string MTS::IO::ICellularRadio::VALUE_DENIED("DENIED"); +const std::string MTS::IO::ICellularRadio::VALUE_ROAMING("ROAMING"); + +//Static Data +const std::string MTS::IO::ICellularRadio::KEY_TYPE("type"); //!< GSM or CDMA +const std::string MTS::IO::ICellularRadio::KEY_CODE("code"); //!< Product Code : H5, H6, C2, EV3, G3 +const std::string MTS::IO::ICellularRadio::KEY_MODEL("model"); //!< Model : HE910, LE910, CE910, DE910, GE910 +const std::string MTS::IO::ICellularRadio::KEY_MANUFACTURER("manufacturer"); //!< Manufacturer: Telit +const std::string MTS::IO::ICellularRadio::KEY_HARDWARE("hardware"); //!< Radio Hardware Version +const std::string MTS::IO::ICellularRadio::KEY_FIRMWARE("firmware"); //!< Radio Firmware Version +const std::string MTS::IO::ICellularRadio::KEY_FIRMWARE_BUILD("firmwarebuild"); //!< Radio Firmware Build + +const std::string MTS::IO::ICellularRadio::KEY_CARRIER("carrier"); //!< Cellular Service Provider (Home Network) +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_VERIZON("Verizon"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_AERIS("Aeris"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_SPRINT("Sprint"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_USCELLULAR("U.S. Cellular"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_ATT("AT&T"); +const std::string MTS::IO::ICellularRadio::VALUE_CARRIER_TMOBILE("T-Mobile"); + +const std::string MTS::IO::ICellularRadio::KEY_IMEI("imei"); //!< International Mobile Station Equipment Identity +const std::string MTS::IO::ICellularRadio::KEY_MEID("meid"); //!< Mobile Equipment Identifier +const std::string MTS::IO::ICellularRadio::KEY_IMSI("imsi"); //!< International Mobile Subscriber Identity +const std::string MTS::IO::ICellularRadio::KEY_MSID("msid"); //!< Mobil Station ID / Mobile Identification Number (MSID/MIN) (CDMA-Only) +const std::string MTS::IO::ICellularRadio::KEY_MDN("mdn"); //!< Mobile Directory Number : Actual phone number dialed to reach radio +const std::string MTS::IO::ICellularRadio::KEY_ICCID("iccid"); //!< Integrated Circuit Card Identifier +const std::string MTS::IO::ICellularRadio::KEY_MSL("msl"); //!< Master Subsidy Lock + +//Dynamic Data +const std::string MTS::IO::ICellularRadio::KEY_ROAMING("roaming"); //!< Indicates whether or not using Home Network +const std::string MTS::IO::ICellularRadio::KEY_DATETIME("datetime"); //!< Date and Time from tower +const std::string MTS::IO::ICellularRadio::KEY_SERVICE("service"); //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] +const std::string MTS::IO::ICellularRadio::KEY_NETWORK("network"); //!< Cellular Service Provider +const std::string MTS::IO::ICellularRadio::KEY_NETWORK_REG("netreg"); //!< Network Registration +const std::string MTS::IO::ICellularRadio::KEY_CID("cid"); //!< Cellular ID (Tower) in HEX +const std::string MTS::IO::ICellularRadio::KEY_LAC("lac"); //!< Location Area Code in HEX +const std::string MTS::IO::ICellularRadio::KEY_RAC("rac"); //!< Routing Area Code in HEX +const std::string MTS::IO::ICellularRadio::KEY_RSSI("rssi"); //!< Signal Strength +const std::string MTS::IO::ICellularRadio::KEY_RSSIDBM("rssidBm"); //!< Signal Strength in dBm +const std::string MTS::IO::ICellularRadio::KEY_MCC("mcc"); //!< Country Code +const std::string MTS::IO::ICellularRadio::KEY_MNC("mnc"); //!< Operator Code +const std::string MTS::IO::ICellularRadio::KEY_CHANNEL("channel"); //!< ARFCN or UARFCN Assigned Radio Channel +const std::string MTS::IO::ICellularRadio::KEY_TXPWR("txpwr"); //!< Transmit Power +const std::string MTS::IO::ICellularRadio::KEY_PSC("psc"); //!< Active Primary Synchronization Code (PSC) +const std::string MTS::IO::ICellularRadio::KEY_ECIO("ecio"); //!< Active Ec/Io (chip energy per total wideband power in dBm) +const std::string MTS::IO::ICellularRadio::KEY_RSCP("rscp"); //!< Active RSCP (Received Signal Code Power in dBm) +const std::string MTS::IO::ICellularRadio::KEY_DRX("drx"); //!< Discontinuous reception cycle length (ms) +const std::string MTS::IO::ICellularRadio::KEY_MM("mm"); //!< Mobility Management State +const std::string MTS::IO::ICellularRadio::KEY_RR("rr"); //!< Radio Resource State +const std::string MTS::IO::ICellularRadio::KEY_NOM("nom"); //!< Network Operator Mode +const std::string MTS::IO::ICellularRadio::KEY_ABND("abnd"); //!< Active Band +const std::string MTS::IO::ICellularRadio::KEY_BLER("bler"); //!< Block Error Rate (percentage) +const std::string MTS::IO::ICellularRadio::KEY_SD("sd"); //!< Service Domain +const std::string MTS::IO::ICellularRadio::KEY_DEBUG("debug"); //!< Debug Information + +const std::string MTS::IO::ICellularRadio::KEY_MIP("mipProfile"); //!< Mobile IP Information +const std::string MTS::IO::ICellularRadio::KEY_MIP_ID("id"); //!< Mobile IP ID +const std::string MTS::IO::ICellularRadio::KEY_MIP_ENABLED("enabled"); //!< Mobile IP Enabled/Disabled +const std::string MTS::IO::ICellularRadio::KEY_MIP_NAI("nai"); //!< Network Access Identifier +const std::string MTS::IO::ICellularRadio::KEY_MIP_HOMEADDRESS("homeAddress"); //!< Home Address +const std::string MTS::IO::ICellularRadio::KEY_MIP_PRIMARYHA("primaryAddress"); //!< Primary Home Agent +const std::string MTS::IO::ICellularRadio::KEY_MIP_SECONDARYHA("secondaryAddress"); //!< Secondary Home Agent +const std::string MTS::IO::ICellularRadio::KEY_MIP_MNAAASPI("mnAaaSpi"); //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index +const std::string MTS::IO::ICellularRadio::KEY_MIP_MNHASPI("mnHaSpi"); //!< Mobile Node Home Agent Security Server Parameter Index +const std::string MTS::IO::ICellularRadio::KEY_MIP_REVTUN("revTun"); //!< Reverse Tunneling Enabled +const std::string MTS::IO::ICellularRadio::KEY_MIP_MNAAASS("mnAaaSs"); //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret +const std::string MTS::IO::ICellularRadio::KEY_MIP_MNHASS("mnHaSs"); //!< Mobile Node Home Agent Shared Secret + +const std::string MTS::IO::ICellularRadio::VALUE_TYPE_GSM("GSM"); +const std::string MTS::IO::ICellularRadio::VALUE_TYPE_LTE("LTE"); +const std::string MTS::IO::ICellularRadio::VALUE_TYPE_CDMA("CDMA"); + +const std::string MTS::IO::ICellularRadio::VALUE_SD_NO_SERVICE("NO SERVICE"); +const std::string MTS::IO::ICellularRadio::VALUE_SD_CS_ONLY("CS ONLY"); +const std::string MTS::IO::ICellularRadio::VALUE_SD_PS_ONLY("PS ONLY"); +const std::string MTS::IO::ICellularRadio::VALUE_SD_CSPS("CS+PS"); + +const std::string MTS::IO::ICellularRadio::VALUE_ABND_GSM_850("GSM 850"); +const std::string MTS::IO::ICellularRadio::VALUE_ABND_GSM_900("GSM 900"); +const std::string MTS::IO::ICellularRadio::VALUE_ABND_DCS_1800("DCS 1800"); +const std::string MTS::IO::ICellularRadio::VALUE_ABND_PCS_1900("PCS 1900"); + +const std::vector<std::string> MTS::IO::ICellularRadio::DEFAULT_BAIL_STRINGS = { MTS::IO::ICellularRadio::RSP_OK, MTS::IO::ICellularRadio::RSP_ERROR }; + +MTS::IO::ICellularRadio::~ICellularRadio() +{ +} + +MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, MTS::IO::ICellularRadio *radioObject) { + CODE eCode = FAILURE; + + if(sModel.find("HE910-D") == 0) { + sCode = "H5"; + eCode = SUCCESS; + } else if (sModel.find("HE910-EUD") == 0) { + sCode = "H6"; + eCode = SUCCESS; + } else if (sModel.find("LE910-JN1") == 0) { + sCode = "LDC3"; + eCode = SUCCESS; + } else if (sModel.find("LE866A1-JS") == 0) { + sCode = "LSB3"; + eCode = SUCCESS; + } else if (sModel.find("LE910-NAG") == 0) { + sCode = "LAT1"; + eCode = SUCCESS; + } else if (sModel.find("LE910C4-NF") == 0) { + sCode = "L4N1"; + eCode = SUCCESS; + } else if (sModel.find("LE910-NA1") == 0) { + if (NULL == radioObject) { + sCode = VALUE_NOT_SUPPORTED; + eCode = ERROR; + } else { + std::string sValue; + eCode = radioObject->getActiveFirmware(sValue); + if (eCode == SUCCESS) { + sCode = "LNA3"; + } else { + sCode = "LAT3"; + } + } + eCode = SUCCESS; + } else if (sModel.find("LE910-SVG") == 0) { + sCode = "LVW2"; + eCode = SUCCESS; + } else if (sModel.find("LE910C1-NS") == 0) { + sCode = "LSP3"; + eCode = SUCCESS; + } else if (sModel.find("LE910C1-AP") == 0) { + sCode = "LAP3"; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-NA") == 0) { + sCode = "MAT1"; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-NV") == 0) { + sCode = "MVW1"; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-WW") == 0) { + sCode = "MNG2"; + eCode = SUCCESS; + } else if (sModel.find("LE910-EUG") == 0) { + sCode = "LEU1"; + eCode = SUCCESS; + } else if (sModel.find("LE910C4-EU") == 0) { + sCode = "L4E1"; + eCode = SUCCESS; + } else if (sModel.find("LE910-EU1") == 0) { + sCode = "LEU3"; + eCode = SUCCESS; + } else if (sModel.find("GE910") == 0) { + sCode = "G3"; + eCode = SUCCESS; + } else if (sModel.find("CE910") == 0) { + sCode = "C2"; + eCode = SUCCESS; + } else if (sModel.find("DE910") == 0) { + sCode = "EV3"; + eCode = SUCCESS; + } else { + sCode = VALUE_NOT_SUPPORTED; + //printError("RADIO| Could not identify MTS short code from model. [%s]", sModel.c_str()); + eCode = ERROR; + } + return eCode; +} + +MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd) { + CODE eCode = FAILURE; + switch(eSd) { + case NO_SERVICE: sSd = VALUE_SD_NO_SERVICE; eCode = SUCCESS; break; + case CS_ONLY: sSd = VALUE_SD_CS_ONLY; eCode = SUCCESS; break; + case PS_ONLY: sSd = VALUE_SD_PS_ONLY; eCode = SUCCESS; break; + case CSPS: sSd = VALUE_SD_CSPS; eCode = SUCCESS; break; + default: sSd = VALUE_UNKNOWN; eCode = FAILURE; break; + } + return eCode; +} + +MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand) { + CODE eCode = FAILURE; + switch(eBand) { + case GSM_850: sBand = VALUE_ABND_GSM_850; eCode = SUCCESS; break; + case GSM_900: sBand = VALUE_ABND_GSM_900; eCode = SUCCESS; break; + case DCS_1800: sBand = VALUE_ABND_DCS_1800; eCode = SUCCESS; break; + case PCS_1900: sBand = VALUE_ABND_PCS_1900; eCode = SUCCESS; break; + default: sBand = VALUE_UNKNOWN; eCode = FAILURE; break; + } + return eCode; +} + +MTS::IO::ICellularRadio::CODE MTS::IO::ICellularRadio::convertModelToType(const std::string& sModel, std::string& sType) { + CODE eCode = FAILURE; + sType = VALUE_NOT_SUPPORTED; + + if(sModel.find("HE910-D") == 0) { + sType = VALUE_TYPE_GSM; + eCode = SUCCESS; + } else if (sModel.find("HE910-EUD") == 0) { + sType = VALUE_TYPE_GSM; + eCode = SUCCESS; + } else if (sModel.find("LE910-JN1") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE866A1-JS") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-NAG") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910C4-NF") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-NA1") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-SVG") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-EUG") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910C4-EU") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910-EU1") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910C1-NS") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("LE910C1-AP") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-NA") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-NV") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("ME910C1-WW") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; + } else if (sModel.find("GE910") == 0) { + sType = VALUE_TYPE_GSM; + eCode = SUCCESS; + } else if (sModel.find("CE910") == 0) { + sType = VALUE_TYPE_CDMA; + eCode = SUCCESS; + } else if (sModel.find("DE910") == 0) { + sType = VALUE_TYPE_CDMA; + eCode = SUCCESS; + } else { + sType = VALUE_TYPE_GSM; + eCode = ERROR; + //printError("RADIO| Could not identify type from model. [%s]. Assuming [%s]", sModel.c_str(), sType.c_str()); + } + return eCode; +} diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp index de863c3..8209d0f 100644 --- a/src/MTS_IO_TelitRadio.cpp +++ b/src/MTS_IO_TelitRadio.cpp @@ -36,108 +36,6 @@ using namespace MTS::IO; -const char TelitRadio::ETX = 0x03; //Ends socket connection -const char TelitRadio::DLE = 0x10; //Escapes ETX and DLE within Payload -const char TelitRadio::CR = 0x0D; -const char TelitRadio::NL = 0x0A; -const char TelitRadio::CTRL_Z = 0x1A; - -const std::string TelitRadio::RSP_ERROR("ERROR"); -const std::string TelitRadio::RSP_OK("OK"); - - -const std::string TelitRadio::DEFAULT_RADIO_PORT("/dev/modem_at1"); -const std::string TelitRadio::DEFAULT_RADIO_DIR("/var/run/radio/"); -const std::string TelitRadio::VALUE_UNKNOWN("Unknown"); -const std::string TelitRadio::VALUE_UNAVAILABLE("Unavailable"); -const std::string TelitRadio::VALUE_NOT_SUPPORTED("Not Supported"); - -const std::string TelitRadio::VALUE_NOT_REGISTERED("NOT REGISTERED"); -const std::string TelitRadio::VALUE_REGISTERED("REGISTERED"); -const std::string TelitRadio::VALUE_SEARCHING("SEARCHING"); -const std::string TelitRadio::VALUE_DENIED("DENIED"); -const std::string TelitRadio::VALUE_ROAMING("ROAMING"); - -//Static Data -const std::string TelitRadio::KEY_TYPE("type"); //!< GSM or CDMA -const std::string TelitRadio::KEY_CODE("code"); //!< Product Code : H5, H6, C2, EV3, G3 -const std::string TelitRadio::KEY_MODEL("model"); //!< Model : HE910, LE910, CE910, DE910, GE910 -const std::string TelitRadio::KEY_MANUFACTURER("manufacturer"); //!< Manufacturer: Telit -const std::string TelitRadio::KEY_HARDWARE("hardware"); //!< Radio Hardware Version -const std::string TelitRadio::KEY_FIRMWARE("firmware"); //!< Radio Firmware Version -const std::string TelitRadio::KEY_FIRMWARE_BUILD("firmwarebuild"); //!< Radio Firmware Build - -const std::string TelitRadio::KEY_CARRIER("carrier"); //!< Cellular Service Provider (Home Network) -const std::string TelitRadio::VALUE_CARRIER_VERIZON("Verizon"); -const std::string TelitRadio::VALUE_CARRIER_AERIS("Aeris"); -const std::string TelitRadio::VALUE_CARRIER_SPRINT("Sprint"); -const std::string TelitRadio::VALUE_CARRIER_USCELLULAR("U.S. Cellular"); -const std::string TelitRadio::VALUE_CARRIER_ATT("AT&T"); -const std::string TelitRadio::VALUE_CARRIER_TMOBILE("T-Mobile"); - -const std::string TelitRadio::KEY_IMEI("imei"); //!< International Mobile Station Equipment Identity -const std::string TelitRadio::KEY_MEID("meid"); //!< Mobile Equipment Identifier -const std::string TelitRadio::KEY_IMSI("imsi"); //!< International Mobile Subscriber Identity -const std::string TelitRadio::KEY_MSID("msid"); //!< Mobil Station ID / Mobile Identification Number (MSID/MIN) (CDMA-Only) -const std::string TelitRadio::KEY_MDN("mdn"); //!< Mobile Directory Number : Actual phone number dialed to reach radio -const std::string TelitRadio::KEY_ICCID("iccid"); //!< Integrated Circuit Card Identifier -const std::string TelitRadio::KEY_MSL("msl"); //!< Master Subsidy Lock - -//Dynamic Data -const std::string TelitRadio::KEY_ROAMING("roaming"); //!< Indicates whether or not using Home Network -const std::string TelitRadio::KEY_DATETIME("datetime"); //!< Date and Time from tower -const std::string TelitRadio::KEY_SERVICE("service"); //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] -const std::string TelitRadio::KEY_NETWORK("network"); //!< Cellular Service Provider -const std::string TelitRadio::KEY_NETWORK_REG("netreg"); //!< Network Registration -const std::string TelitRadio::KEY_CID("cid"); //!< Cellular ID (Tower) in HEX -const std::string TelitRadio::KEY_LAC("lac"); //!< Location Area Code in HEX -const std::string TelitRadio::KEY_RAC("rac"); //!< Routing Area Code in HEX -const std::string TelitRadio::KEY_RSSI("rssi"); //!< Signal Strength -const std::string TelitRadio::KEY_RSSIDBM("rssidBm"); //!< Signal Strength in dBm -const std::string TelitRadio::KEY_MCC("mcc"); //!< Country Code -const std::string TelitRadio::KEY_MNC("mnc"); //!< Operator Code -const std::string TelitRadio::KEY_CHANNEL("channel"); //!< ARFCN or UARFCN Assigned Radio Channel -const std::string TelitRadio::KEY_TXPWR("txpwr"); //!< Transmit Power -const std::string TelitRadio::KEY_PSC("psc"); //!< Active Primary Synchronization Code (PSC) -const std::string TelitRadio::KEY_ECIO("ecio"); //!< Active Ec/Io (chip energy per total wideband power in dBm) -const std::string TelitRadio::KEY_RSCP("rscp"); //!< Active RSCP (Received Signal Code Power in dBm) -const std::string TelitRadio::KEY_DRX("drx"); //!< Discontinuous reception cycle length (ms) -const std::string TelitRadio::KEY_MM("mm"); //!< Mobility Management State -const std::string TelitRadio::KEY_RR("rr"); //!< Radio Resource State -const std::string TelitRadio::KEY_NOM("nom"); //!< Network Operator Mode -const std::string TelitRadio::KEY_ABND("abnd"); //!< Active Band -const std::string TelitRadio::KEY_BLER("bler"); //!< Block Error Rate (percentage) -const std::string TelitRadio::KEY_SD("sd"); //!< Service Domain -const std::string TelitRadio::KEY_DEBUG("debug"); //!< Debug Information - -const std::string TelitRadio::KEY_MIP("mipProfile"); //!< Mobile IP Information -const std::string TelitRadio::KEY_MIP_ID("id"); //!< Mobile IP ID -const std::string TelitRadio::KEY_MIP_ENABLED("enabled"); //!< Mobile IP Enabled/Disabled -const std::string TelitRadio::KEY_MIP_NAI("nai"); //!< Network Access Identifier -const std::string TelitRadio::KEY_MIP_HOMEADDRESS("homeAddress"); //!< Home Address -const std::string TelitRadio::KEY_MIP_PRIMARYHA("primaryAddress"); //!< Primary Home Agent -const std::string TelitRadio::KEY_MIP_SECONDARYHA("secondaryAddress"); //!< Secondary Home Agent -const std::string TelitRadio::KEY_MIP_MNAAASPI("mnAaaSpi"); //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index -const std::string TelitRadio::KEY_MIP_MNHASPI("mnHaSpi"); //!< Mobile Node Home Agent Security Server Parameter Index -const std::string TelitRadio::KEY_MIP_REVTUN("revTun"); //!< Reverse Tunneling Enabled -const std::string TelitRadio::KEY_MIP_MNAAASS("mnAaaSs"); //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret -const std::string TelitRadio::KEY_MIP_MNHASS("mnHaSs"); //!< Mobile Node Home Agent Shared Secret - -const std::string TelitRadio::VALUE_TYPE_GSM("GSM"); -const std::string TelitRadio::VALUE_TYPE_LTE("LTE"); -const std::string TelitRadio::VALUE_TYPE_CDMA("CDMA"); - -const std::string TelitRadio::VALUE_SD_NO_SERVICE("NO SERVICE"); -const std::string TelitRadio::VALUE_SD_CS_ONLY("CS ONLY"); -const std::string TelitRadio::VALUE_SD_PS_ONLY("PS ONLY"); -const std::string TelitRadio::VALUE_SD_CSPS("CS+PS"); - -const std::string TelitRadio::VALUE_ABND_GSM_850("GSM 850"); -const std::string TelitRadio::VALUE_ABND_GSM_900("GSM 900"); -const std::string TelitRadio::VALUE_ABND_DCS_1800("DCS 1800"); -const std::string TelitRadio::VALUE_ABND_PCS_1900("PCS 1900"); - -const std::vector<std::string> TelitRadio::DEFAULT_BAIL_STRINGS = { TelitRadio::RSP_OK, TelitRadio::RSP_ERROR }; TelitRadio::TelitRadio(const std::string& sName, const std::string& sRadioPort) : m_sName(sName) @@ -266,178 +164,6 @@ TelitRadio::CODE TelitRadio::getModel(std::string& sModel) { return SUCCESS; } -TelitRadio::CODE TelitRadio::convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, TelitRadio *radioObject) { - CODE eCode = FAILURE; - - if(sModel.find("HE910-D") == 0) { - sCode = "H5"; - eCode = SUCCESS; - } else if (sModel.find("HE910-EUD") == 0) { - sCode = "H6"; - eCode = SUCCESS; - } else if (sModel.find("LE910-JN1") == 0) { - sCode = "LDC3"; - eCode = SUCCESS; - } else if (sModel.find("LE866A1-JS") == 0) { - sCode = "LSB3"; - eCode = SUCCESS; - } else if (sModel.find("LE910-NAG") == 0) { - sCode = "LAT1"; - eCode = SUCCESS; - } else if (sModel.find("LE910C4-NF") == 0) { - sCode = "L4N1"; - eCode = SUCCESS; - } else if (sModel.find("LE910-NA1") == 0) { - if (NULL == radioObject) { - sCode = VALUE_NOT_SUPPORTED; - eCode = ERROR; - } else { - std::string sValue; - eCode = radioObject->getActiveFirmware(sValue); - if (eCode == SUCCESS) { - sCode = "LNA3"; - } else { - sCode = "LAT3"; - } - } - eCode = SUCCESS; - } else if (sModel.find("LE910-SVG") == 0) { - sCode = "LVW2"; - eCode = SUCCESS; - } else if (sModel.find("LE910C1-NS") == 0) { - sCode = "LSP3"; - eCode = SUCCESS; - } else if (sModel.find("LE910C1-AP") == 0) { - sCode = "LAP3"; - eCode = SUCCESS; - } else if (sModel.find("ME910C1-NA") == 0) { - sCode = "MAT1"; - eCode = SUCCESS; - } else if (sModel.find("ME910C1-NV") == 0) { - sCode = "MVW1"; - eCode = SUCCESS; - } else if (sModel.find("ME910C1-WW") == 0) { - sCode = "MNG2"; - eCode = SUCCESS; - } else if (sModel.find("LE910-EUG") == 0) { - sCode = "LEU1"; - eCode = SUCCESS; - } else if (sModel.find("LE910C4-EU") == 0) { - sCode = "L4E1"; - eCode = SUCCESS; - } else if (sModel.find("LE910-EU1") == 0) { - sCode = "LEU3"; - eCode = SUCCESS; - } else if (sModel.find("GE910") == 0) { - sCode = "G3"; - eCode = SUCCESS; - } else if (sModel.find("CE910") == 0) { - sCode = "C2"; - eCode = SUCCESS; - } else if (sModel.find("DE910") == 0) { - sCode = "EV3"; - eCode = SUCCESS; - } else { - sCode = VALUE_NOT_SUPPORTED; - printError("RADIO| Could not identify MTS short code from model. [%s]", sModel.c_str()); - eCode = ERROR; - } - return eCode; -} - -TelitRadio::CODE TelitRadio::convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd) { - CODE eCode = FAILURE; - switch(eSd) { - case NO_SERVICE: sSd = VALUE_SD_NO_SERVICE; eCode = SUCCESS; break; - case CS_ONLY: sSd = VALUE_SD_CS_ONLY; eCode = SUCCESS; break; - case PS_ONLY: sSd = VALUE_SD_PS_ONLY; eCode = SUCCESS; break; - case CSPS: sSd = VALUE_SD_CSPS; eCode = SUCCESS; break; - default: sSd = VALUE_UNKNOWN; eCode = FAILURE; break; - } - return eCode; -} - -TelitRadio::CODE TelitRadio::convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand) { - CODE eCode = FAILURE; - switch(eBand) { - case GSM_850: sBand = VALUE_ABND_GSM_850; eCode = SUCCESS; break; - case GSM_900: sBand = VALUE_ABND_GSM_900; eCode = SUCCESS; break; - case DCS_1800: sBand = VALUE_ABND_DCS_1800; eCode = SUCCESS; break; - case PCS_1900: sBand = VALUE_ABND_PCS_1900; eCode = SUCCESS; break; - default: sBand = VALUE_UNKNOWN; eCode = FAILURE; break; - } - return eCode; -} - -TelitRadio::CODE TelitRadio::convertModelToType(const std::string& sModel, std::string& sType) { - CODE eCode = FAILURE; - sType = VALUE_NOT_SUPPORTED; - - if(sModel.find("HE910-D") == 0) { - sType = VALUE_TYPE_GSM; - eCode = SUCCESS; - } else if (sModel.find("HE910-EUD") == 0) { - sType = VALUE_TYPE_GSM; - eCode = SUCCESS; - } else if (sModel.find("LE910-JN1") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE866A1-JS") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE910-NAG") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE910C4-NF") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE910-NA1") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE910-SVG") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE910-EUG") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE910C4-EU") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE910-EU1") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE910C1-NS") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("LE910C1-AP") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("ME910C1-NA") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("ME910C1-NV") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("ME910C1-WW") == 0) { - sType = VALUE_TYPE_LTE; - eCode = SUCCESS; - } else if (sModel.find("GE910") == 0) { - sType = VALUE_TYPE_GSM; - eCode = SUCCESS; - } else if (sModel.find("CE910") == 0) { - sType = VALUE_TYPE_CDMA; - eCode = SUCCESS; - } else if (sModel.find("DE910") == 0) { - sType = VALUE_TYPE_CDMA; - eCode = SUCCESS; - } else { - sType = VALUE_TYPE_GSM; - eCode = ERROR; - printError("RADIO| Could not identify type from model. [%s]. Assuming [%s]", sModel.c_str(), sType.c_str()); - } - return eCode; -} - TelitRadio::CODE TelitRadio::getFirmware(std::string& sFirmware) { printTrace("%s| Get Firmware", m_sName.c_str()); sFirmware = VALUE_NOT_SUPPORTED; |