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