diff options
-rw-r--r-- | include/mts/MTS_IO_CellularRadio.h | 333 | ||||
-rw-r--r-- | include/mts/MTS_IO_ICellularRadio.h | 1 |
2 files changed, 168 insertions, 166 deletions
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index a2fa3f3..ec5dd85 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -279,172 +279,173 @@ namespace MTS { */ virtual const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) = 0; - virtual CODE setTimeFormat() = 0; - struct PdpContextInfo { - std::string sId; - std::string sIpMode; - std::string sApn; - std::string sAuthType; - std::string sUsername; - std::string sPassword; - }; - - virtual std::vector<std::string> 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); + virtual CODE setTimeFormat() = 0; + + struct PdpContextInfo { + std::string sId; + std::string sIpMode; + std::string sApn; + std::string sAuthType; + std::string sUsername; + std::string sPassword; + }; + + virtual std::vector<std::string> 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: diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index 2a22a5a..a698647 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -748,6 +748,7 @@ namespace MTS { * CODE::FAILURE otherwise. */ virtual CODE getDiagnostics(std::string& sDiagReport) = 0; + }; } } |