QXmpp  Version: 1.15.1
QXmppCall.h
1 // SPDX-FileCopyrightText: 2019 Jeremy LainĂ© <jeremy.laine@m4x.org>
2 // SPDX-FileCopyrightText: 2019 Niels Ole Salscheider <ole@salscheider.org>
3 // SPDX-FileCopyrightText: 2025 Linus Jahn <lnj@kaidan.im>
4 //
5 // SPDX-License-Identifier: LGPL-2.1-or-later
6 
7 #ifndef QXMPPCALL_H
8 #define QXMPPCALL_H
9 
10 #include "QXmppCallStream.h"
11 #include "QXmppClientExtension.h"
12 #include "QXmppLogger.h"
13 
14 #include <QMetaType>
15 #include <QObject>
16 
17 class QHostAddress;
18 class QXmppCallPrivate;
19 class QXmppCallManager;
20 class QXmppCallManagerPrivate;
21 class QXmppError;
22 
23 class QXMPP_EXPORT QXmppCall : public QXmppLoggable
24 {
25  Q_OBJECT
27  Q_PROPERTY(Direction direction READ direction CONSTANT)
29  Q_PROPERTY(QString jid READ jid CONSTANT)
31  Q_PROPERTY(State state READ state NOTIFY stateChanged)
32 
33 public:
35  enum Direction {
37  OutgoingDirection
38  };
39  Q_ENUM(Direction)
40 
41 
42  enum State {
43  ConnectingState = 0,
44  ActiveState = 1,
45  DisconnectingState = 2,
46  FinishedState = 3
47  };
48  Q_ENUM(State)
49 
50  ~QXmppCall();
51 
52  QXmppCall::Direction direction() const;
53  QString jid() const;
54  QString sid() const;
55  QXmppCall::State state() const;
56  std::optional<QXmppError> error() const;
57 
58  GstElement *pipeline() const;
59  QXmppCallStream *audioStream() const;
60  QXmppCallStream *videoStream() const;
61 
62  bool isEncrypted() const;
63  bool videoSupported() const;
64 
65  void accept();
66  void decline();
67  void hangUp();
68  void addVideo();
69 
71  Q_SIGNAL void connected();
72 
74  Q_SIGNAL void finished();
75 
77  Q_SIGNAL void ringing();
78 
80  Q_SIGNAL void stateChanged(QXmppCall::State state);
81 
83  Q_SIGNAL void streamCreated(QXmppCallStream *stream);
84 
85 private:
86  void onLocalCandidatesChanged(QXmppCallStream *stream);
87  void terminated();
88 
89  QXmppCall(const QString &jid, const QString &sid, Direction direction, QXmppCallManager *manager);
90  QXmppCall(const QString &jid, const QString &sid, Direction direction, State state, QXmppError &&error, QXmppCallManager *manager);
91 
92  const std::unique_ptr<QXmppCallPrivate> d;
93  friend class QXmppCallManager;
94  friend class QXmppCallManagerPrivate;
95  friend class QXmppCallPrivate;
96 };
97 
98 Q_DECLARE_METATYPE(QXmppCall::State)
99 
100 #endif
Definition: QXmppError.h:17
The QXmppLoggable class represents a source of logging messages.
Definition: QXmppLogger.h:108
Direction
This enum is used to describe the direction of a call.
Definition: QXmppCall.h:35
The call is incoming.
Definition: QXmppCall.h:36
Definition: QXmppCall.h:23
Definition: QXmppCallStream.h:21
State
This enum is used to describe the state of a call.
Definition: QXmppCall.h:42
The QXmppCallManager class provides support for making and receiving voice calls. ...
Definition: QXmppCallManager.h:24