File indexing completed on 2024-04-28 15:32:57

0001 /*
0002     SPDX-FileCopyrightText: 2008, 2011 Will Stephenson <wstephenson@kde.org>
0003     SPDX-FileCopyrightText: 2010 Lamarque Souza <lamarque@kde.org>
0004     SPDX-FileCopyrightText: 2013 Lukas Tinkl <ltinkl@redhat.com>
0005     SPDX-FileCopyrightText: 2013-2015 Jan Grulich <jgrulich@redhat.com>
0006 
0007     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0008 */
0009 
0010 #ifndef MODEMMANAGERQT_MODEM3GPP_H
0011 #define MODEMMANAGERQT_MODEM3GPP_H
0012 
0013 #include <modemmanagerqt_export.h>
0014 
0015 #include <QObject>
0016 #include <QSharedPointer>
0017 
0018 #include "generictypes.h"
0019 #include "interface.h"
0020 
0021 namespace ModemManager
0022 {
0023 class Modem3gppPrivate;
0024 
0025 /**
0026  * @brief The Modem3gpp class
0027  *
0028  * This class provides access to specific actions that may be performed in modems with 3GPP capabilities.
0029  */
0030 class MODEMMANAGERQT_EXPORT Modem3gpp : public Interface
0031 {
0032     Q_OBJECT
0033     Q_DECLARE_PRIVATE(Modem3gpp)
0034     Q_FLAGS(MMModem3gppFacility)
0035 
0036 public:
0037     typedef QSharedPointer<Modem3gpp> Ptr;
0038     typedef QList<Ptr> List;
0039 
0040     Q_DECLARE_FLAGS(FacilityLocks, MMModem3gppFacility)
0041 
0042     explicit Modem3gpp(const QString &path, QObject *parent = nullptr);
0043     ~Modem3gpp() override;
0044 
0045     /**
0046      * @return the IMEI of the device
0047      */
0048     QString imei() const;
0049 
0050     /**
0051      * @return mobile registration status as defined in 3GPP TS 27.007 section 10.1.19
0052      */
0053     MMModem3gppRegistrationState registrationState() const;
0054 
0055     /**
0056      * @return code of the operator to which the mobile is currently registered.
0057      *
0058      * Returned in the format "MCCMNC", where MCC is the three-digit ITU E.212
0059      * Mobile Country Code and MNC is the two- or three-digit GSM Mobile Network
0060      * Code. e.g. e"31026" or "310260".
0061      *
0062      * If the MCC and MNC are not known or the mobile is not registered to a
0063      * mobile network, this property will be an empty string.
0064      */
0065     QString operatorCode() const;
0066 
0067     /**
0068      * @return name of the operator to which the mobile is currently registered.
0069      *
0070      * If the operator name is not known or the mobile is not registered to a
0071      * mobile network, this property will be an empty string.
0072      */
0073     QString operatorName() const;
0074 
0075     /**
0076      * @return country code of the operator to which the mobile is currently registered.
0077      *
0078      * Returned in the format "ISO 3166-1 alpha-2" according to the MMC mapping from Wikipedia.
0079      * Country Code is the two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard,
0080      * e.g. "RU" or "FI".
0081      *
0082      * If the MCC is not known or the mobile is not registered to a
0083      * mobile network, this property will be an empty string.
0084      */
0085     QString countryCode() const;
0086 
0087     /**
0088      * @return QFlags of MMModem3gppFacility values for which PIN locking is enabled
0089      */
0090     FacilityLocks enabledFacilityLocks() const;
0091 
0092 #if MM_CHECK_VERSION(1, 2, 0)
0093     /**
0094      * @return Value representing the subscription status of the account and whether there is any data remaining.
0095      */
0096     MMModem3gppSubscriptionState subscriptionState() const;
0097 #endif
0098     /**
0099      * Register the device to network.
0100      *
0101      * @param networkId The operator ID (ie, "MCCMNC", like "310260") to register. An empty string can be used to register to the home network.
0102      */
0103     void registerToNetwork(const QString &networkId = QString());
0104 
0105     /**
0106      * Scan for available networks.
0107      *
0108      * @return a QList<QVariantMap> with the results, where each map may contain these values:
0109      *
0110      * "status": A MMModem3gppNetworkAvailability value representing network
0111      * availability status, given as an unsigned integer (signature "u"). This
0112      * key will always be present.
0113      *
0114      * "operator-long": Long-format name of operator, given as a string value
0115      * (signature "s"). If the name is unknown, this field should not be present.
0116      *
0117      * "operator-short": Short-format name of operator, given as a string value
0118      * (signature "s"). If the name is unknown, this field should not be present.
0119      *
0120      * "operator-code": Mobile code of the operator, given as a string value
0121      * (signature "s"). Returned in the format "MCCMNC", where MCC is the
0122      * three-digit ITU E.212 Mobile Country Code and MNC is the two- or
0123      * three-digit GSM Mobile Network Code. e.g. "31026" or "310260".
0124      *
0125      * "access-technology": A MMModemAccessTechnology value representing the
0126      * generic access technology used by this mobile network, given as an
0127      * unsigned integer (signature "u").
0128      */
0129     QDBusPendingReply<QVariantMapList> scan();
0130 
0131     /**
0132      * Sets the timeout in milliseconds for all async method DBus calls.
0133      * -1 means the default DBus timeout (usually 25 seconds).
0134      */
0135     void setTimeout(int timeout);
0136 
0137     /**
0138      * Returns the current value of the DBus timeout in milliseconds.
0139      * -1 means the default DBus timeout (usually 25 seconds).
0140      */
0141     int timeout() const;
0142 
0143 Q_SIGNALS:
0144     void imeiChanged(const QString &imei);
0145     void registrationStateChanged(MMModem3gppRegistrationState registrationState);
0146     void operatorCodeChanged(const QString &operatorCode);
0147     void operatorNameChanged(const QString &operatorName);
0148     void countryCodeChanged(const QString &countryCode);
0149     void enabledFacilityLocksChanged(QFlags<MMModem3gppFacility> locks);
0150     void subscriptionStateChanged(MMModem3gppSubscriptionState subscriptionState);
0151 };
0152 
0153 Q_DECLARE_OPERATORS_FOR_FLAGS(Modem3gpp::FacilityLocks)
0154 
0155 } // namespace ModemManager
0156 
0157 #endif