From 576eb04e2d42e3b9c5fa40748d1d190a457fa1f8 Mon Sep 17 00:00:00 2001 From: sdesai Date: Wed, 15 Mar 2023 15:22:04 -0500 Subject: GP-139:Support Portal Case #5086148: use Cellular Radio timeas alternative to GPS or NTP --- include/mts/MTS_IO_CellularRadio.h | 167 ------------------------------------ include/mts/MTS_IO_ICellularRadio.h | 53 +++--------- include/mts/MTS_IO_QuectelRadio.h | 8 +- include/mts/MTS_IO_SequansRadio.h | 7 +- include/mts/MTS_IO_TelitRadio.h | 7 +- 5 files changed, 14 insertions(+), 228 deletions(-) (limited to 'include') diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index 991dc47..68c1394 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -269,7 +269,6 @@ 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); - virtual CODE isCommandSupported(const std::string& sCmd, bool& bIsSupported); /** * @brief getDiagCommands - returns the list of Cellular Diagnostics commands for this radio. * @@ -279,172 +278,6 @@ namespace MTS { */ virtual const std::vector& getDiagCommands(bool bIsSimReady = true) = 0; - struct PdpContextInfo { - std::string sId; - std::string sIpMode; - std::string sApn; - std::string sAuthType; - std::string sUsername; - std::string sPassword; - }; - - virtual std::vector getSupportedPdpContextAuthTypes() const = 0; - static CODE convertPdpContextAuthTypeToString(PDP_CONTEXT_AUTH_TYPE eAuthType, std::string& sAuthType); - static CODE convertStringToPdpContextAuthType(const std::string& sAuthType, PDP_CONTEXT_AUTH_TYPE& eAuthType); - - /** - * @brief checks if PDP context authentication is supported by the modem. - * - * @param isSupported - sets to "true" if PDP context authentication is supported, "false" otherwise. - * - * @return CODE::SUCCESS when the response from the radio is received - * CODE::NO_RESPONSE when the modem doesn't respond, - * CODE::FAILURE otherwise. - */ - virtual CODE isPdpContextAuthSupported(bool& isSupported) = 0; - - /** - * @brief Get the list of PDP contexts with the base info about them from the radio. - * - * @param jData - a JSON object to be filled with data. - * { - * "context_number : STRING": { - * "apn" : "apn_value: STRING", - * "ipMode" : "ip_mode_value: STRING", - * } - * } - * - * @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 getPdpContextsBase(Json::Value& jData); - - /** - * @brief fills jData with the information about PDP context authentication - * - * @param jData - a JSON object that is pre-filled with the list of PDP contexts: - * { - * "context_number : STRING": { - * "apn" : "apn_value: STRING", - * "ipMode" : "ip_mode_value: STRING", - * } - * } - * On success the method will complement jData with the PDP context authentication fields: - * { - * "context_number : STRING": { - * "apn" : "apn_value: STRING", - * "authType" : "auth_type_value: STRING", - * "ipMode" : "ip_mode_value: STRING", - * "password" : "password_value (optional): STRING", - * "username" : "username_value (optional): STRING" - * } - * } - * - * @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 fillPdpContextAuthFields(Json::Value& jData) = 0; - - /** - * @brief merges the current configuration of the PDP context with the one requested by user - * - * @param sId - ID of the PDP context to change. - * @param jCurrentContext - a JSON object filled with current configuration data - * { - * "apn" : "apn_value (optional): STRING", - * "authType" : "auth_type_value: STRING", - * "ipMode" : "ip_mode_value: STRING", - * "password" : "password_value (optional): STRING", - * "username" : "username_value (optional): STRING" - * } - * @param jChanges - a JSON object filled with new configuration data - * { - * "apn" : "apn_value (optional): STRING", - * "authType" : "auth_type_value (optional): STRING", - * "ipMode" : "ip_mode_value (optional): STRING", - * "password" : "password_value (optional): STRING", - * "username" : "username_value (optional): STRING" - * } - * @param jResult - a JSON object to be filled with merged data - * { - * "apn" : "apn_value (optional): STRING", - * "authType" : "auth_type_value (optional): STRING", - * "id" : "ctx_id (optional): STRING", - * "ipMode" : "ip_mode_value (optional): STRING", - * "password" : "password_value (optional): STRING", - * "username" : "username_value (optional): STRING" - * } - * @return CODE::SUCCESS. - */ - virtual CODE mergePdpContexts(const std::string& sId, const Json::Value& jCurrentContext, const Json::Value& jChanges, Json::Value& jResult); - - /** - * @brief fills a PdpContextInfo instance with the data from JSON - * @param jData - a JSON object that contains: - * { - * "apn" : "apn_value: STRING", - * "authType" : "auth_type_value: STRING", - * "id" : "ctx_id: STRING", - * "ipMode" : "ip_mode_value: STRING", - * "password" : "password_value: STRING", - * "username" : "username_value: STRING" - * } - * @param pdpContextResult - PdpContextInfo object to be filled with parameters. - * @return CODE::SUCCESS if validated successfully, - * CODE::INVALID_ARGS if validation failed. - */ - virtual CODE initPdpContextInfo(const Json::Value& jConfig, PdpContextInfo& pdpContextResult); - - /** - * @brief checks if PDP context authentication should be configured - * @param jData - a JSON object that contains: - * { - * "apn" : "apn_value (optional): STRING", - * "authType" : "auth_type_value: STRING", - * "ipMode" : "ip_mode_value: STRING", - * "password" : "password_value (optional): STRING", - * "username" : "username_value (optional): STRING" - * } - * @param bIsAuthEditRequired - sets to "false" if there are no authType, username, and password fields in the json, otherwise sets to "true". - * @return CODE::SUCCESS. - */ - static CODE isPdpContextAuthEditRequired(const Json::Value& jConfig, bool& bIsAuthEditRequired); - - /** - * @brief Sets the base PDP context parameters: IP Mode and APN - * @param pdpContext - The new PDP context configuration - * @return CODE::SUCCESS when set successfully, - * CODE::NO_RESPONSE when the modem doesn't respond, - * CODE::ERROR when the radio returns "ERROR", - * CODE::FAILURE otherwise (unexpected response). - */ - virtual CODE setPdpContextBase(const PdpContextInfo& pdpContext); - - /** - * @brief Sets the Cellular Authentication parameters for this PDP context: Authentication Type, Username and Password. - * NOTE: Some implementations (Quectel) override the current IP Mode and APN in addition to the authentication fields. - * @param pdpContext - The new PDP context configuration - * @return CODE::SUCCESS when set successfully, - * CODE::NO_RESPONSE when the modem doesn't respond, - * CODE::ERROR when the radio returns "ERROR", - * CODE::FAILURE otherwise (unexpected response). - */ - virtual CODE setPdpContextAuth(const PdpContextInfo& pdpContext) = 0; - - /** - * @brief Delete the PDP context by its ID. - * @param sId - PDP context ID - * @return CODE::SUCCESS when delete successfully, - * CODE::NO_RESPONSE when the modem doesn't respond, - * CODE::ERROR when the radio returns "ERROR", - * CODE::FAILURE otherwise (unexpected response). - */ - virtual CODE deletePdpContext(const std::string& sId); - class RadioBandMap : public MTS::NonCopyable { public: RadioBandMap() diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index a698647..da8e130 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -78,13 +78,6 @@ namespace MTS { CS_MODE2 // only non-EPS services are allowed, the usage is "data centric" }; - enum PDP_CONTEXT_AUTH_TYPE : uint8_t { - NONE = 0, - PAP, - CHAP, - PAP_CHAP - }; - 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); @@ -213,19 +206,8 @@ namespace MTS { 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_ID; static const char *KEY_PDP_CONTEXT_APN; static const char *KEY_PDP_CONTEXT_IPMODE; - static const char *KEY_PDP_CONTEXT_AUTH_TYPE; - static const char *KEY_PDP_CONTEXT_AUTH_USERNAME; - static const char *KEY_PDP_CONTEXT_AUTH_PASSWORD; - static const char *VALUE_PDP_CONTEXT_IP_MODE_IP; - static const char *VALUE_PDP_CONTEXT_IP_MODE_IPV6; - static const char *VALUE_PDP_CONTEXT_IP_MODE_IPV4V6; - static const char *VALUE_PDP_CONTEXT_AUTH_TYPE_NONE; - static const char *VALUE_PDP_CONTEXT_AUTH_TYPE_PAP; - static const char *VALUE_PDP_CONTEXT_AUTH_TYPE_CHAP; - static const char *VALUE_PDP_CONTEXT_AUTH_TYPE_PAP_CHAP; //Values - Type static const char *VALUE_TYPE_LTE; @@ -680,18 +662,12 @@ namespace MTS { /** * @brief Get the list of PDP contexts from the radio - * NOTE: authType, password and username are only present if the radio supports Cellular Authentication on - * the PDP Context Level. “password” and “username” are only present if the current authentication type is - * other than NONE. The “password” field is omitted on radios that do not allow reading the current password (i.e. on Telit LE910Cx). * * @param jData - an object to be filled with data. * { - * "context_number : STRING": { - * "apn" : "apn_value: STRING", - * "authType" : "auth_type_value: STRING", - * "ipMode" : "ip_mode_value: STRING", - * "password" : "password_value (optional): STRING", - * "username" : "username_value (optional): STRING" + * "": { + * "apn": "", + * "ipMode": "" * } * } * @@ -703,27 +679,20 @@ namespace MTS { virtual CODE getPdpContexts(Json::Value& jData) = 0; /** - * @brief Set the PDP context to the radio. If any of the fields are omitted, - * the system re-uses the current configuration for such fields. - * If all fields are omitted - the system deletes the context. - * "username" and "password" are mandatory if "ipMode" is PAP, CHAP or PAP-CHAP. - * "username", "password" and "authType" shall be omitted on radios that do NOT - * support Cellular Authentication on the PDP Context Level. + * @brief Set the PDP context to the radio * - * @param sId - ID of the PDP context that should be edited. - * @param jConfig - a JSON object that contains: + * @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_value (optional): STRING", - * "authType" : "auth_type_value (optional): STRING", - * "ipMode" : "ip_mode_value (optional): STRING", - * "password" : "password_value (optional): STRING", - * "username" : "username_value (optional): STRING" + * "apn": "", + * "ipMode": "" * } * * @return CODE::SUCCESS when fetched successfully, * CODE::NO_RESPONSE when the modem doesn't respond, * CODE::ERROR when the radio returns "ERROR", - * CODE::INVALID_ARGS when one of the JSON object values is incorrect OR not supported by the current radio, * CODE::FAILURE otherwise (unexpected response). */ virtual CODE setPdpContext(const std::string& sId, const Json::Value& jConfig) = 0; @@ -748,7 +717,7 @@ namespace MTS { * CODE::FAILURE otherwise. */ virtual CODE getDiagnostics(std::string& sDiagReport) = 0; - + virtual CODE getTimeUTC(void) = 0; }; } } diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h index b3881cb..7015acb 100644 --- a/include/mts/MTS_IO_QuectelRadio.h +++ b/include/mts/MTS_IO_QuectelRadio.h @@ -85,14 +85,8 @@ namespace MTS { CODE setRxDiversity(const Json::Value& jArgs) override; - std::vector getSupportedPdpContextAuthTypes() const override; - static CODE convertStringToPdpContextType(const std::string& sStringType, std::string& sIntType); - CODE isPdpContextAuthSupported(bool& isSupported) override; - CODE fillPdpContextAuthFields(Json::Value& jData) override; - CODE setPdpContextAuth(const PdpContextInfo& pdpContext) override; - const std::vector& getDiagCommands(bool bIsSimReady = true) override; - + CODE getTimeUTC(void) override; private: // private variable to save old firmware versions during FOTA std::string m_sQuectelFirmware; diff --git a/include/mts/MTS_IO_SequansRadio.h b/include/mts/MTS_IO_SequansRadio.h index b5a3a38..d61ae67 100644 --- a/include/mts/MTS_IO_SequansRadio.h +++ b/include/mts/MTS_IO_SequansRadio.h @@ -49,18 +49,13 @@ namespace MTS { CODE setRxDiversity(const Json::Value& jArgs) override; const std::vector getRegistrationCommands() override; - + CODE getTimeUTC(void) override; protected: SequansRadio(const std::string& sName, const std::string& sRadioPort); CODE getIsSimInserted(bool& bData) override; CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override; - std::vector getSupportedPdpContextAuthTypes() const override; - CODE isPdpContextAuthSupported(bool& isSupported) override; - CODE fillPdpContextAuthFields(Json::Value& jData) override; - CODE setPdpContextAuth(const PdpContextInfo& pdpContext) override; - const std::vector& getDiagCommands(bool bIsSimReady = true) override; private: diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index dc02755..01897ac 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -51,7 +51,7 @@ namespace MTS { CODE fumoLocalApply(UpdateCb& stepCb) override; CODE getSelectedBandsRaw(std::string& sRawBands) override; - + CODE getTimeUTC(void) override; protected: TelitRadio(const std::string& sName, const std::string& sRadioPort); @@ -73,11 +73,6 @@ namespace MTS { virtual CODE fumoWriteGroupsABD(int fd, UpdateCb& stepCb); //virtual CODE fumoWriteGroupC(int fd, UpdateCb& stepCb); - std::vector getSupportedPdpContextAuthTypes() const override; - CODE isPdpContextAuthSupported(bool& isSupported) override; - CODE fillPdpContextAuthFields(Json::Value &jData) override; - CODE setPdpContextAuth(const PdpContextInfo& pdpContext) override; - const std::vector& getDiagCommands(bool bIsSimReady = true) override; static bool isContainsSignChar(const std::string& str); -- cgit v1.2.3