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_MODEM3GPPUSSD_H 0011 #define MODEMMANAGERQT_MODEM3GPPUSSD_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 Modem3gppUssdPrivate; 0025 0026 /** 0027 * @brief The Modem3gppUssd class 0028 * 0029 * This class provides access to actions based on the USSD protocol. 0030 */ 0031 class MODEMMANAGERQT_EXPORT Modem3gppUssd : public Interface 0032 { 0033 Q_OBJECT 0034 Q_DECLARE_PRIVATE(Modem3gppUssd) 0035 0036 public: 0037 typedef QSharedPointer<Modem3gppUssd> Ptr; 0038 typedef QList<Ptr> List; 0039 0040 explicit Modem3gppUssd(const QString &path, QObject *parent = nullptr); 0041 ~Modem3gppUssd() override; 0042 0043 /** 0044 * Sends a USSD @p command string to the network initiating a USSD session. 0045 * 0046 * When the request is handled by the network, the method returns the 0047 * response or an appropriate error. The network may be awaiting further 0048 * response from the ME after returning from this method and no new command 0049 * can be initiated until this one is cancelled or ended. 0050 */ 0051 QDBusPendingReply<QString> initiate(const QString &command); 0052 0053 /** 0054 * Respond to a USSD request that is either initiated by the mobile network, 0055 * or that is awaiting further input after initiate() was called. 0056 */ 0057 QDBusPendingReply<QString> respond(const QString &response); 0058 0059 /** 0060 * Cancel an ongoing USSD session, either mobile or network initiated. 0061 */ 0062 void cancel(); 0063 0064 /** 0065 * @return the state of any ongoing USSD session 0066 */ 0067 MMModem3gppUssdSessionState state() const; 0068 0069 /** 0070 * @return any network-initiated request to which no USSD response is required 0071 * 0072 * When no USSD session is active, or when there is no network- initiated request, this property will be an empty string. 0073 */ 0074 QString networkNotification() const; 0075 0076 /** 0077 * @return any pending network-initiated request for a response. Client 0078 * should call respond() with the appropriate response to this request. 0079 * 0080 * When no USSD session is active, or when there is no pending 0081 * network-initiated request, this property will be an empty string. 0082 */ 0083 QString networkRequest() const; 0084 0085 /** 0086 * Sets the timeout in milliseconds for all async method DBus calls. 0087 * -1 means the default DBus timeout (usually 25 seconds). 0088 */ 0089 void setTimeout(int timeout); 0090 0091 /** 0092 * Returns the current value of the DBus timeout in milliseconds. 0093 * -1 means the default DBus timeout (usually 25 seconds). 0094 */ 0095 int timeout() const; 0096 0097 Q_SIGNALS: 0098 void stateChanged(MMModem3gppUssdSessionState state); 0099 void networkNotificationChanged(const QString &networkNotification); 0100 void networkRequestChanged(const QString &networkRequest); 0101 }; 0102 0103 } // namespace ModemManager 0104 0105 #endif