From 17b6789d4ea2ff401bed6ce5f01ad7d9b4dbb2dc Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 21 Jan 2014 16:42:53 +0100 Subject: [PATCH] Changed voice to * CCallsignList * CCallsign (replaced QString) * fixed Doxygen comments --- src/blackcore/voice.h | 69 +++++++++++++++++++--------------- src/blackcore/voice_vatlib.cpp | 29 +++++++++----- src/blackcore/voice_vatlib.h | 19 ++++------ 3 files changed, 66 insertions(+), 51 deletions(-) diff --git a/src/blackcore/voice.h b/src/blackcore/voice.h index 12278c1be..00cfd931d 100644 --- a/src/blackcore/voice.h +++ b/src/blackcore/voice.h @@ -7,7 +7,7 @@ #define BLACKCORE_VOICE_H #include "../blackmisc/context.h" -#include "../blackmisc/avcallsign.h" +#include "../blackmisc/avcallsignlist.h" #include "../blackmisc/nwuserlist.h" #include "../blackmisc/vvoiceroomlist.h" #include "../blackmisc/vaudiodevicelist.h" @@ -86,73 +86,67 @@ namespace BlackCore * SETUP TESTS * *********************************************/ - //! runSquelchTest /*! - \brief Runs a 5 seconds test, measuring your background noise. - */ + * \brief Runs a 5 seconds test, measuring your background noise. + */ virtual void runSquelchTest() = 0; - //! runMicTest /*! - \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; - //! inputSquelch /*! - \return Value of the measured squelch - */ + * \brief Value of the measured squelch + * \return + */ virtual float inputSquelch() const = 0; - //! micTestResult /*! - \return Result of the mic test. - */ + * \brief Result of the mic test. + * \return + */ virtual qint32 micTestResult() const = 0; - //! micTestResult /*! - \return Result of the mic test as human readable string - */ + * \brief Result of the mic test as human readable string + * \return + */ virtual QString micTestResultAsString() const = 0; public slots: - //! setInputDevice /*! - \param input device - */ + * \brief Input device to be used + */ virtual void setInputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0; - //! setOutputDevice /*! - \param output device - */ + * \brief Output device to be used + */ virtual void setOutputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0; /*! * Get COM1/2 voice rooms, which then allows to retrieve information - * such as connection status etc. - * \return + * such as audio status etc. */ virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() = 0; /*! * Get COM1/2 voice rooms, const and with no status update - * \return */ virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const = 0; /*! * \brief Join voice room - * \param comUnit + * \param comUnit COM1/2 * \param voiceRoom */ virtual void joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom) = 0; /*! * \brief Leave voice room - * \param comUnit + * \param comUnit COM1/2 */ virtual void leaveVoiceRoom(const ComUnit comUnit) = 0; @@ -185,7 +179,7 @@ namespace BlackCore * \param comUnit * \return */ - virtual QSet getVoiceRoomCallsings(const ComUnit comUnit) const = 0; + virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const = 0; signals: // Signals regarding the voice server connection @@ -198,8 +192,14 @@ namespace BlackCore void disconnected(const ComUnit comUnit); // Signals about users joining and leaving - void userJoinedRoom(const QString &callsign); - void userLeftRoom(const QString &callsign); + /*! + * \brief User with callsign joined room + */ + void userJoinedRoom(const BlackMisc::Aviation::CCallsign &callsign); + /*! + * \brief User with callsign left room + */ + void userLeftRoom(const BlackMisc::Aviation::CCallsign &callsign); // Audio signals void audioStarted(const ComUnit comUnit); @@ -208,10 +208,19 @@ namespace BlackCore void globalAudioStopped(); // Test signals + /*! + * \brief Squelch test completed + */ void squelchTestFinished(); + /*! + * \brief Microphone test completed + */ void micTestFinished(); // non protocol related signals + /*! + * \brief Exception + */ void exception(const QString &message, bool fatal = false); // let remote places know there was an exception }; diff --git a/src/blackcore/voice_vatlib.cpp b/src/blackcore/voice_vatlib.cpp index 5e0f65032..4fa81c050 100644 --- a/src/blackcore/voice_vatlib.cpp +++ b/src/blackcore/voice_vatlib.cpp @@ -164,6 +164,16 @@ namespace BlackCore return this->m_voiceRooms; } + /* + * Voice room callsigns + */ + CCallsignList CVoiceVatlib::getVoiceRoomCallsigns(const IVoice::ComUnit comUnit) const + { + CCallsignList callsigns; + if (!this->m_voiceRoomCallsigns.contains(comUnit)) return callsigns; + return this->m_voiceRoomCallsigns[comUnit]; + } + /* * Enable audio */ @@ -504,19 +514,18 @@ namespace BlackCore try { // Paranoia... - if (!m_voice->IsRoomConnected(static_cast(comUnit))) - return; + if (!m_voice->IsRoomConnected(static_cast(comUnit))) return; // Store the room index for the slot (called in static callback) m_temporaryUserRoomIndex = static_cast(comUnit); - // Callbacks completed when function is called, after the method is done - // m_voiceRoomCallsignsUpdate is filled with the latest callsigns + // Callbacks already completed when function GetRoomUserList returns, + // thereafter m_voiceRoomCallsignsUpdate is filled with the latest callsigns m_voice->GetRoomUserList(static_cast(comUnit), onRoomUserReceived, this); m_temporaryUserRoomIndex = CVoiceVatlib::InvalidRoomIndex; // reset // we have all current users in m_voi - foreach(QString callsign, m_voiceRoomCallsigns.value(comUnit)) + foreach(CCallsign callsign, m_voiceRoomCallsigns.value(comUnit)) { if (!m_temporaryVoiceRoomCallsigns.contains(callsign)) { @@ -525,7 +534,7 @@ namespace BlackCore } } - foreach(QString callsign, m_temporaryVoiceRoomCallsigns) + foreach(CCallsign callsign, m_temporaryVoiceRoomCallsigns) { if (!m_voiceRoomCallsigns.value(comUnit).contains(callsign)) { @@ -584,7 +593,7 @@ namespace BlackCore ComUnit comUnit = static_cast(voiceClientVatlib->temporaryUserRoomIndex()); // add user - voiceClientVatlib->addUserInRoom(comUnit, callsign); + voiceClientVatlib->addTemporaryCallsignForRoom(comUnit, CCallsign(callsign)); } /* @@ -624,11 +633,11 @@ namespace BlackCore } /* - * User in room + * Add temp.callsign for room */ - void CVoiceVatlib::addUserInRoom(const ComUnit /** comUnit **/, const QString &callsign) + void CVoiceVatlib::addTemporaryCallsignForRoom(const ComUnit /** comUnit **/, const CCallsign &callsign) { - m_temporaryVoiceRoomCallsigns.insert(callsign); + m_temporaryVoiceRoomCallsigns.push_back(callsign); } /* diff --git a/src/blackcore/voice_vatlib.h b/src/blackcore/voice_vatlib.h index ec10a70a3..38c5cffaf 100644 --- a/src/blackcore/voice_vatlib.h +++ b/src/blackcore/voice_vatlib.h @@ -9,6 +9,8 @@ #include "voice.h" #include "../blackmisc/vaudiodevicelist.h" #include "../blackmisc/nwuserlist.h" +#include "../blackmisc/avcallsignlist.h" + #include #include #include @@ -118,7 +120,6 @@ namespace BlackCore /*! * \brief Voice rooms, const version with no updates - * \return */ virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const { @@ -126,15 +127,11 @@ namespace BlackCore } /*! - * \brief Get voice room callsings - * \param comUnit + * \brief Get voice room callsigns + * \param comUnit COM1/2 * \return */ - virtual QSet getVoiceRoomCallsings(const ComUnit comUnit) const - { - if (!this->m_voiceRoomCallsigns.contains(comUnit)) return QSet(); - return this->m_voiceRoomCallsigns[comUnit]; - } + virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const; /*! * \brief Switch audio output @@ -209,7 +206,7 @@ namespace BlackCore BlackMisc::Voice::CVoiceRoom voiceRoomForUnit(const ComUnit comUnit) const; void setVoiceRoomForUnit(const IVoice::ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom); - void addUserInRoom(const ComUnit comUnit, const QString &callsign); + void addTemporaryCallsignForRoom(const ComUnit comUnit, const BlackMisc::Aviation::CCallsign &callsign); void removeUserFromRoom(const ComUnit comUnit, const QString &callsign); void exceptionDispatcher(const char *caller); void enableAudio(const ComUnit comUnit); @@ -301,8 +298,8 @@ namespace BlackCore bool m_pushToTalk; /*!< flag, PTT pressed */ float m_inputSquelch; Cvatlib_Voice_Simple::agc m_micTestResult; - QMap < ComUnit, QSet > m_voiceRoomCallsigns; /*!< voice room callsigns */ - QSet m_temporaryVoiceRoomCallsigns; /*!< temp. storage of voice rooms during update */ + QMap m_voiceRoomCallsigns; /*!< voice room callsigns */ + BlackMisc::Aviation::CCallsignList m_temporaryVoiceRoomCallsigns; /*!< temp. storage of voice rooms during update */ QMap m_outputEnabled; /*!< output enabled, basically a mute flag */ // Need to keep the roomIndex?