summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mts/MTS_IO_CellularRadio.h168
-rw-r--r--include/mts/MTS_IO_ICellularRadio.h51
-rw-r--r--include/mts/MTS_IO_QuectelRadio.h6
-rw-r--r--include/mts/MTS_IO_SequansRadio.h5
-rw-r--r--include/mts/MTS_IO_TelitRadio.h5
5 files changed, 224 insertions, 11 deletions
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h
index c2aa346..a2fa3f3 100644
--- a/include/mts/MTS_IO_CellularRadio.h
+++ b/include/mts/MTS_IO_CellularRadio.h
@@ -269,6 +269,7 @@ 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.
*
@@ -278,7 +279,172 @@ namespace MTS {
*/
virtual const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) = 0;
- virtual CODE setTimeFormat() = 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);
class RadioBandMap : public MTS::NonCopyable {
public:
diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h
index d5b5f18..2a22a5a 100644
--- a/include/mts/MTS_IO_ICellularRadio.h
+++ b/include/mts/MTS_IO_ICellularRadio.h
@@ -78,6 +78,13 @@ 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);
@@ -206,8 +213,19 @@ 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;
@@ -662,12 +680,18 @@ 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: str>": {
- * "apn": "<apn_value: str>",
- * "ipMode": "<ip_mode: str>"
+ * "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"
* }
* }
*
@@ -679,20 +703,27 @@ namespace MTS {
virtual CODE getPdpContexts(Json::Value& jData) = 0;
/**
- * @brief Set the PDP context to the radio
+ * @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.
*
- * @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.
+ * @param sId - ID of the PDP context that should be edited.
+ * @param jConfig - a JSON object that contains:
* {
- * "apn": "<APN>",
- * "ipMode": "<IP MODE>"
+ * "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"
* }
*
* @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;
diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h
index 8e75c12..09bae1e 100644
--- a/include/mts/MTS_IO_QuectelRadio.h
+++ b/include/mts/MTS_IO_QuectelRadio.h
@@ -85,6 +85,12 @@ namespace MTS {
CODE setRxDiversity(const Json::Value& jArgs) override;
+ std::vector<std::string> 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<std::string>& getDiagCommands(bool bIsSimReady = true) override;
CODE setTimeFormat() override;
diff --git a/include/mts/MTS_IO_SequansRadio.h b/include/mts/MTS_IO_SequansRadio.h
index 804d473..8392227 100644
--- a/include/mts/MTS_IO_SequansRadio.h
+++ b/include/mts/MTS_IO_SequansRadio.h
@@ -56,6 +56,11 @@ namespace MTS {
CODE getIsSimInserted(bool& bData) override;
CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk) override;
+ std::vector<std::string> getSupportedPdpContextAuthTypes() const override;
+ CODE isPdpContextAuthSupported(bool& isSupported) override;
+ CODE fillPdpContextAuthFields(Json::Value& jData) override;
+ CODE setPdpContextAuth(const PdpContextInfo& pdpContext) override;
+
const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) override;
CODE setTimeFormat() override;
diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h
index d5e8bac..39b5e22 100644
--- a/include/mts/MTS_IO_TelitRadio.h
+++ b/include/mts/MTS_IO_TelitRadio.h
@@ -73,6 +73,11 @@ namespace MTS {
virtual CODE fumoWriteGroupsABD(int fd, UpdateCb& stepCb);
//virtual CODE fumoWriteGroupC(int fd, UpdateCb& stepCb);
+ std::vector<std::string> getSupportedPdpContextAuthTypes() const override;
+ CODE isPdpContextAuthSupported(bool& isSupported) override;
+ CODE fillPdpContextAuthFields(Json::Value &jData) override;
+ CODE setPdpContextAuth(const PdpContextInfo& pdpContext) override;
+
const std::vector<std::string>& getDiagCommands(bool bIsSimReady = true) override;
static bool isContainsSignChar(const std::string& str);