File indexing completed on 2024-04-14 03:57:23

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