File indexing completed on 2024-04-21 03:59:50

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_MODEMCDMA_H
0011 #define MODEMMANAGERQT_MODEMCDMA_H
0012 
0013 #include <modemmanagerqt_export.h>
0014 
0015 #include <QDBusPendingReply>
0016 #include <QObject>
0017 #include <QSharedPointer>
0018 #include <QVariant>
0019 
0020 #include "generictypes.h"
0021 #include "interface.h"
0022 
0023 namespace ModemManager
0024 {
0025 class ModemCdmaPrivate;
0026 
0027 /**
0028  * @brief The ModemCdma class
0029  *
0030  * This class provides access to specific actions that may be performed in modems with CDMA capabilities.
0031  */
0032 class MODEMMANAGERQT_EXPORT ModemCdma : public Interface
0033 {
0034     Q_OBJECT
0035     Q_DECLARE_PRIVATE(ModemCdma)
0036 public:
0037     typedef QSharedPointer<ModemCdma> Ptr;
0038     typedef QList<Ptr> List;
0039 
0040     explicit ModemCdma(const QString &path, QObject *parent = nullptr);
0041     ~ModemCdma() override;
0042 
0043     /**
0044      * Provisions the modem for use with a given carrier using the modem's
0045      * Over-The-Air (OTA) activation functionality, if any.
0046      *
0047      * Some modems will reboot after this call is made.
0048      *
0049      * @param carrierCode name of carrier, or carrier-specific code
0050      */
0051     QDBusPendingReply<void> activate(const QString &carrierCode);
0052 
0053     /**
0054      * Sets the modem provisioning data directly, without contacting the carrier over the air.
0055      *
0056      * Some modems will reboot after this call is made.
0057      *
0058      * @param properties QVariantMap consisting of:
0059      *
0060      * "spc": The Service Programming Code, given as a string of exactly 6 digit characters. Mandatory parameter.
0061      * "sid": The System Identification Number, given as a 16-bit unsigned integer (signature "q"). Mandatory parameter.
0062      * "mdn": The Mobile Directory Number, given as a string of maximum 15 characters. Mandatory parameter.
0063      * "min": The Mobile Identification Number, given as a string of maximum 15 characters. Mandatory parameter.
0064      * "mn-ha-key": The MN-HA key, given as a string of maximum 16 characters.
0065      * "mn-aaa-key": The MN-AAA key, given as a string of maximum 16 characters.
0066      * "prl": The Preferred Roaming List, given as an array of maximum 16384 bytes.
0067      */
0068     QDBusPendingReply<void> activateManual(const QVariantMap &properties);
0069 
0070     /**
0071      * @return a MMModemCdmaActivationState value specifying the state of the activation in the 3GPP2 network.
0072      */
0073     MMModemCdmaActivationState activationState() const;
0074 
0075     /**
0076      * @return the modem's Mobile Equipment Identifier.
0077      */
0078     QString meid() const;
0079 
0080     /**
0081      * @return the modem's Electronic Serial Number (superseded by MEID but still used by older devices).
0082      */
0083     QString esn() const;
0084 
0085     /**
0086      * @return the System Identifier of the serving CDMA 1x network, if known, and if the modem is registered with a CDMA 1x network.
0087      * @see http://ifast.org or the mobile broadband provider database for mappings of SIDs to network providers.
0088      */
0089     uint sid() const;
0090 
0091     /**
0092      * @return the Network Identifier of the serving CDMA 1x network, if known, and if the modem is registered with a CDMA 1x network.
0093      */
0094     uint nid() const;
0095 
0096     /**
0097      * @return a MMModemCdmaRegistrationState value specifying the CDMA 1x registration state.
0098      */
0099     MMModemCdmaRegistrationState cdma1xRegistrationState() const;
0100 
0101     /**
0102      * @return a MMModemCdmaRegistrationState value specifying the EVDO registration state.
0103      */
0104     MMModemCdmaRegistrationState evdoRegistrationState() const;
0105 
0106     /**
0107      * Sets the timeout in milliseconds for all async method DBus calls.
0108      * -1 means the default DBus timeout (usually 25 seconds).
0109      */
0110     void setTimeout(int timeout);
0111 
0112     /**
0113      * Returns the current value of the DBus timeout in milliseconds.
0114      * -1 means the default DBus timeout (usually 25 seconds).
0115      */
0116     int timeout() const;
0117 
0118 Q_SIGNALS:
0119     /**
0120      * This signal is emitted when the activation info this network changes
0121      *
0122      * @param state current activation state, given as a MMModemCdmaActivationState.
0123      * @param error carrier-specific error code, given as a MMCdmaActivationError.
0124      * @param status_changes properties that have changed as a result of this activation state change, including "mdn" and "min".
0125      *                       The map may be empty if the changed properties are unknown.
0126      */
0127     void activationStateChanged(MMModemCdmaActivationState state, MMCdmaActivationError error, const QVariantMap &status_changes);
0128     void meidChanged(const QString &meid);
0129     void esnChanged(const QString &esn);
0130     void sidChanged(uint sid);
0131     void nidChanged(uint nid);
0132     void cdma1xRegistrationStateChanged(MMModemCdmaRegistrationState cdma1xRegistrationState);
0133     void evdoRegistrationStateChanged(MMModemCdmaRegistrationState evdoRegistrationState);
0134 };
0135 } // namespace ModemManager
0136 
0137 #endif