File indexing completed on 2025-02-02 14:20:53
0001 /* 0002 SPDX-FileCopyrightText: 2015 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 MODEMMANAGERQT_MODEM_SIMPLE_H 0008 #define MODEMMANAGERQT_MODEM_SIMPLE_H 0009 0010 #include <ModemManager/ModemManager.h> 0011 0012 #include <modemmanagerqt_export.h> 0013 0014 #include "generictypes.h" 0015 #include "interface.h" 0016 0017 namespace ModemManager 0018 { 0019 class ModemSimplePrivate; 0020 0021 /** 0022 * @brief The ModemSimple class 0023 * 0024 * The Simple interface allows controlling and querying the status of Modems. 0025 */ 0026 class MODEMMANAGERQT_EXPORT ModemSimple : public Interface 0027 { 0028 Q_OBJECT 0029 Q_DECLARE_PRIVATE(ModemSimple) 0030 0031 public: 0032 typedef QSharedPointer<ModemSimple> Ptr; 0033 typedef QList<Ptr> List; 0034 0035 explicit ModemSimple(const QString &path, QObject *parent = nullptr); 0036 ~ModemSimple() override; 0037 0038 QString uni() const; 0039 0040 /** 0041 * Do everything needed to connect the modem using the given properties. 0042 * 0043 * This method will attempt to find a matching packet data bearer and activate it if necessary, 0044 * returning the bearer's IP details. If no matching bearer is found, a new bearer will be created 0045 * and activated, but this operation may fail if no resources are available to complete this connection 0046 * attempt (ie, if a conflicting bearer is already active). 0047 * 0048 * This call may make a large number of changes to modem configuration based on properties passed in. For 0049 * example, given a PIN-locked, disabled GSM/UMTS modem, this call may unlock the SIM PIN, alter the access 0050 * technology preference, wait for network registration (or force registration to a specific provider), create 0051 * a new packet data bearer using the given "apn", and connect that bearer. 0052 * 0053 * Dictionary of properties needed to get the modem connected. 0054 * Each implementation is free to add its own specific key-value pairs. The predefined 0055 * common ones are: 0056 * 0057 * @param pin SIM-PIN unlock code, given as a string value (signature "s"). 0058 * @param operator-id ETSI MCC-MNC of a network to force registration with, given as a string value (signature "s"). 0059 * @param apn For GSM/UMTS and LTE devices the APN to use, given as a string value (signature "s"). 0060 * @param ip-type For GSM/UMTS and LTE devices the IP addressing type to use, given as a MMBearerIpFamily value (signature "u"). 0061 * @param allowed-auth The authentication method to use, given as a MMBearerAllowedAuth value (signature "u"). Optional in 3GPP. 0062 * @param user User name (if any) required by the network, given as a string value (signature "s"). Optional in 3GPP. 0063 * @param password Password (if any) required by the network, given as a string value (signature "s"). Optional in 3GPP. 0064 * @param number For POTS devices the number to dial,, given as a string value (signature "s"). 0065 * @param allow-roaming FALSE to allow only connections to home networks, given as a boolean value (signature "b"). 0066 * @param rm-protocol For CDMA devices, the protocol of the Rm interface, given as a MMModemCdmaRmProtocol value (signature "u"). 0067 * 0068 * @return On successful connect, returns the object path of the connected packet data bearer used for the connection attempt. 0069 */ 0070 QDBusPendingReply<QDBusObjectPath> connectModem(const QVariantMap &properties); 0071 0072 /** 0073 * Dictionary of properties. 0074 * Each implementation is free to add it's own specific key-value pairs. The predefined 0075 * common ones are: 0076 * 0077 * @param state A MMModemState value specifying the overall state of the modem, given as an unsigned integer value (signature "u"). 0078 * @param signal-quality Signal quality value, given only when registered, as an unsigned integer value (signature "u"). 0079 * @param current-bands List of MMModemBand values, given only when registered, as a list of unsigned integer values (signature "au"). 0080 * @param access-technology A MMModemAccessTechnology value, given only when registered, as an unsigned integer value (signature "u"). 0081 * @param m3gpp-registration-state A MMModem3gppRegistrationState value specifying the state of the registration, 0082 * given only when registered in a 3GPP network, as an unsigned integer value (signature "u"). 0083 * @param m3gpp-operator-code Operator MCC-MNC, given only when registered in a 3GPP network, as a string value (signature "s"). 0084 * @param m3gpp-operator-name Operator name, given only when registered in a 3GPP network, as a string value (signature "s"). 0085 * @param cdma-cdma1x-registration-state A MMModemCdmaRegistrationState value specifying the state of the registration, 0086 * given only when registered in a CDMA1x network, as an unsigned integer value (signature "u"). 0087 * @param cdma-evdo-registration-state A MMModemCdmaRegistrationState value specifying the state of the registration, 0088 * given only when registered in a EV-DO network, as an unsigned integer value (signature "u"). 0089 * @param cdma-sid The System Identifier of the serving network, if registered in a CDMA1x network and if known. 0090 * Given as an unsigned integer value (signature "u"). 0091 * @param cdma-nid The Network Identifier of the serving network, if registered in a CDMA1x network and if known. 0092 * Given as an unsigned integer value (signature "u"). 0093 */ 0094 QDBusPendingReply<QVariantMap> getStatus(); 0095 0096 /** 0097 * Disconnect an active packet data connection. 0098 */ 0099 QDBusPendingReply<void> disconnectModem(const QString &bearer); 0100 0101 /** 0102 * Convenient method calling disconnectModem with "/" to make ModemManager disconnect all modems 0103 */ 0104 QDBusPendingReply<void> disconnectAllModems(); 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 0119 } // namespace ModemManager 0120 0121 #endif