diff options
-rw-r--r-- | data/MccMncTable.csv | 12 | ||||
-rw-r--r-- | include/mts/MTS_IO_CellularRadio.h | 14 | ||||
-rw-r--r-- | include/mts/MTS_IO_ICellularRadio.h | 62 | ||||
-rw-r--r-- | include/mts/MTS_IO_LE910Radio.h | 2 | ||||
-rw-r--r-- | include/mts/MTS_IO_QuectelRadio.h | 2 | ||||
-rw-r--r-- | include/mts/MTS_IO_TelitRadio.h | 2 | ||||
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 175 | ||||
-rw-r--r-- | src/MTS_IO_ICellularRadio.cpp | 3 | ||||
-rw-r--r-- | src/MTS_IO_LE910Radio.cpp | 65 | ||||
-rw-r--r-- | src/MTS_IO_MccMncTable.cpp | 14 | ||||
-rw-r--r-- | src/MTS_IO_QuectelRadio.cpp | 46 | ||||
-rw-r--r-- | src/MTS_IO_TelitRadio.cpp | 34 |
12 files changed, 418 insertions, 13 deletions
diff --git a/data/MccMncTable.csv b/data/MccMncTable.csv index 968dbc1..e79ef10 100644 --- a/data/MccMncTable.csv +++ b/data/MccMncTable.csv @@ -534,6 +534,7 @@ "310","270","us","United States","1","T-Mobile", "310","280","us","United States","1","AT&T Wireless Inc.","att" "310","290","us","United States","1","NEP Cellcorp Inc.", +"310","30","us","United States","1","Centennial Communications","att" "310","300","us","United States","1","T-Mobile", "310","31","us","United States","1","T-Mobile", "310","310","us","United States","1","T-Mobile", @@ -566,14 +567,14 @@ "310","560","us","United States","1","AT&T Wireless Inc.","att" "310","570","us","United States","1","MTPCS LLC", "310","580","us","United States","1","PCS ONE", -"310","590","us","United States","1","Verizon Wireless", +"310","590","us","United States","1","Verizon Wireless","vz" "310","60","us","United States","1","Consolidated Telcom", "310","600","us","United States","1","New-Cell Inc.", "310","610","us","United States","1","Elkhart TelCo. / Epic Touch Co.", "310","620","us","United States","1","Coleman County Telco /Trans TX", "310","630","us","United States","1",, "310","640","us","United States","1",, -"310","650","us","United States","1","Jasper", +"310","650","us","United States","1","Jasper","att-jasper" "310","660","us","United States","1","T-Mobile", "310","670","us","United States","1","Northstar","att" "310","680","us","United States","1","AT&T Wireless Inc.","att" @@ -593,7 +594,7 @@ "310","860","us","United States","1","Texas RSA 15B2 Limited Partnership", "310","870","us","United States","1","Kaplan Telephone Company Inc.", "310","880","us","United States","1",, -"310","890","us","United States","1","Verizon Wireless", +"310","890","us","United States","1","Verizon Wireless","vz" "310","900","us","United States","1","Cable & Communications Corp.", "310","910","us","United States","1","Verizon Wireless", "310","920","us","United States","1","Get Mobile Inc.", @@ -627,7 +628,7 @@ "311","240","us","United States","1",, "311","250","gu","Guam","1671","Wave Runner LLC", "311","260","us","United States","1","SLO Cellular Inc / Cellular One of San Luis", -"311","270","us","United States","1","Verizon Wireless", +"311","270","us","United States","1","Verizon Wireless","vz" "311","271","us","United States","1","Verizon Wireless", "311","272","us","United States","1","Verizon Wireless", "311","273","us","United States","1","Verizon Wireless", @@ -661,7 +662,7 @@ "311","430","us","United States","1","RSA 1 Limited Partnership", "311","440","us","United States","1","Bluegrass Wireless LLC", "311","460","us","United States","1","Fisher Wireless Services Inc.", -"311","480","us","United States","1","Verizon Wireless", +"311","480","us","United States","1","Verizon Wireless","vz" "311","481","us","United States","1","Verizon Wireless", "311","482","us","United States","1","Verizon Wireless", "311","483","us","United States","1","Verizon Wireless", @@ -710,6 +711,7 @@ "312","530","us","United States","1","Sprint Spectrum", "312","670","us","United States","1","AT&T Wireless Inc.","att-first" "312","680","us","United States","1","AT&T Wireless Inc.","att" +"312","770","us","United States","1","Verizon Wireless","vz" "313","100","us","United States","1","FirstNet","att-first" "313","110","us","United States","1","FirstNet","att-first" "313","120","us","United States","1","FirstNet","att-first" diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index f32251c..e985c21 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -145,6 +145,11 @@ namespace MTS { CODE getVoiceSupport(Json::Value& jData) override; CODE getVoiceSupport(bool& bVoiceEnabled, bool& bSmsOnly) override; + CODE getPdpContexts(Json::Value& jData) override; + CODE setPdpContext(const std::string& sId, const Json::Value& jConfig) override; + + CODE getDiagnostics(std::string& sReport) override; + protected: CellularRadio(const std::string& sName, const std::string& sRadioPort); @@ -264,6 +269,15 @@ namespace MTS { virtual CODE sendData(const char* pData, size_t nBytes); virtual CODE sendBasicQuery(const std::string& sCmd, const std::string& sLabel, std::string& sResult, int32_t timeoutMillis = 100, const char& ESC = ICellularRadio::CR); + /** + * @brief getDiagCommands - returns the list of Cellular Diagnostics commands for this radio. + * + * @param bIsSimReady - set to "true" if the SIM card is inserted and NOT locked by PIN or PUK. + * + * @return the list of AT commands (strings). + */ + virtual const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) = 0; + class RadioBandMap : public MTS::NonCopyable { public: RadioBandMap() diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index f3e15e2..0523236 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -205,6 +205,10 @@ namespace MTS { static const char *KEY_ATTEMPTS_PIN; //!< The number of attempts left to unlock the SIM card using PIN code static const char *KEY_ATTEMPTS_PUK; //!< The number of attempts left to unlock the SIM card using PUK code + //PDP Context + static const char *KEY_PDP_CONTEXT_APN; + static const char *KEY_PDP_CONTEXT_IPMODE; + //Values - Type static const char *VALUE_TYPE_LTE; static const char *VALUE_TYPE_GSM; @@ -656,6 +660,64 @@ namespace MTS { */ virtual CODE getSelectedBandsRaw(std::string& sRawBands) = 0; + /** + * @brief Get the list of PDP contexts from the radio + * + * @param jData - an object to be filled with data. + * { + * "<context_number: str>": { + * "apn": "<apn_value: str>", + * "ipMode": "<ip_mode: str>" + * } + * } + * + * @return CODE::SUCCESS when fetched successfully, + * CODE::NO_RESPONSE when the modem doesn't respond, + * CODE::ERROR when the radio returns "ERROR", + * CODE::FAILURE otherwise (unexpected response). + */ + virtual CODE getPdpContexts(Json::Value& jData) = 0; + + /** + * @brief Set the PDP context to the radio + * + * @param sId - a string value that contains an ID of the PDP context to change. + * @param jConfig - a JSON-object that contains: + * an IP mode for the specified PDP context, + * an APN for the specified PDP context. + * { + * "apn": "<APN>", + * "ipMode": "<IP MODE>" + * } + * + * @return CODE::SUCCESS when fetched successfully, + * CODE::NO_RESPONSE when the modem doesn't respond, + * CODE::ERROR when the radio returns "ERROR", + * CODE::FAILURE otherwise (unexpected response). + */ + virtual CODE setPdpContext(const std::string& sId, const Json::Value& jConfig) = 0; + + /** + * @brief Execute the diagnostics AT commands and capture their output + * + * NOTE: The list of diagnostic AT commands is radio-specific and changes + * depending on the radio model (code). + * + * NOTE: The method stops its execution if the radio repeatedly ignores + * the commands (returns no execution result for several of them). This + * is required to limit the maximum execution time of the function and + * prevent the process from occupying the radio for too long. In case + * of timeout, the report will contain the output of all commands that + * it managed to execute before the failure. + * + * @param sDiagReport - the AT commands execution report. + * + * @return CODE::SUCCESS when fetched successfully, + * CODE::NO_RESPONSE when the radio ignored several of the AT commands, + * CODE::FAILURE otherwise. + */ + virtual CODE getDiagnostics(std::string& sDiagReport) = 0; + }; } } diff --git a/include/mts/MTS_IO_LE910Radio.h b/include/mts/MTS_IO_LE910Radio.h index 2ba423d..6700ee3 100644 --- a/include/mts/MTS_IO_LE910Radio.h +++ b/include/mts/MTS_IO_LE910Radio.h @@ -50,6 +50,8 @@ namespace MTS { protected: + const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) override; + private: diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h index bd312b8..4315cb3 100644 --- a/include/mts/MTS_IO_QuectelRadio.h +++ b/include/mts/MTS_IO_QuectelRadio.h @@ -85,6 +85,8 @@ namespace MTS { CODE setRxDiversity(const Json::Value& jArgs) override; + const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) override; + private: // private variable to save old firmware versions during FOTA std::string m_sQuectelFirmware; diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index a06da54..d198969 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -73,6 +73,8 @@ namespace MTS { virtual CODE fumoWriteGroupsABD(int fd, UpdateCb& stepCb); //virtual CODE fumoWriteGroupC(int fd, UpdateCb& stepCb); + const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) override; + static bool isContainsSignChar(const std::string& str); private: diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index afdfc1e..069d5fa 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -1755,3 +1755,178 @@ ICellularRadio::CODE CellularRadio::getSelectedBandsRaw(std::string& sRawBands) printTrace("%s| Acquiring selected bands: not applicable", m_sName.c_str()); return NOT_APPLICABLE; } + +ICellularRadio::CODE CellularRadio::getPdpContexts(Json::Value& jData) { + printTrace("%s| Fetching the list of PDP contexts from the radio", getName().c_str()); + CODE rc; + + const std::string sCommand = "AT+CGDCONT?"; + const int dTimeout = 1000; + std::string sResult; + + rc = sendBasicQuery(sCommand, "", sResult, dTimeout); + if (rc != SUCCESS) { + return rc; + } + + std::vector<std::string> vContexts = MTS::Text::split(sResult, "+CGDCONT: "); + std::vector<std::string> vContextParams; + + for (size_t i = 0; i < vContexts.size(); i++) { + vContexts[i] = MTS::Text::trim(vContexts[i]); + + if (vContexts[i].empty()) { + continue; + } + + vContextParams = MTS::Text::split(vContexts[i], ",", 4); + + if (vContextParams.size() < 3) { + return FAILURE; + } + + std::string sContextId = vContextParams[0]; + std::string sIpMode = MTS::Text::trim(vContextParams[1], '"'); // Remove double quotes from the start and end of the value + std::string sApn = MTS::Text::trim(vContextParams[2], '"'); // Remove double quotes from the start and end of the value + + jData[sContextId][ICellularRadio::KEY_PDP_CONTEXT_IPMODE] = sIpMode; + jData[sContextId][ICellularRadio::KEY_PDP_CONTEXT_APN] = sApn; + } + + return SUCCESS; +} + +ICellularRadio::CODE CellularRadio::setPdpContext(const std::string& sId, const Json::Value& jConfig) { + printTrace("%s| Setting context to the radio", getName().c_str()); + CODE rc; + + if (sId.empty()) { + printError("%s| PDP Context ID is not specified", getName().c_str()); + return FAILURE; + } + + std::string sCommand = "AT+CGDCONT=" + sId; + const int dTimeout = 1000; + + Json::Value jAllContexts; + + rc = getPdpContexts(jAllContexts); + if (rc != SUCCESS) { + printError("%s| Failed to retrieve the current PDP context configuration: [%d]", getName().c_str(), rc); + return rc; + } + + // Remove the context if no parameters defined + if (!jConfig.isMember(ICellularRadio::KEY_PDP_CONTEXT_IPMODE) && !jConfig.isMember(ICellularRadio::KEY_PDP_CONTEXT_APN)) { + if (jAllContexts.isMember(sId)) { + rc = sendBasicCommand(sCommand, dTimeout); + return rc; + } else { + printError("%s| PDP Context [%s] does not exist", getName().c_str(), sId.c_str()); + return FAILURE; + } + } + + std::string sIpMode; + + if (jConfig.isMember(ICellularRadio::KEY_PDP_CONTEXT_IPMODE)) { + if (jConfig[ICellularRadio::KEY_PDP_CONTEXT_IPMODE] == "IP" || jConfig[ICellularRadio::KEY_PDP_CONTEXT_IPMODE] == "PPP" || + jConfig[ICellularRadio::KEY_PDP_CONTEXT_IPMODE] == "IPV6" || jConfig[ICellularRadio::KEY_PDP_CONTEXT_IPMODE] == "IPV4V6") { + sIpMode = jConfig[ICellularRadio::KEY_PDP_CONTEXT_IPMODE].asString(); + } else { + printError("%s| Invalid IP Mode defined: [%s]", getName().c_str(), jConfig[ICellularRadio::KEY_PDP_CONTEXT_IPMODE].asString().c_str()); + return FAILURE; + } + } else if (jAllContexts.isMember(sId)) { + printInfo("%s| Re-using IP Mode [%s] for PDP context [%s]", getName().c_str(), jAllContexts[sId][ICellularRadio::KEY_PDP_CONTEXT_IPMODE].asString().c_str(), sId.c_str()); + sIpMode = jAllContexts[sId][ICellularRadio::KEY_PDP_CONTEXT_IPMODE].asString(); + } else { + printError("%s| Failed to edit PDP context [%s] - no such context defined", getName().c_str(), sId.c_str()); + return FAILURE; + } + + sCommand += ",\""; + sCommand += sIpMode; + sCommand += "\""; + + std::string sApn; + + if (jConfig.isMember(ICellularRadio::KEY_PDP_CONTEXT_APN)) { + sApn = jConfig[ICellularRadio::KEY_PDP_CONTEXT_APN].asString(); + } else if (jAllContexts.isMember(sId)) { + printInfo("%s| Re-using APN [%s] for PDP context [%s]", getName().c_str(), jAllContexts[sId][ICellularRadio::KEY_PDP_CONTEXT_APN].asString().c_str(), sId.c_str()); + sApn = jAllContexts[sId][ICellularRadio::KEY_PDP_CONTEXT_APN].asString(); + } else { + printError("%s| Failed to edit PDP context [%s] - no such context defined", getName().c_str(), sId.c_str()); + return FAILURE; + } + + sCommand += ",\""; + sCommand += sApn; + sCommand += "\""; + + rc = sendBasicCommand(sCommand, dTimeout); + + return rc; +} + +ICellularRadio::CODE CellularRadio::getDiagnostics(std::string& sReport) { + // Clear the original content before using the string as a buffer. + sReport.clear(); + + // Determine whether the SIM card is locked to select the appropriate + // list of commands for this radio. + std::string sSimLockStatus; + CODE iSimLockRet = getSimLockStatus(sSimLockStatus); + + // Re-use the SIM status detection logic from TelitRadio::getNetworkStatus. + // The SIM should be inserted and NOT locked. + bool bIsSimReady = (iSimLockRet == CODE::SUCCESS + && sSimLockStatus != "SIM PIN" + && sSimLockStatus != "SIM PUK"); + + // Determine the list of diagnostic commands required for this radio. + const auto& vCommands = getDiagCommands(bIsSimReady); + + // For all commands - set the maximum timeout to 2 seconds. + const int iMaxTimeout = 2000; + + // Allow the radio to ignore up to 2 consecutive queries before giving up. + int iMaxNoResponseCount = 2; + int iNoResponseCount = 0; + + // Execute each of the commands, add their output to the report. + for (const auto& sCmd : vCommands) { + // First line - the command to execute. + sReport.append(sCmd); + sReport.push_back(ICellularRadio::CR); + sReport.push_back(ICellularRadio::NL); + + // Execute the command. + std::string sResult = sendCommand(sCmd, ICellularRadio::DEFAULT_BAIL_STRINGS, iMaxTimeout); + + // Count the number of commands ignored by the radio. + // Normally, the radio should not ignore any of the commands, + // but radios have their own bugs. + if (sResult.empty()) { + printWarning("%s| Failed to execute the [%s] command - no response from the radio in [%d] ms", getName().c_str(), sCmd.c_str(), iMaxTimeout); + sResult = "<NO RESPONSE FROM THE RADIO>\r\n"; + ++iNoResponseCount; + } else { + iNoResponseCount = 0; + } + + // If the radio ignored too many commands - probably it is stuck and will not + // return to operation on its own. There is no point in waiting any longer. + if (iNoResponseCount >= iMaxNoResponseCount) { + printError("%s| Failed to execute the diagnostic commands - the radio has stopped responding", getName().c_str()); + return CODE::NO_RESPONSE; + } + + // Append the command output to the report. + sReport.append(sResult); + } + + // All commands returned a non-empty output. + return CODE::SUCCESS; +} diff --git a/src/MTS_IO_ICellularRadio.cpp b/src/MTS_IO_ICellularRadio.cpp index 7453662..05af28d 100644 --- a/src/MTS_IO_ICellularRadio.cpp +++ b/src/MTS_IO_ICellularRadio.cpp @@ -97,6 +97,9 @@ const char *MTS::IO::ICellularRadio::KEY_MIP_REVTUN = "revTun"; 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::KEY_PDP_CONTEXT_APN = "apn"; +const char *MTS::IO::ICellularRadio::KEY_PDP_CONTEXT_IPMODE = "ipMode"; + 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"; diff --git a/src/MTS_IO_LE910Radio.cpp b/src/MTS_IO_LE910Radio.cpp index ba03c5e..2f1debb 100644 --- a/src/MTS_IO_LE910Radio.cpp +++ b/src/MTS_IO_LE910Radio.cpp @@ -165,3 +165,68 @@ ICellularRadio::CODE LE910Radio::getUeModeOfOperation(ICellularRadio::UE_MODES_O return rc; } +const std::vector<std::string>& LE910Radio::getDiagCommands(bool bIsSimReady) { + // Declare as static to initialize only when used, but cache the results. + const static std::vector<std::string> vCommands { + // Radio model and firmware: + "AT+CGMI", "AT+CGMM", "AT+CGMR", "AT#SWPKGV", "AT#CFVR", + + // Current operator profile on the radio side: + "AT#FWSWITCH?", "AT+CGSN", + + // SIM card information: + "AT#SIMDET?", "AT#CCID", "AT+CPIN?", "AT#PCT", + + // Operating mode of the radio: + "AT+CFUN?", + + // Low-level network settings: + "AT+WS46?", "AT#RXDIV", "AT#CALLDISA?", "AT+CEMODE?", + + // Data connection configuration: + "AT+CGDCONT?", "AT#PDPAUTH?", + + // Registration and connection to the tower: + "AT+CIND?", "AT+CSQ", "AT+COPS?", "AT+CREG?", "AT+CGREG?", "AT+CEREG?", + "AT#RFSTS", "AT#PSNT?", "AT#MONI", + + // Data connection status: + "AT+CGACT?", "AT+CGCONTRDP=1", "AT+CGCONTRDP=2", "AT+CGCONTRDP=3" + }; + + const static std::vector<std::string> vSimLockedCommands { + // Radio model and firmware: + "AT+CGMI", "AT+CGMM", "AT+CGMR", "AT#SWPKGV", "AT#CFVR", + + // Current operator profile on the radio side: + "AT#FWSWITCH?", "AT+CGSN", + + // SIM card information: + "AT#SIMDET?", "AT#CCID", "AT+CPIN?", "AT#PCT", + + // Operating mode of the radio: + "AT+CFUN?", + + // Low-level network settings: + "AT+WS46?", "AT#RXDIV", "AT#CALLDISA?", "AT+CEMODE?", + + // Data connection configuration: + "AT+CGDCONT?", "AT#PDPAUTH?", + + // Registration and connection to the tower. + // The same set of commands, but AT#RFSTS is replaced with a dummy command. + "AT+CIND?", "AT+CSQ", "AT+COPS?", "AT+CREG?", "AT+CGREG?", "AT+CEREG?", + "AT#RFSTS_IGNORED", "AT#PSNT?", "AT#MONI", + + // Data connection status: + "AT+CGACT?", "AT+CGCONTRDP=1", "AT+CGCONTRDP=2", "AT+CGCONTRDP=3" + }; + + // Ignore AT#RFSTS on LE910 radios (mostly legacy ones like LAT1 and LEU1) if + // the SIM card is locked by PIN or PUK. Telit Support Portal Case #5069697. + if (bIsSimReady) { + return vCommands; + } else { + return vSimLockedCommands; + } +} diff --git a/src/MTS_IO_MccMncTable.cpp b/src/MTS_IO_MccMncTable.cpp index 97f92ab..f1940be 100644 --- a/src/MTS_IO_MccMncTable.cpp +++ b/src/MTS_IO_MccMncTable.cpp @@ -21,7 +21,7 @@ /*! \file MTS_IO_MccMncTable.cpp \brief Auto-Generated MCC-MNC Lookup Table - \date 2021-11-05 + \date 2023-01-06 \author sgodinez An Auto-Generated MCC-MNC Lookup Table @@ -614,6 +614,7 @@ void MccMncTable::createTable() { m_mTable[784][624] = "us,United States,1,T-Mobile,"; m_mTable[784][640] = "us,United States,1,AT&T Wireless Inc.,att"; m_mTable[784][656] = "us,United States,1,NEP Cellcorp Inc.,"; + m_mTable[784][783] = "us,United States,1,Centennial Communications,att"; m_mTable[784][768] = "us,United States,1,T-Mobile,"; m_mTable[784][799] = "us,United States,1,T-Mobile,"; m_mTable[784][784] = "us,United States,1,T-Mobile,"; @@ -646,14 +647,14 @@ void MccMncTable::createTable() { m_mTable[784][1376] = "us,United States,1,AT&T Wireless Inc.,att"; m_mTable[784][1392] = "us,United States,1,MTPCS LLC,"; m_mTable[784][1408] = "us,United States,1,PCS ONE,"; - m_mTable[784][1424] = "us,United States,1,Verizon Wireless,"; + m_mTable[784][1424] = "us,United States,1,Verizon Wireless,vz"; m_mTable[784][1551] = "us,United States,1,Consolidated Telcom,"; m_mTable[784][1536] = "us,United States,1,New-Cell Inc.,"; m_mTable[784][1552] = "us,United States,1,Elkhart TelCo. / Epic Touch Co.,"; m_mTable[784][1568] = "us,United States,1,Coleman County Telco /Trans TX,"; m_mTable[784][1584] = "us,United States,1,,"; m_mTable[784][1600] = "us,United States,1,,"; - m_mTable[784][1616] = "us,United States,1,Jasper,"; + m_mTable[784][1616] = "us,United States,1,Jasper,att-jasper"; m_mTable[784][1632] = "us,United States,1,T-Mobile,"; m_mTable[784][1648] = "us,United States,1,Northstar,att"; m_mTable[784][1664] = "us,United States,1,AT&T Wireless Inc.,att"; @@ -673,7 +674,7 @@ void MccMncTable::createTable() { m_mTable[784][2144] = "us,United States,1,Texas RSA 15B2 Limited Partnership,"; m_mTable[784][2160] = "us,United States,1,Kaplan Telephone Company Inc.,"; m_mTable[784][2176] = "us,United States,1,,"; - m_mTable[784][2192] = "us,United States,1,Verizon Wireless,"; + m_mTable[784][2192] = "us,United States,1,Verizon Wireless,vz"; m_mTable[784][2304] = "us,United States,1,Cable & Communications Corp.,"; m_mTable[784][2320] = "us,United States,1,Verizon Wireless,"; m_mTable[784][2336] = "us,United States,1,Get Mobile Inc.,"; @@ -707,7 +708,7 @@ void MccMncTable::createTable() { m_mTable[785][576] = "us,United States,1,,"; m_mTable[785][592] = "gu,Guam,1671,Wave Runner LLC,"; m_mTable[785][608] = "us,United States,1,SLO Cellular Inc / Cellular One of San Luis,"; - m_mTable[785][624] = "us,United States,1,Verizon Wireless,"; + m_mTable[785][624] = "us,United States,1,Verizon Wireless,vz"; m_mTable[785][625] = "us,United States,1,Verizon Wireless,"; m_mTable[785][626] = "us,United States,1,Verizon Wireless,"; m_mTable[785][627] = "us,United States,1,Verizon Wireless,"; @@ -741,7 +742,7 @@ void MccMncTable::createTable() { m_mTable[785][1072] = "us,United States,1,RSA 1 Limited Partnership,"; m_mTable[785][1088] = "us,United States,1,Bluegrass Wireless LLC,"; m_mTable[785][1120] = "us,United States,1,Fisher Wireless Services Inc.,"; - m_mTable[785][1152] = "us,United States,1,Verizon Wireless,"; + m_mTable[785][1152] = "us,United States,1,Verizon Wireless,vz"; m_mTable[785][1153] = "us,United States,1,Verizon Wireless,"; m_mTable[785][1154] = "us,United States,1,Verizon Wireless,"; m_mTable[785][1155] = "us,United States,1,Verizon Wireless,"; @@ -790,6 +791,7 @@ void MccMncTable::createTable() { m_mTable[786][1328] = "us,United States,1,Sprint Spectrum,"; m_mTable[786][1648] = "us,United States,1,AT&T Wireless Inc.,att-first"; m_mTable[786][1664] = "us,United States,1,AT&T Wireless Inc.,att"; + m_mTable[786][1904] = "us,United States,1,Verizon Wireless,vz"; m_mTable[787][256] = "us,United States,1,FirstNet,att-first"; m_mTable[787][272] = "us,United States,1,FirstNet,att-first"; m_mTable[787][288] = "us,United States,1,FirstNet,att-first"; diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index ae6200e..3a5924c 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -1627,4 +1627,48 @@ ICellularRadio::CODE QuectelRadio::setRxDiversity(const Json::Value& jArgs) { } return SUCCESS; -}
\ No newline at end of file +} + +const std::vector<std::string>& QuectelRadio::getDiagCommands(bool) { + // Declare as static to initialize only when used, but cache the results. + const static std::vector<std::string> vCommands { + // Radio model and firmware: + "AT+CGMI", "AT+CGMM", "AT+CGMR", "AT+QGMR", + + // Current operator profile on the radio side: + "AT+QMBNCFG=\"SELECT\"", "AT+CGSN", + + // SIM card information: + "AT+QSIMSTAT?", "AT+QCCID", "AT+CPIN?", "AT+QPINC=\"SC\"", + + // Operating mode of the radio: + "AT+CFUN?", + + // Cellular Mode (RAT selection): + "AT+QCFG=\"nwscanseq\"", "AT+QCFG=\"nwscanmode\"", + + // Cellular Diversity configuration: + "AT+QCFG=\"divctl\",\"lte\"", "AT+QCFG=\"divctl\",\"wcdma\"", "AT+QCFG=\"diversity\"", + + // Voice call support (AT&T, T-Mobile): + "AT+QNVFR=\"/nv/item_files/ims/IMS_enable\"", + "AT+QNVFR=\"/nv/item_files/modem/mmode/sms_only\"", + "AT+QNVR=5280,0", + + // UE Mode of Operation (CEMODE; AT&T): + "AT+QCFG=\"servicedomain\"", + "AT+QNVFR=\"/nv/item_files/modem/mmode/ue_usage_setting\"", + + // Data connection configuration: + "AT+CGDCONT?", "AT+QICSGP=1", "AT+QICSGP=2", "AT+QICSGP=3", + + // Registration and connection to the tower: + "AT+CIND?", "AT+CSQ", "AT+COPS?", "AT+CREG?", "AT+CGREG?", "AT+CEREG?", + "AT+QENG=\"servingcell\"", + + // Data connection status: + "AT+CGACT?", "AT+CGCONTRDP=1", "AT+CGCONTRDP=2", "AT+CGCONTRDP=3" + }; + + return vCommands; +} diff --git a/src/MTS_IO_TelitRadio.cpp b/src/MTS_IO_TelitRadio.cpp index 5db2ddf..4a0a8b2 100644 --- a/src/MTS_IO_TelitRadio.cpp +++ b/src/MTS_IO_TelitRadio.cpp @@ -325,7 +325,7 @@ ICellularRadio::CODE TelitRadio::getNetworkStatus(Json::Value& jData) { printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); return SUCCESS; //return SUCCESS because getCommonNetworkStats() succeeded at top of this function } - if (sResult.find("SIM PIN") != std::string::npos) { + if (sResult.find("SIM PIN") != std::string::npos || sResult.find("SIM PUK") != std::string::npos) { printError("%s| The SIM is locked and must first be unlocked", getName().c_str()); printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); return SUCCESS; //return SUCCESS because getCommonNetworkStats() succeeded at top of this function @@ -1179,3 +1179,35 @@ bool MTS::IO::TelitRadio::isContainsSignChar(const std::string& str) { return true; } + +const std::vector<std::string>& TelitRadio::getDiagCommands(bool) { + // Declare as static to initialize only when used, but cache the results. + const static std::vector<std::string> vCommands { + // Radio model and firmware: + "AT+CGMI", "AT+CGMM", "AT+CGMR", "AT#SWPKGV", "AT#CFVR", + + // Current operator profile on the radio side: + "AT#FWSWITCH?", "AT+CGSN", + + // SIM card information: + "AT#SIMDET?", "AT#CCID", "AT+CPIN?", "AT#PCT", + + // Operating mode of the radio: + "AT+CFUN?", + + // Low-level network settings: + "AT+WS46?", "AT#RXDIV", "AT#CALLDISA?", "AT+CEMODE?", + + // Data connection configuration: + "AT+CGDCONT?", "AT#PDPAUTH?", + + // Registration and connection to the tower: + "AT+CIND?", "AT+CSQ", "AT+COPS?", "AT+CREG?", "AT+CGREG?", "AT+CEREG?", + "AT#RFSTS", "AT#PSNT?", "AT#MONI", + + // Data connection status: + "AT+CGACT?", "AT+CGCONTRDP=1", "AT+CGCONTRDP=2", "AT+CGCONTRDP=3" + }; + + return vCommands; +} |