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

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_CALL_H
0008 #define MODEMMANAGERQT_CALL_H
0009 
0010 #include <modemmanagerqt_export.h>
0011 
0012 #include <QDBusPendingReply>
0013 #include <QObject>
0014 #include <QSharedPointer>
0015 
0016 #include "generictypes.h"
0017 
0018 namespace ModemManager
0019 {
0020 class CallPrivate;
0021 
0022 /**
0023  * Provides an interface to manipulate and control a call
0024  *
0025  * Note: MMCallState, MMCallStateReason and MMCallDirection enums are defined in <ModemManager/ModemManager-enums.h>
0026  * See http://www.freedesktop.org/software/ModemManager/api/latest/ModemManager-Flags-and-Enumerations.html
0027  */
0028 class MODEMMANAGERQT_EXPORT Call : public QObject
0029 {
0030     Q_OBJECT
0031     Q_DECLARE_PRIVATE(Call)
0032 
0033 public:
0034     typedef QSharedPointer<Call> Ptr;
0035     typedef QList<Ptr> List;
0036 
0037     explicit Call(const QString &path, QObject *parent = nullptr);
0038     ~Call() override;
0039 
0040     QString uni() const;
0041 
0042     /**
0043      * Start a call
0044      */
0045     QDBusPendingReply<> start();
0046 
0047     /**
0048      * Accept a call
0049      */
0050     QDBusPendingReply<> accept();
0051 
0052     /**
0053      * Hangup a call
0054      */
0055     QDBusPendingReply<> hangup();
0056 
0057     /**
0058      * Send DTMF
0059      */
0060     QDBusPendingReply<> sendDtmf(const QString &dtmf);
0061 
0062     /**
0063      * This method returns the state of the call
0064      */
0065     MMCallState state() const;
0066 
0067     /**
0068      * This method returns the reason for the call state change
0069      */
0070     MMCallStateReason stateReason() const;
0071 
0072     /**
0073      * This method returns the direction of the call
0074      */
0075     MMCallDirection direction() const;
0076 
0077     /**
0078      * This method returns the remote phone number
0079      */
0080     QString number() const;
0081 
0082     /**
0083      * Sets the timeout in milliseconds for all async method DBus calls.
0084      * -1 means the default DBus timeout (usually 25 seconds).
0085      */
0086     void setTimeout(int timeout);
0087 
0088     /**
0089      * Returns the current value of the DBus timeout in milliseconds.
0090      * -1 means the default DBus timeout (usually 25 seconds).
0091      */
0092     int timeout() const;
0093 
0094 Q_SIGNALS:
0095     void stateChanged(MMCallState oldState, MMCallState newState, MMCallStateReason reason);
0096     void numberChanged(const QString &number);
0097     void dtmfReceived(const QString &dtmf);
0098 
0099 private:
0100     CallPrivate *const d_ptr;
0101 };
0102 
0103 } // namespace ModemManager
0104 
0105 #endif