[AFV] Signal/handling for authentication failures

* authentication issues in AFV were silently handled
* and there was no re-try, which could mean an initial glitch COULD cause AFV not working properly
* NOW handling in AFV client and context
* also reset connection data so for a new session no old authentication token or check time is used
* check for "invalid" QDateTime(s)
This commit is contained in:
Klaus Basan
2020-04-27 19:04:01 +02:00
committed by Mat Sutcliffe
parent 9e6716e515
commit bba07ef4c4
13 changed files with 146 additions and 34 deletions

View File

@@ -208,6 +208,7 @@ namespace BlackCore
connect(m_voiceClient, &CAfvClient::stoppedAudio, this, &CContextAudioBase::stoppedAudio, Qt::QueuedConnection);
connect(m_voiceClient, &CAfvClient::ptt, this, &CContextAudioBase::ptt, Qt::QueuedConnection);
connect(m_voiceClient, &CAfvClient::connectionStatusChanged, this, &CContextAudioBase::onAfvConnectionStatusChanged, Qt::QueuedConnection);
connect(m_voiceClient, &CAfvClient::afvConnectionFailure, this, &CContextAudioBase::onAfvConnectionFailure, Qt::QueuedConnection);
}
void CContextAudioBase::terminateVoiceClient()
@@ -640,6 +641,12 @@ namespace BlackCore
}
}
void CContextAudioBase::onAfvConnectionFailure(const CStatusMessage &msg)
{
if (!m_voiceClient) { return; }
emit this->voiceClientFailure(msg);
}
bool CContextAudioBase::isRunningWithLocalCore()
{
return sApp && sApp->isLocalContext();

View File

@@ -83,8 +83,10 @@ namespace BlackCore
//! Factory method
static IContextAudio *create(CCoreFacade *runtime, CCoreFacadeConfig::ContextMode mode, BlackMisc::CDBusServer *server, QDBusConnection &connection);
// ------------- only use DBus signals here -------------
signals:
// only use DBus signals here
//! Authentication failed, ....
void voiceClientFailure(const BlackMisc::CStatusMessage &msg);
public slots:
// ------------- DBus ---------------
@@ -285,7 +287,9 @@ namespace BlackCore
//! PTT in voice client received
void ptt(bool active, BlackMisc::Audio::PTTCOM pttcom, const BlackMisc::CIdentifier &identifier);
/** Workaround those must be invisible for DBus
/*
* Workaround those must be invisible for DBus
*
//! VU levels @{
void inputVolumePeakVU (double value);
@@ -298,7 +302,7 @@ namespace BlackCore
//! Client updated from own aicraft data
void updatedFromOwnAircraftCockpit();
** Workaround **/
* end workaround */
// ------------ local signals -------
@@ -338,6 +342,9 @@ namespace BlackCore
//! AFV client connection status changed
void onAfvConnectionStatusChanged(int status);
//! AFV client authentication failed
void onAfvConnectionFailure(const BlackMisc::CStatusMessage &msg);
CActionBind m_actionPtt { BlackMisc::Input::pttHotkeyAction(), BlackMisc::Input::pttHotkeyIcon(), this, &CContextAudioBase::setVoiceTransmissionComActive };
CActionBind m_actionPttCom1 { BlackMisc::Input::pttCom1HotkeyAction(), BlackMisc::Input::pttHotkeyIcon(), this, &CContextAudioBase::setVoiceTransmissionCom1 };
CActionBind m_actionPttCom2 { BlackMisc::Input::pttCom2HotkeyAction(), BlackMisc::Input::pttHotkeyIcon(), this, &CContextAudioBase::setVoiceTransmissionCom2 };

View File

@@ -83,8 +83,12 @@ namespace BlackCore
void CContextAudioProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
{
/**
bool s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
"voiceClientFailure", this, SIGNAL(voiceClientFailure(BlackMisc::CStatusMessage)));
Q_ASSERT(s);
/**
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
"changedAudioVolume", this, SIGNAL(changedAudioVolume(int)));
Q_ASSERT(s);
s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),