From cffb732a941fdda79074cebeb57a95417621b363 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 21 Jan 2014 17:46:55 +0100 Subject: [PATCH] Changed * to CCallsignList * from QString to CCallsign Added: * Method to get users, and * users for callsigns Fixed some Doxygen comments along with the changes --- src/blackcore/context_voice.cpp | 53 +++++++++++++-------- src/blackcore/context_voice.h | 56 +++++++++++------------ src/blackcore/context_voice_interface.cpp | 28 +++++++++--- 3 files changed, 85 insertions(+), 52 deletions(-) diff --git a/src/blackcore/context_voice.cpp b/src/blackcore/context_voice.cpp index df94685a9..7f3912744 100644 --- a/src/blackcore/context_voice.cpp +++ b/src/blackcore/context_voice.cpp @@ -4,8 +4,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "context_voice.h" +#include "context_network.h" #include "coreruntime.h" + using namespace BlackMisc; using namespace BlackMisc::Aviation; using namespace BlackMisc::Voice; @@ -16,9 +18,11 @@ namespace BlackCore /* * Init this context */ - CContextVoice::CContextVoice(CCoreRuntime *parent) : - IContextVoice(parent), m_voice(nullptr), m_currentInputDevice(), m_currentOutputDevice() + CContextVoice::CContextVoice(CCoreRuntime *runtime) : + IContextVoice(runtime), m_voice(nullptr), m_currentInputDevice(), m_currentOutputDevice() { + Q_ASSERT(runtime); + // 1. Init by "network driver" this->m_voice = new CVoiceVatlib(this); this->m_currentInputDevice = this->m_voice->defaultAudioInputDevice(); @@ -145,30 +149,43 @@ namespace BlackCore /* * Room 1 callsigns */ - QList CContextVoice::getCom1RoomCallsigns() const + CCallsignList CContextVoice::getCom1RoomCallsigns() const { Q_ASSERT(this->m_voice); - QSet signs = this->m_voice->getVoiceRoomCallsings(IVoice::COM1); - QList callsigns; - foreach(QString sign, signs) - { - callsigns.append(sign); - } - return callsigns; + return this->m_voice->getVoiceRoomCallsigns(IVoice::COM1); } /* * Room 2 callsigns */ - QList CContextVoice::getCom2RoomCallsigns() const + CCallsignList CContextVoice::getCom2RoomCallsigns() const { Q_ASSERT(this->m_voice); - QSet signs = this->m_voice->getVoiceRoomCallsings(IVoice::COM2); - QList callsigns; - foreach(QString sign, signs) - { - callsigns.append(sign); - } - return callsigns; + return this->m_voice->getVoiceRoomCallsigns(IVoice::COM2); } + + /* + * Room 1 users + */ + Network::CUserList CContextVoice::getCom1RoomUsers() const + { + Q_ASSERT(this->m_voice); + Q_ASSERT(this->getRuntime()); + Q_ASSERT(this->getRuntime()->getIContextNetwork()); + return this->getRuntime()->getIContextNetwork()-> + getUsersForCallsigns(this->getCom1RoomCallsigns()); + } + + /* + * Room 1 users + */ + Network::CUserList CContextVoice::getCom2RoomUsers() const + { + Q_ASSERT(this->m_voice); + Q_ASSERT(this->getRuntime()); + Q_ASSERT(this->getRuntime()->getIContextNetwork()); + return this->getRuntime()->getIContextNetwork()-> + getUsersForCallsigns(this->getCom2RoomCallsigns()); + } + } // namespace diff --git a/src/blackcore/context_voice.h b/src/blackcore/context_voice.h index 44187b106..05ade1b72 100644 --- a/src/blackcore/context_voice.h +++ b/src/blackcore/context_voice.h @@ -39,10 +39,9 @@ namespace BlackCore public: /*! - * \brief With link to server - * \param server + * \brief Constructor */ - CContextVoice(CCoreRuntime *parent); + CContextVoice(CCoreRuntime *runtime); /*! * \brief Destructor @@ -51,7 +50,7 @@ namespace BlackCore /*! * \brief Register myself in DBus - * \param server + * \param server DBus server */ void registerWithDBus(CDBusServer *server) { @@ -60,7 +59,6 @@ namespace BlackCore /*! * \brief Runtime - * \return */ const CCoreRuntime *getRuntime() const { @@ -69,42 +67,46 @@ namespace BlackCore /*! * \brief Using local objects? - * \return */ virtual bool usingLocalObjects() const { return true; } public slots: /*! - * Get voice rooms for COM1, COM2, but not with the latest status - * \return + * \copydoc IContextVoice::getComVoiceRooms() */ virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const; /*! - * Get voice rooms for COM1, COM2: From this connection status - * etc. can be obtained - * \return + * \copydoc IContextVoice::getComVoiceRoomsWithAudioStatus() */ virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus(); /*! - * \brief Set voice rooms - * \param voiceRoomCom1 - * \param voiceRoomCom2 + * \copydoc IContextVoice::setComVoiceRooms() */ virtual void setComVoiceRooms(const BlackMisc::Voice::CVoiceRoom &voiceRoomCom1, const BlackMisc::Voice::CVoiceRoom &voiceRoomCom2); /*! - * \brief COM1 room user's callsigns + * \copydoc IContextVoice::getCom1RoomCallsigns() * \return */ - virtual QList getCom1RoomCallsigns() const; + virtual BlackMisc::Aviation::CCallsignList getCom1RoomCallsigns() const; /*! - * \brief COM2 room user's callsigns + * \copydoc IContextVoice::getCom2RoomCallsigns() * \return */ - virtual QList getCom2RoomCallsigns() const; + virtual BlackMisc::Aviation::CCallsignList getCom2RoomCallsigns() const; + + /*! + * \copydoc IContextVoice::getCom1RoomUsers() + */ + virtual BlackMisc::Network::CUserList getCom1RoomUsers() const; + + /*! + * \copydoc IContextVoice::getCom2RoomUsers() + */ + virtual BlackMisc::Network::CUserList getCom2RoomUsers() const; /*! * Leave all voice rooms @@ -113,39 +115,37 @@ namespace BlackCore /*! * \brief Audio devices - * \return + * \return all input/output devices */ virtual BlackMisc::Voice::CAudioDeviceList getAudioDevices() const; /*! * \brief Set current audio device - * \param audioDevice + * \return get input and output device */ virtual BlackMisc::Voice::CAudioDeviceList getCurrentAudioDevices() const; /*! * \brief Set current audio device - * \param audioDevice */ virtual void setCurrentAudioDevice(const BlackMisc::Voice::CAudioDevice &audioDevice); /*! - * \brief Set volumes, also allows to mute - * \param com1 - * \param com2 + * \brief Set volumes via com units, also allows to mute + * \see BlackMisc::Aviation::CComSystem::setVolumeInput() + * \see BlackMisc::Aviation::CComSystem::setVolumeOutput() */ virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2); /*! * \brief Is muted? - * \return */ virtual bool isMuted() const; private: - CVoiceVatlib *m_voice; - BlackMisc::Voice::CAudioDevice m_currentInputDevice; - BlackMisc::Voice::CAudioDevice m_currentOutputDevice; + CVoiceVatlib *m_voice; //!< underlying voice lib + BlackMisc::Voice::CAudioDevice m_currentInputDevice; //!< input device + BlackMisc::Voice::CAudioDevice m_currentOutputDevice; //!< current output device }; } diff --git a/src/blackcore/context_voice_interface.cpp b/src/blackcore/context_voice_interface.cpp index edac3e96b..7190b6b31 100644 --- a/src/blackcore/context_voice_interface.cpp +++ b/src/blackcore/context_voice_interface.cpp @@ -39,19 +39,35 @@ namespace BlackCore } /* - * COM1 users + * COM1 callsigns */ - QList IContextVoice::getCom1RoomCallsigns() const + BlackMisc::Aviation::CCallsignList IContextVoice::getCom1RoomCallsigns() const { - return this->m_dBusInterface->callDBusRet >(QLatin1Literal("getCom1RoomCallsigns")); + return this->m_dBusInterface->callDBusRet(QLatin1Literal("getCom1RoomCallsigns")); } /* - * COM2 users + * COM2 callsigns */ - QList IContextVoice::getCom2RoomCallsigns() const + BlackMisc::Aviation::CCallsignList IContextVoice::getCom2RoomCallsigns() const { - return this->m_dBusInterface->callDBusRet >(QLatin1Literal("getCom2RoomCallsigns")); + return this->m_dBusInterface->callDBusRet(QLatin1Literal("getCom2RoomCallsigns")); + } + + /* + * COM1 callsigns + */ + BlackMisc::Network::CUserList IContextVoice::getCom1RoomUsers() const + { + return this->m_dBusInterface->callDBusRet(QLatin1Literal("getCom1RoomUsers")); + } + + /* + * COM2 callsigns + */ + BlackMisc::Network::CUserList IContextVoice::getCom2RoomUsers() const + { + return this->m_dBusInterface->callDBusRet(QLatin1Literal("getCom2RoomUsers")); } /*