QXmpp Version: 1.15.1
Loading...
Searching...
No Matches
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
17class QHostAddress;
18class QXmppCallPrivate;
20class QXmppCallManagerPrivate;
21class QXmppError;
22
23class 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
33public:
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
85private:
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
98Q_DECLARE_METATYPE(QXmppCall::State)
99
100#endif
The QXmppCallManager class provides support for making and receiving voice calls.
Definition QXmppCallManager.h:25
Definition QXmppCallStream.h:22
Definition QXmppCall.h:24
Q_SIGNAL void ringing()
This signal is emitted when the remote party is ringing.
Direction
This enum is used to describe the direction of a call.
Definition QXmppCall.h:35
@ IncomingDirection
The call is incoming.
Definition QXmppCall.h:36
Q_SIGNAL void streamCreated(QXmppCallStream *stream)
This signal is emitted when a stream is created.
Q_SIGNAL void finished()
This signal is emitted when a call is finished.
State
This enum is used to describe the state of a call.
Definition QXmppCall.h:42
Q_SIGNAL void connected()
This signal is emitted when a call is connected.
Q_SIGNAL void stateChanged(QXmppCall::State state)
This signal is emitted when the call state changes.
The QXmppLoggable class represents a source of logging messages.
Definition QXmppLogger.h:109
Definition QXmppError.h:17