mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-24 09:54:16 +08:00
[AFV] Ref T739, audio can now be disabled from UI
This commit is contained in:
committed by
Mat Sutcliffe
parent
c8097cc899
commit
9447db00bc
@@ -186,13 +186,13 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CAfvClient::disconnectFrom()
|
||||
void CAfvClient::disconnectFrom(bool stop)
|
||||
{
|
||||
if (QThread::currentThread() != thread())
|
||||
{
|
||||
// Method needs to be executed in the object thread since it will create new QObject children
|
||||
QPointer<CAfvClient> myself(this);
|
||||
QMetaObject::invokeMethod(this, [ = ]() { if (myself) disconnectFrom(); });
|
||||
QMetaObject::invokeMethod(this, [ = ]() { if (myself) disconnectFrom(stop); });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -203,6 +203,8 @@ namespace BlackCore
|
||||
m_connection->disconnectFrom();
|
||||
}
|
||||
emit connectionStatusChanged(Disconnected);
|
||||
|
||||
if (stop) { this->stopAudio(); }
|
||||
}
|
||||
|
||||
QStringList CAfvClient::availableInputDevices() const
|
||||
|
||||
@@ -94,7 +94,11 @@ namespace BlackCore
|
||||
//! Disconnect from network
|
||||
//! \threadsafe
|
||||
//! \remark runs in thread of CAfvClient object and is ASYNC when called from another thread
|
||||
Q_INVOKABLE void disconnectFrom();
|
||||
//! @{
|
||||
void disconnectFrom(bool stop);
|
||||
Q_INVOKABLE void disconnectFrom() { this->disconnectFrom(false); }
|
||||
void disconnectFromAndStop() { this->disconnectFrom(true); }
|
||||
//! @}
|
||||
|
||||
//! Audio devices @{
|
||||
Q_INVOKABLE QStringList availableInputDevices() const;
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace BlackCore
|
||||
{
|
||||
CLogMessage(this).debug(u"ClientConnection instantiated");
|
||||
|
||||
// connect(&m_apiServerConnection, &ApiServerConnection::authenticationFinished, this, &ClientConnection::apiConnectionFinished);
|
||||
// connect(&m_apiServerConnection, &ApiServerConnection::addCallsignFinished, this, &ClientConnection::addCallsignFinished);
|
||||
// connect(&m_apiServerConnection, &ApiServerConnection::removeCallsignFinished, this, &ClientConnection::removeCallsignFinished);
|
||||
// connect(&m_apiServerConnection, &ApiServerConnection::authenticationFinished, this, &ClientConnection::apiConnectionFinished);
|
||||
// connect(&m_apiServerConnection, &ApiServerConnection::addCallsignFinished, this, &ClientConnection::addCallsignFinished);
|
||||
// connect(&m_apiServerConnection, &ApiServerConnection::removeCallsignFinished, this, &ClientConnection::removeCallsignFinished);
|
||||
|
||||
connect(m_voiceServerTimer, &QTimer::timeout, this, &CClientConnection::voiceServerHeartbeat);
|
||||
connect(m_udpSocket, &QUdpSocket::readyRead, this, &CClientConnection::readPendingDatagrams);
|
||||
@@ -69,7 +69,7 @@ namespace BlackCore
|
||||
this->connectToVoiceServer();
|
||||
// taskServerConnectionCheck.Start();
|
||||
|
||||
CLogMessage(this).debug(u"Connected: '%1'") << callsign;
|
||||
CLogMessage(this).info(u"Connected: '%1' to voice server, socket open: ") << callsign << boolToYesNo(m_udpSocket->isOpen());
|
||||
}
|
||||
|
||||
// callback of the calling parent
|
||||
@@ -121,11 +121,11 @@ namespace BlackCore
|
||||
|
||||
void CClientConnection::connectToVoiceServer()
|
||||
{
|
||||
QHostAddress localAddress(QHostAddress::AnyIPv4);
|
||||
const QHostAddress localAddress(QHostAddress::AnyIPv4);
|
||||
m_udpSocket->bind(localAddress);
|
||||
m_voiceServerTimer->start(3000);
|
||||
|
||||
CLogMessage(this).info(u"Connected to voice server '%1'") << m_connection.getTokens().VoiceServer.addressIpV4;
|
||||
CLogMessage(this).info(u"Connected to voice server '%2'") << m_connection.getTokens().VoiceServer.addressIpV4;
|
||||
}
|
||||
|
||||
void CClientConnection::disconnectFromVoiceServer()
|
||||
|
||||
Reference in New Issue
Block a user