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

0001 /*
0002     SPDX-FileCopyrightText: 2018 Aleksander Morgado <aleksander@aleksander.es>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef MODEMMANAGERQT_MODEMVOICE_H
0008 #define MODEMMANAGERQT_MODEMVOICE_H
0009 
0010 #include <modemmanagerqt_export.h>
0011 
0012 #include <QObject>
0013 #include <QSharedPointer>
0014 
0015 #include "call.h"
0016 #include "generictypes.h"
0017 #include "interface.h"
0018 
0019 namespace ModemManager
0020 {
0021 class ModemVoicePrivate;
0022 
0023 /**
0024  * @brief The ModemVoice class
0025  *
0026  * The Voice interface handles call related actions
0027  */
0028 class MODEMMANAGERQT_EXPORT ModemVoice : public Interface
0029 {
0030     Q_OBJECT
0031     Q_DECLARE_PRIVATE(ModemVoice)
0032 
0033 public:
0034     typedef QSharedPointer<ModemVoice> Ptr;
0035     typedef QList<Ptr> List;
0036 
0037     explicit ModemVoice(const QString &path, QObject *parent = nullptr);
0038     ~ModemVoice() override;
0039 
0040     /**
0041      * Retrieve all calls.
0042      *
0043      * This method should only be used once and subsequent information retrieved
0044      * either by listening for the callAdded() signal, or by
0045      * querying the specific call object of interest using findCall()
0046      */
0047     ModemManager::Call::List calls() const;
0048 
0049     /**
0050      * Creates a new call object.
0051      * @param number Number property
0052      */
0053     QDBusPendingReply<QDBusObjectPath> createCall(const QString &number);
0054 
0055     /**
0056      * Creates a new call object.
0057      * @param call QVariantMap containing call properties
0058      * The 'number' property is mandatory.
0059      */
0060     QDBusPendingReply<QDBusObjectPath> createCall(const QVariantMap &call);
0061 
0062     /**
0063      * Delete a call.
0064      *
0065      * @param uni path to the Call object
0066      */
0067     QDBusPendingReply<void> deleteCall(const QString &uni);
0068 
0069     /**
0070      * @param uni path to the Call object
0071      * @return pointer to the found Call (may be null if not found)
0072      */
0073     ModemManager::Call::Ptr findCall(const QString &uni);
0074 
0075     /**
0076      * Sets the timeout in milliseconds for all async method DBus calls.
0077      * -1 means the default DBus timeout (usually 25 seconds).
0078      */
0079     void setTimeout(int timeout);
0080 
0081     /**
0082      * Returns the current value of the DBus timeout in milliseconds.
0083      * -1 means the default DBus timeout (usually 25 seconds).
0084      */
0085     int timeout() const;
0086 
0087 Q_SIGNALS:
0088     /**
0089      * Emitted when an new Call is detected.
0090      *
0091      * @param uni path to the Call object
0092      */
0093     void callAdded(const QString &uni);
0094 
0095     /**
0096      * Emitted when a call has been deleted.
0097      * @param uni path to the Call object
0098      */
0099     void callDeleted(const QString &uni);
0100 };
0101 
0102 } // namespace ModemManager
0103 
0104 #endif