swift
Loading...
Searching...
No Matches
clientconnectiondata.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_CORE_AFV_CONNECTION_CLIENTCONNECTIONDATA_H
7#define SWIFT_CORE_AFV_CONNECTION_CLIENTCONNECTIONDATA_H
8
9#include <QDateTime>
10#include <QScopedPointer>
11#include <QString>
12#include <QtGlobal>
13
16#include "core/afv/dto.h"
17
18namespace swift::core::afv::connection
19{
22 {
23 public:
25 static const QStringList &getLogCategories();
26
29
31 qint64 secondsSinceAuthentication() const;
32
35 bool isVoiceServerAlive() const;
36 bool isDataServerAlive() const;
38
41 bool isConnected() const { return m_connected; }
42 void setConnected(bool connected) { m_connected = connected; }
44
47 bool isReceivingAudio() const { return m_receiveAudio; }
48 void setReceiveAudio(bool receive) { m_receiveAudio = receive; }
50
53
56 const PostCallsignResponseDto &getTokens() const { return m_tokens; }
57 void setTokens(const PostCallsignResponseDto &dto) { m_tokens = dto; }
59
62 const QString &getCallsign() const { return m_callsign; }
63 void setCallsign(const QString &callsign) { m_callsign = callsign; }
65
68 const QString &getUserName() const { return m_userName; }
69 void setUserName(const QString &un) { m_userName = un; }
71
77
79 void reset();
80
81 /* TODO
82 public long VoiceServerBytesSent { get; set; }
83 public long VoiceServerBytesReceived { get; set; }
84 public long DataServerBytesSent { get; set; }
85 public long DataServerBytesReceived { get; set; }
86 */
87
89
90 private:
92 qint64 timeSinceAuthenticationSecs() const
93 {
94 return m_authenticatedDateTimeUtc.secsTo(QDateTime::currentDateTimeUtc());
95 }
96
98 bool voiceServerAlive() const;
99
100 QString m_userName;
101 QString m_callsign;
102
103 PostCallsignResponseDto m_tokens;
104
105 QDateTime m_authenticatedDateTimeUtc;
106 QDateTime m_lastVoiceServerHeartbeatAckUtc;
107 QDateTime m_lastDataServerHeartbeatAckUtc;
108
109 bool m_receiveAudio = true;
110 bool m_connected = false;
111
112 static constexpr qint64 ServerTimeoutSecs = 10;
113 };
114} // namespace swift::core::afv::connection
115
116#endif // SWIFT_CORE_AFV_CONNECTION_CLIENTCONNECTIONDATA_H
const PostCallsignResponseDto & getTokens() const
Tokens.
void createCryptoChannels()
Crypto channels for voice and data.
void setCallsign(const QString &callsign)
Callsign.
void setTokens(const PostCallsignResponseDto &dto)
Tokens.
static const QStringList & getLogCategories()
Categories.
qint64 secondsSinceAuthentication() const
Time since authentication.
QScopedPointer< crypto::CCryptoDtoChannel > m_voiceCryptoChannel
used crypto channel
QDateTime currentDateTimeUtc()
Callsign DTO.
Definition dto.h:87