QXmpp: QXmppCall.h Source File

QXmpp Version: 1.14.3

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;
19class QXmppCallManager;
20class QXmppCallManagerPrivate;
21class 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
33public:
35 enum Direction {
36 IncomingDirection,
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
QXmppCall
Definition QXmppCall.h:24
QXmppCall::ringing
Q_SIGNAL void ringing()
This signal is emitted when the remote party is ringing.
QXmppCall::jid
QString jid
The remote party's JID.
Definition QXmppCall.h:29
QXmppCall::Direction
Direction
This enum is used to describe the direction of a call.
Definition QXmppCall.h:35
QXmppCall::OutgoingDirection
@ OutgoingDirection
The call is outgoing.
Definition QXmppCall.h:37
QXmppCall::IncomingDirection
@ IncomingDirection
The call is incoming.
Definition QXmppCall.h:36
QXmppCall::streamCreated
Q_SIGNAL void streamCreated(QXmppCallStream *stream)
This signal is emitted when a stream is created.
QXmppCall::finished
Q_SIGNAL void finished()
This signal is emitted when a call is finished.
QXmppCall::sid
QString sid() const
Definition QXmppCall.cpp:771
QXmppCall::State
State
This enum is used to describe the state of a call.
Definition QXmppCall.h:42
QXmppCall::ActiveState
@ ActiveState
The call is active.
Definition QXmppCall.h:44
QXmppCall::DisconnectingState
@ DisconnectingState
The call is being disconnected.
Definition QXmppCall.h:45
QXmppCall::FinishedState
@ FinishedState
The call is finished.
Definition QXmppCall.h:46
QXmppCall::ConnectingState
@ ConnectingState
The call is being connected.
Definition QXmppCall.h:43
QXmppCall::direction
Direction direction
The call's direction.
Definition QXmppCall.h:27
QXmppCall::connected
Q_SIGNAL void connected()
This signal is emitted when a call is connected.
QXmppCall::stateChanged
Q_SIGNAL void stateChanged(QXmppCall::State state)
This signal is emitted when the call state changes.
QXmppCall::error
std::optional< QXmppError > error() const
Definition QXmppCall.cpp:791
QXmppCall::state
State state
The call's state.
Definition QXmppCall.h:31
QXmppCallManager
The QXmppCallManager class provides support for making and receiving voice calls.
Definition QXmppCallManager.h:25
QXmppCallStream
Definition QXmppCallStream.h:22
QXmppLoggable::QXmppLoggable
QXmppLoggable(QObject *parent=nullptr)
Definition QXmppLogger.cpp:57
QXmppError
Definition QXmppError.h:17