File indexing completed on 2024-04-21 11:38:47

0001 /*
0002     SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef NETWORKMANAGERQT_GSM_SETTING_H
0008 #define NETWORKMANAGERQT_GSM_SETTING_H
0009 
0010 #include "setting.h"
0011 #include <networkmanagerqt/networkmanagerqt_export.h>
0012 
0013 #include <QString>
0014 
0015 namespace NetworkManager
0016 {
0017 class GsmSettingPrivate;
0018 
0019 /**
0020  * Represents gsm setting
0021  */
0022 class NETWORKMANAGERQT_EXPORT GsmSetting : public Setting
0023 {
0024 public:
0025     typedef QSharedPointer<GsmSetting> Ptr;
0026     typedef QList<Ptr> List;
0027     enum NetworkType {
0028         Any = -1,
0029         Only3G,
0030         GprsEdgeOnly,
0031         Prefer3G,
0032         Prefer2G,
0033         Prefer4GLte,
0034         Only4GLte,
0035     };
0036 
0037     GsmSetting();
0038     explicit GsmSetting(const Ptr &other);
0039     ~GsmSetting() override;
0040 
0041     QString name() const override;
0042 
0043     void setNumber(const QString &number);
0044     QString number() const;
0045 
0046     void setUsername(const QString &username);
0047     QString username() const;
0048 
0049     void setPassword(const QString &password);
0050     QString password() const;
0051 
0052     void setPasswordFlags(SecretFlags flags);
0053     SecretFlags passwordFlags() const;
0054 
0055     void setApn(const QString &apn);
0056     QString apn() const;
0057 
0058     void setNetworkId(const QString &id);
0059     QString networkId() const;
0060 
0061     /// @deprecated since NM 1.0.0
0062     void setNetworkType(NetworkType type);
0063     NetworkType networkType() const;
0064 
0065     void setPin(const QString &pin);
0066     QString pin() const;
0067 
0068     void setPinFlags(SecretFlags flags);
0069     SecretFlags pinFlags() const;
0070 
0071     /// @deprecated since NM 1.0.0
0072     void setAllowedBand(quint32 band);
0073     quint32 allowedBand() const;
0074 
0075     void setHomeOnly(bool homeOnly);
0076     bool homeOnly() const;
0077 
0078     void setDeviceId(const QString &id);
0079     QString deviceId() const;
0080 
0081     void setSimId(const QString &id);
0082     QString simId() const;
0083 
0084     void setSimOperatorId(const QString &id);
0085     QString simOperatorId() const;
0086 
0087     void secretsFromMap(const QVariantMap &secrets) override;
0088 
0089     QVariantMap secretsToMap() const override;
0090 
0091     QStringList needSecrets(bool requestNew = false) const override;
0092 
0093     void fromMap(const QVariantMap &setting) override;
0094 
0095     QVariantMap toMap() const override;
0096 
0097 protected:
0098     GsmSettingPrivate *d_ptr;
0099 
0100 private:
0101     Q_DECLARE_PRIVATE(GsmSetting)
0102 };
0103 
0104 NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const GsmSetting &setting);
0105 
0106 }
0107 
0108 #endif // NETWORKMANAGERQT_GSM_SETTING_H