mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Changed voice to
* CCallsignList * CCallsign (replaced QString) * fixed Doxygen comments
This commit is contained in:
@@ -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<QString> 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
|
||||
};
|
||||
|
||||
|
||||
@@ -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<qint32>(comUnit)))
|
||||
return;
|
||||
if (!m_voice->IsRoomConnected(static_cast<qint32>(comUnit))) return;
|
||||
|
||||
// Store the room index for the slot (called in static callback)
|
||||
m_temporaryUserRoomIndex = static_cast<qint32>(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<qint32>(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<ComUnit>(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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "voice.h"
|
||||
#include "../blackmisc/vaudiodevicelist.h"
|
||||
#include "../blackmisc/nwuserlist.h"
|
||||
#include "../blackmisc/avcallsignlist.h"
|
||||
|
||||
#include <QScopedPointer>
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
@@ -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<QString> getVoiceRoomCallsings(const ComUnit comUnit) const
|
||||
{
|
||||
if (!this->m_voiceRoomCallsigns.contains(comUnit)) return QSet<QString>();
|
||||
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<QString> > m_voiceRoomCallsigns; /*!< voice room callsigns */
|
||||
QSet<QString> m_temporaryVoiceRoomCallsigns; /*!< temp. storage of voice rooms during update */
|
||||
QMap <ComUnit, BlackMisc::Aviation::CCallsignList> m_voiceRoomCallsigns; /*!< voice room callsigns */
|
||||
BlackMisc::Aviation::CCallsignList m_temporaryVoiceRoomCallsigns; /*!< temp. storage of voice rooms during update */
|
||||
QMap<ComUnit, bool> m_outputEnabled; /*!< output enabled, basically a mute flag */
|
||||
|
||||
// Need to keep the roomIndex?
|
||||
|
||||
Reference in New Issue
Block a user