diff options
author | Maksym Telychko <maksym.telychko@globallogic.com> | 2019-06-11 11:20:50 +0300 |
---|---|---|
committer | Maksym Telychko <maksym.telychko@globallogic.com> | 2019-06-11 11:20:50 +0300 |
commit | 07b7b63b15bf5f7cb94f32a5fb45acdf1cb3edfc (patch) | |
tree | 035ce15d71a75584ed204ff1626246bfabcd11d1 /src | |
parent | 00f886a2eb636a9e44eca0ab47d4125db3e9300a (diff) | |
download | libmts-io-07b7b63b15bf5f7cb94f32a5fb45acdf1cb3edfc.tar.gz libmts-io-07b7b63b15bf5f7cb94f32a5fb45acdf1cb3edfc.tar.bz2 libmts-io-07b7b63b15bf5f7cb94f32a5fb45acdf1cb3edfc.zip |
[MTS-MTQ] refactoring: performance optimization
strings replaced by const-char pointer
Diffstat (limited to 'src')
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 10 | ||||
-rw-r--r-- | src/MTS_IO_ICellularRadio.cpp | 174 |
2 files changed, 92 insertions, 92 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index f106b4c..66d44a0 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -1096,7 +1096,7 @@ const char *CellularRadio::RadioBandMap::getLTEBand(const int32_t channel) return EULTRAband[ii].name; } } - return VALUE_UNKNOWN.c_str(); + return VALUE_UNKNOWN; } const char *CellularRadio::RadioBandMap::getCDMABand(const int channel) @@ -1108,7 +1108,7 @@ const char *CellularRadio::RadioBandMap::getCDMABand(const int channel) return WCDMAband[ii].name; } } - return VALUE_UNKNOWN.c_str(); + return VALUE_UNKNOWN; } const char *CellularRadio::RadioBandMap::getGSMBand(const int channel) @@ -1120,12 +1120,12 @@ const char *CellularRadio::RadioBandMap::getGSMBand(const int channel) return GSMband[ii].name; } } - return VALUE_UNKNOWN.c_str(); + return VALUE_UNKNOWN; } const char *CellularRadio::RadioBandMap::getRadioBandName() { - const char *band = CellularRadio::VALUE_UNKNOWN.c_str(); + const char *band = CellularRadio::VALUE_UNKNOWN; if (m_sRadioType == VALUE_TYPE_LTE) { @@ -1145,7 +1145,7 @@ const char *CellularRadio::RadioBandMap::getRadioBandName() const char *CellularRadio::RadioBandMap::getRadioBandName(const std::string &channel, const std::string &radioType) { - const char *band = VALUE_UNKNOWN.c_str(); + const char *band = VALUE_UNKNOWN; int32_t chan = strtol(channel.c_str(), NULL, 10); if (radioType == VALUE_TYPE_LTE) { diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp index e206a59..58ccb2b 100644 --- a/src/MTS_IO_ICellularRadio.cpp +++ b/src/MTS_IO_ICellularRadio.cpp @@ -9,100 +9,100 @@ 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 char *MTS::IO::ICellularRadio::RSP_ERROR = "ERROR"; +const char *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 char *MTS::IO::ICellularRadio::DEFAULT_RADIO_PORT = "/dev/modem_at1"; +const char *MTS::IO::ICellularRadio::DEFAULT_RADIO_DIR = "/var/run/radio/"; +const char *MTS::IO::ICellularRadio::VALUE_UNKNOWN = "Unknown"; +const char *MTS::IO::ICellularRadio::VALUE_UNAVAILABLE = "Unavailable"; +const char *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"); +const char *MTS::IO::ICellularRadio::VALUE_NOT_REGISTERED = "NOT REGISTERED"; +const char *MTS::IO::ICellularRadio::VALUE_REGISTERED = "REGISTERED"; +const char *MTS::IO::ICellularRadio::VALUE_SEARCHING = "SEARCHING"; +const char *MTS::IO::ICellularRadio::VALUE_DENIED = "DENIED"; +const char *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 +const char *MTS::IO::ICellularRadio::KEY_TYPE = "type"; //!< GSM or CDMA +const char *MTS::IO::ICellularRadio::KEY_CODE = "code"; //!< Product Code : H5, H6, C2, EV3, G3 +const char *MTS::IO::ICellularRadio::KEY_MODEL = "model"; //!< Model : HE910, LE910, CE910, DE910, GE910 +const char *MTS::IO::ICellularRadio::KEY_MANUFACTURER = "manufacturer"; //!< Manufacturer: Telit +const char *MTS::IO::ICellularRadio::KEY_HARDWARE = "hardware"; //!< Radio Hardware Version +const char *MTS::IO::ICellularRadio::KEY_FIRMWARE = "firmware"; //!< Radio Firmware Version +const char *MTS::IO::ICellularRadio::KEY_FIRMWARE_BUILD = "firmwarebuild"; //!< Radio Firmware Build + +const char *MTS::IO::ICellularRadio::KEY_CARRIER = "carrier"; //!< Cellular Service Provider = Home Network +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_VERIZON = "Verizon"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_AERIS = "Aeris"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_SPRINT = "Sprint"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_USCELLULAR = "U.S. Cellular"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_ATT = "AT&T"; +const char *MTS::IO::ICellularRadio::VALUE_CARRIER_TMOBILE = "T-Mobile"; + +const char *MTS::IO::ICellularRadio::KEY_IMEI = "imei"; //!< International Mobile Station Equipment Identity +const char *MTS::IO::ICellularRadio::KEY_MEID = "meid"; //!< Mobile Equipment Identifier +const char *MTS::IO::ICellularRadio::KEY_IMSI = "imsi"; //!< International Mobile Subscriber Identity +const char *MTS::IO::ICellularRadio::KEY_MSID = "msid"; //!< Mobil Station ID / Mobile Identification Number = MSID/MIN = CDMA-Only +const char *MTS::IO::ICellularRadio::KEY_MDN = "mdn"; //!< Mobile Directory Number : Actual phone number dialed to reach radio +const char *MTS::IO::ICellularRadio::KEY_ICCID = "iccid"; //!< Integrated Circuit Card Identifier +const char *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 char *MTS::IO::ICellularRadio::KEY_ROAMING = "roaming"; //!< Indicates whether or not using Home Network +const char *MTS::IO::ICellularRadio::KEY_DATETIME = "datetime"; //!< Date and Time from tower +const char *MTS::IO::ICellularRadio::KEY_SERVICE = "service"; //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] +const char *MTS::IO::ICellularRadio::KEY_NETWORK = "network"; //!< Cellular Service Provider +const char *MTS::IO::ICellularRadio::KEY_NETWORK_REG = "netreg"; //!< Network Registration +const char *MTS::IO::ICellularRadio::KEY_CID = "cid"; //!< Cellular ID = Tower in HEX +const char *MTS::IO::ICellularRadio::KEY_LAC = "lac"; //!< Location Area Code in HEX +const char *MTS::IO::ICellularRadio::KEY_RAC = "rac"; //!< Routing Area Code in HEX +const char *MTS::IO::ICellularRadio::KEY_RSSI = "rssi"; //!< Signal Strength +const char *MTS::IO::ICellularRadio::KEY_RSSIDBM = "rssidBm"; //!< Signal Strength in dBm +const char *MTS::IO::ICellularRadio::KEY_MCC = "mcc"; //!< Country Code +const char *MTS::IO::ICellularRadio::KEY_MNC = "mnc"; //!< Operator Code +const char *MTS::IO::ICellularRadio::KEY_CHANNEL = "channel"; //!< ARFCN or UARFCN Assigned Radio Channel +const char *MTS::IO::ICellularRadio::KEY_TXPWR = "txpwr"; //!< Transmit Power +const char *MTS::IO::ICellularRadio::KEY_PSC = "psc"; //!< Active Primary Synchronization Code = PSC +const char *MTS::IO::ICellularRadio::KEY_ECIO = "ecio"; //!< Active Ec/Io = chip energy per total wideband power in dBm +const char *MTS::IO::ICellularRadio::KEY_RSCP = "rscp"; //!< Active RSCP = Received Signal Code Power in dBm +const char *MTS::IO::ICellularRadio::KEY_DRX = "drx"; //!< Discontinuous reception cycle length = ms +const char *MTS::IO::ICellularRadio::KEY_MM = "mm"; //!< Mobility Management State +const char *MTS::IO::ICellularRadio::KEY_RR = "rr"; //!< Radio Resource State +const char *MTS::IO::ICellularRadio::KEY_NOM = "nom"; //!< Network Operator Mode +const char *MTS::IO::ICellularRadio::KEY_ABND = "abnd"; //!< Active Band +const char *MTS::IO::ICellularRadio::KEY_BLER = "bler"; //!< Block Error Rate = percentage +const char *MTS::IO::ICellularRadio::KEY_SD = "sd"; //!< Service Domain +const char *MTS::IO::ICellularRadio::KEY_DEBUG = "debug"; //!< Debug Information + +const char *MTS::IO::ICellularRadio::KEY_MIP = "mipProfile"; //!< Mobile IP Information +const char *MTS::IO::ICellularRadio::KEY_MIP_ID = "id"; //!< Mobile IP ID +const char *MTS::IO::ICellularRadio::KEY_MIP_ENABLED = "enabled"; //!< Mobile IP Enabled/Disabled +const char *MTS::IO::ICellularRadio::KEY_MIP_NAI = "nai"; //!< Network Access Identifier +const char *MTS::IO::ICellularRadio::KEY_MIP_HOMEADDRESS = "homeAddress"; //!< Home Address +const char *MTS::IO::ICellularRadio::KEY_MIP_PRIMARYHA = "primaryAddress"; //!< Primary Home Agent +const char *MTS::IO::ICellularRadio::KEY_MIP_SECONDARYHA = "secondaryAddress"; //!< Secondary Home Agent +const char *MTS::IO::ICellularRadio::KEY_MIP_MNAAASPI = "mnAaaSpi"; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index +const char *MTS::IO::ICellularRadio::KEY_MIP_MNHASPI = "mnHaSpi"; //!< Mobile Node Home Agent Security Server Parameter Index +const char *MTS::IO::ICellularRadio::KEY_MIP_REVTUN = "revTun"; //!< Reverse Tunneling Enabled +const char *MTS::IO::ICellularRadio::KEY_MIP_MNAAASS = "mnAaaSs"; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret +const char *MTS::IO::ICellularRadio::KEY_MIP_MNHASS = "mnHaSs"; //!< Mobile Node Home Agent Shared Secret + +const char *MTS::IO::ICellularRadio::VALUE_TYPE_GSM = "GSM"; +const char *MTS::IO::ICellularRadio::VALUE_TYPE_LTE = "LTE"; +const char *MTS::IO::ICellularRadio::VALUE_TYPE_CDMA = "CDMA"; + +const char *MTS::IO::ICellularRadio::VALUE_SD_NO_SERVICE = "NO SERVICE"; +const char *MTS::IO::ICellularRadio::VALUE_SD_CS_ONLY = "CS ONLY"; +const char *MTS::IO::ICellularRadio::VALUE_SD_PS_ONLY = "PS ONLY"; +const char *MTS::IO::ICellularRadio::VALUE_SD_CSPS = "CS+PS"; + +const char *MTS::IO::ICellularRadio::VALUE_ABND_GSM_850 = "GSM 850"; +const char *MTS::IO::ICellularRadio::VALUE_ABND_GSM_900 = "GSM 900"; +const char *MTS::IO::ICellularRadio::VALUE_ABND_DCS_1800 = "DCS 1800"; +const char *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 }; |