From 2feab9f5e7bb1c4a35de34b6eb45142c34a49670 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 5 Feb 2014 23:12:26 +0000 Subject: [PATCH] Bugfix to set aircraft callsign from voice context, fixes #120 In the same step added methods to test squelch and microphone, refs #123 --- samples/voiceclient/client.cpp | 2 +- src/blackcore/context_voice.cpp | 29 +++++++++++++++++++++++ src/blackcore/context_voice.h | 19 +++++++++++++-- src/blackcore/context_voice_interface.cpp | 24 +++++++++++++++++++ src/blackcore/context_voice_interface.h | 21 ++++++++++++++-- src/blackcore/voice.h | 2 +- src/blackcore/voice_vatlib.cpp | 2 +- 7 files changed, 92 insertions(+), 7 deletions(-) diff --git a/samples/voiceclient/client.cpp b/samples/voiceclient/client.cpp index 7b3ae9dc6..6ab7e629c 100644 --- a/samples/voiceclient/client.cpp +++ b/samples/voiceclient/client.cpp @@ -105,7 +105,7 @@ void Client::micTestCmd(QTextStream & /** args **/) { std::cout << "Running mic test. Speak normally for 5 seconds..." << std::endl; printLinePrefix(); - m_voiceClient->runMicTest(); + m_voiceClient->runMicrophoneTest(); } void Client::setCallsignCmd(QTextStream &args) diff --git a/src/blackcore/context_voice.cpp b/src/blackcore/context_voice.cpp index 99d197957..cb6716dc7 100644 --- a/src/blackcore/context_voice.cpp +++ b/src/blackcore/context_voice.cpp @@ -34,6 +34,15 @@ namespace BlackCore this->leaveAllVoiceRooms(); } + /* + * Own aircraft + */ + void CContextVoice::setOwnAircraft(const CAircraft &ownAircraft) + { + Q_ASSERT(this->m_voice); + this->m_voice->setMyAircraftCallsign(ownAircraft.getCallsign()); + } + /* * Voice rooms for COM */ @@ -216,4 +225,24 @@ namespace BlackCore CAudioDevice outputDevice = m_voice->getCurrentOutputDevice(); BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice); } + + /* + * Mic test. + */ + void CContextVoice::runMicrophoneTest() const + { + Q_ASSERT(this->m_voice); + this->m_voice->runMicrophoneTest(); + } + + /* + * Squelch test. + */ + void CContextVoice::runSquelchTest() const + { + Q_ASSERT(this->m_voice); + this->m_voice->runSquelchTest(); + } + + } // namespace diff --git a/src/blackcore/context_voice.h b/src/blackcore/context_voice.h index 209aeb833..d8a16048b 100644 --- a/src/blackcore/context_voice.h +++ b/src/blackcore/context_voice.h @@ -71,6 +71,11 @@ namespace BlackCore virtual bool usingLocalObjects() const { return true; } public slots: + /*! + * \copydoc IContextVoice::setOwnAircraft + */ + virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft); + /*! * \copydoc IContextVoice::getComVoiceRooms() */ @@ -147,11 +152,21 @@ namespace BlackCore virtual bool isMuted() const; /*! - * \brief Play selcal tone - * \param selcal + * \copydoc IContextVoice::playSelcalTone() */ virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const; + /*! + * \copydoc IContextVoice::runMicrophoneTest() + */ + virtual void runMicrophoneTest() const; + + /*! + * \copydoc IContextVoice::runSquelchTest() + */ + virtual void runSquelchTest() const; + + private: CVoiceVatlib *m_voice; //!< underlying voice lib }; diff --git a/src/blackcore/context_voice_interface.cpp b/src/blackcore/context_voice_interface.cpp index 2df62c853..beed1ef55 100644 --- a/src/blackcore/context_voice_interface.cpp +++ b/src/blackcore/context_voice_interface.cpp @@ -31,6 +31,14 @@ namespace BlackCore // void } + /* + * Own aircraft + */ + void IContextVoice::setOwnAircraft(const CAircraft &ownAircraft) + { + this->m_dBusInterface->callDBus(QLatin1Literal("setOwnAircraft"), ownAircraft); + } + /* * Leave all voice rooms */ @@ -143,6 +151,22 @@ namespace BlackCore this->m_dBusInterface->callDBus(QLatin1Literal("playSelcalTone"), selcal); } + /* + * MIC test + */ + void IContextVoice::runMicrophoneTest() const + { + this->m_dBusInterface->callDBus(QLatin1Literal("runMicrophoneTest")); + } + + /* + * MIC test + */ + void IContextVoice::runSquelchTest() const + { + this->m_dBusInterface->callDBus(QLatin1Literal("runSquelchTest")); + } + /* * Volumes, by COM systems */ diff --git a/src/blackcore/context_voice_interface.h b/src/blackcore/context_voice_interface.h index 9bd64b8ab..808895143 100644 --- a/src/blackcore/context_voice_interface.h +++ b/src/blackcore/context_voice_interface.h @@ -10,8 +10,7 @@ #include "blackmisc/vaudiodevicelist.h" #include "blackmisc/vvoiceroomlist.h" #include "blackmisc/nwuserlist.h" -#include "blackmisc/aviocomsystem.h" -#include "blackmisc/avcallsignlist.h" +#include "blackmisc/avaircraft.h" #include "blackcore/voice_vatlib.h" #include #include @@ -102,6 +101,13 @@ namespace BlackCore public slots: + /*! + * Set my own identity for the voice rooms. + * \remarks Actually at this time the callsign alone was sufficient. But I pass the + * whole aircraft object so further information are present if needed any time later. + */ + virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAiricraft); + /*! * Get voice rooms for COM1, COM2: * From this connection audio status can be obtained @@ -191,6 +197,17 @@ namespace BlackCore * \brief Play SELCAL tone */ virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const; + + /*! + * \brief Microphone test + */ + virtual void runMicrophoneTest() const; + + /*! + * \brief Microphone test + */ + virtual void runSquelchTest() const; + }; } diff --git a/src/blackcore/voice.h b/src/blackcore/voice.h index 30e684387..d16466da5 100644 --- a/src/blackcore/voice.h +++ b/src/blackcore/voice.h @@ -95,7 +95,7 @@ namespace BlackCore /*! * \brief Runs a 5 seconds test, measuring the qualitiy of your mic input */ - virtual void runMicTest() = 0; + virtual void runMicrophoneTest() = 0; /*! * \brief Value of the measured squelch diff --git a/src/blackcore/voice_vatlib.cpp b/src/blackcore/voice_vatlib.cpp index 125fb7e7a..a55e2347f 100644 --- a/src/blackcore/voice_vatlib.cpp +++ b/src/blackcore/voice_vatlib.cpp @@ -244,7 +244,7 @@ namespace BlackCore /* * Start microphone test */ - void CVoiceVatlib::runMicTest() + void CVoiceVatlib::runMicrophoneTest() { Q_ASSERT_X(m_voice->IsValid() && m_voice->IsSetup(), "CVoiceClientVatlib", "Cvatlib_Voice_Simple invalid or not setup!");