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

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