From 4b448e3c5daf34062861d0261c5a2253638b8100 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Fri, 16 Dec 2022 17:04:08 +0200 Subject: [GP-1195] Cellular debugging - add a query Define the set of debugging AT commands and a function to execute such commands. The function executes the commands one-by-one end returns raw command outputs. To be used by radio-query --diagnostics. --- include/mts/MTS_IO_CellularRadio.h | 11 +++++++++++ include/mts/MTS_IO_ICellularRadio.h | 21 +++++++++++++++++++++ include/mts/MTS_IO_LE910Radio.h | 2 ++ include/mts/MTS_IO_QuectelRadio.h | 2 ++ include/mts/MTS_IO_TelitRadio.h | 2 ++ 5 files changed, 38 insertions(+) (limited to 'include/mts') diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index 60659dc..e985c21 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -148,6 +148,8 @@ namespace MTS { 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); @@ -267,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& 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 91ab782..0523236 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -697,6 +697,27 @@ namespace MTS { */ 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& 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& 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& getDiagCommands(bool bIsSimReady = true) override; + static bool isContainsSignChar(const std::string& str); private: -- cgit v1.2.3