Bugfix to set aircraft callsign from voice context, fixes #120

In the same step added methods to test squelch and microphone, refs #123
This commit is contained in:
Klaus Basan
2014-02-05 23:12:26 +00:00
committed by Mathew Sutcliffe
parent 7a63768c83
commit 2feab9f5e7
7 changed files with 92 additions and 7 deletions

View File

@@ -105,7 +105,7 @@ void Client::micTestCmd(QTextStream & /** args **/)
{ {
std::cout << "Running mic test. Speak normally for 5 seconds..." << std::endl; std::cout << "Running mic test. Speak normally for 5 seconds..." << std::endl;
printLinePrefix(); printLinePrefix();
m_voiceClient->runMicTest(); m_voiceClient->runMicrophoneTest();
} }
void Client::setCallsignCmd(QTextStream &args) void Client::setCallsignCmd(QTextStream &args)

View File

@@ -34,6 +34,15 @@ namespace BlackCore
this->leaveAllVoiceRooms(); 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 * Voice rooms for COM
*/ */
@@ -216,4 +225,24 @@ namespace BlackCore
CAudioDevice outputDevice = m_voice->getCurrentOutputDevice(); CAudioDevice outputDevice = m_voice->getCurrentOutputDevice();
BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice); 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 } // namespace

View File

@@ -71,6 +71,11 @@ namespace BlackCore
virtual bool usingLocalObjects() const { return true; } virtual bool usingLocalObjects() const { return true; }
public slots: public slots:
/*!
* \copydoc IContextVoice::setOwnAircraft
*/
virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft);
/*! /*!
* \copydoc IContextVoice::getComVoiceRooms() * \copydoc IContextVoice::getComVoiceRooms()
*/ */
@@ -147,11 +152,21 @@ namespace BlackCore
virtual bool isMuted() const; virtual bool isMuted() const;
/*! /*!
* \brief Play selcal tone * \copydoc IContextVoice::playSelcalTone()
* \param selcal
*/ */
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const; virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const;
/*!
* \copydoc IContextVoice::runMicrophoneTest()
*/
virtual void runMicrophoneTest() const;
/*!
* \copydoc IContextVoice::runSquelchTest()
*/
virtual void runSquelchTest() const;
private: private:
CVoiceVatlib *m_voice; //!< underlying voice lib CVoiceVatlib *m_voice; //!< underlying voice lib
}; };

View File

@@ -31,6 +31,14 @@ namespace BlackCore
// void // void
} }
/*
* Own aircraft
*/
void IContextVoice::setOwnAircraft(const CAircraft &ownAircraft)
{
this->m_dBusInterface->callDBus(QLatin1Literal("setOwnAircraft"), ownAircraft);
}
/* /*
* Leave all voice rooms * Leave all voice rooms
*/ */
@@ -143,6 +151,22 @@ namespace BlackCore
this->m_dBusInterface->callDBus(QLatin1Literal("playSelcalTone"), selcal); 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 * Volumes, by COM systems
*/ */

View File

@@ -10,8 +10,7 @@
#include "blackmisc/vaudiodevicelist.h" #include "blackmisc/vaudiodevicelist.h"
#include "blackmisc/vvoiceroomlist.h" #include "blackmisc/vvoiceroomlist.h"
#include "blackmisc/nwuserlist.h" #include "blackmisc/nwuserlist.h"
#include "blackmisc/aviocomsystem.h" #include "blackmisc/avaircraft.h"
#include "blackmisc/avcallsignlist.h"
#include "blackcore/voice_vatlib.h" #include "blackcore/voice_vatlib.h"
#include <QObject> #include <QObject>
#include <QDBusAbstractInterface> #include <QDBusAbstractInterface>
@@ -102,6 +101,13 @@ namespace BlackCore
public slots: 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: * Get voice rooms for COM1, COM2:
* From this connection audio status can be obtained * From this connection audio status can be obtained
@@ -191,6 +197,17 @@ namespace BlackCore
* \brief Play SELCAL tone * \brief Play SELCAL tone
*/ */
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const; virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const;
/*!
* \brief Microphone test
*/
virtual void runMicrophoneTest() const;
/*!
* \brief Microphone test
*/
virtual void runSquelchTest() const;
}; };
} }

View File

@@ -95,7 +95,7 @@ namespace BlackCore
/*! /*!
* \brief Runs a 5 seconds test, measuring the qualitiy of your mic input * \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 * \brief Value of the measured squelch

View File

@@ -244,7 +244,7 @@ namespace BlackCore
/* /*
* Start microphone test * 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!"); Q_ASSERT_X(m_voice->IsValid() && m_voice->IsSetup(), "CVoiceClientVatlib", "Cvatlib_Voice_Simple invalid or not setup!");