mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
[AFV] Ref T730, added graceful shutdown in AFV client itself
Also disconnect from network during "shutdown"
This commit is contained in:
@@ -220,6 +220,7 @@ namespace BlackCore
|
||||
m_startDateTimeUtc = QDateTime::currentDateTimeUtc();
|
||||
m_connection->setReceiveAudio(true);
|
||||
m_voiceServerPositionTimer->start(PositionUpdatesMs);
|
||||
|
||||
this->onSettingsChanged(); // make sure all settings are applied
|
||||
m_isStarted = true;
|
||||
CLogMessage(this).info(u"Started [Input: %1] [Output: %2]") << inputDevice.getName() << outputDevice.getName();
|
||||
@@ -672,6 +673,14 @@ namespace BlackCore
|
||||
return m_connection->updateVoiceServerUrl(url);
|
||||
}
|
||||
|
||||
void CAfvClient::gracefulShutdown()
|
||||
{
|
||||
this->stopAudio();
|
||||
this->disconnectFrom();
|
||||
this->quitAndWait();
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Needs to be back in current thread");
|
||||
}
|
||||
|
||||
void CAfvClient::initialize()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -221,6 +221,9 @@ namespace BlackCore
|
||||
//! Update the voice server URL
|
||||
bool updateVoiceServerUrl(const QString &url);
|
||||
|
||||
//! Gracefully shut down AFV client
|
||||
void gracefulShutdown();
|
||||
|
||||
signals:
|
||||
//! Receiving callsigns have been changed
|
||||
//! \remark callsigns I do receive
|
||||
|
||||
@@ -105,8 +105,7 @@ namespace BlackCore
|
||||
{
|
||||
if (m_voiceClient)
|
||||
{
|
||||
m_voiceClient->stopAudio();
|
||||
m_voiceClient->quitAndWait();
|
||||
m_voiceClient->gracefulShutdown();
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_voiceClient), Q_FUNC_INFO, "Needs to be back in current thread");
|
||||
m_voiceClient = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user