mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +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
|
#define BLACKCORE_VOICE_H
|
||||||
|
|
||||||
#include "../blackmisc/context.h"
|
#include "../blackmisc/context.h"
|
||||||
#include "../blackmisc/avcallsign.h"
|
#include "../blackmisc/avcallsignlist.h"
|
||||||
#include "../blackmisc/nwuserlist.h"
|
#include "../blackmisc/nwuserlist.h"
|
||||||
#include "../blackmisc/vvoiceroomlist.h"
|
#include "../blackmisc/vvoiceroomlist.h"
|
||||||
#include "../blackmisc/vaudiodevicelist.h"
|
#include "../blackmisc/vaudiodevicelist.h"
|
||||||
@@ -86,73 +86,67 @@ namespace BlackCore
|
|||||||
* SETUP TESTS
|
* 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;
|
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;
|
virtual void runMicTest() = 0;
|
||||||
|
|
||||||
//! inputSquelch
|
|
||||||
/*!
|
/*!
|
||||||
\return Value of the measured squelch
|
* \brief Value of the measured squelch
|
||||||
*/
|
* \return
|
||||||
|
*/
|
||||||
virtual float inputSquelch() const = 0;
|
virtual float inputSquelch() const = 0;
|
||||||
|
|
||||||
//! micTestResult
|
|
||||||
/*!
|
/*!
|
||||||
\return Result of the mic test.
|
* \brief Result of the mic test.
|
||||||
*/
|
* \return
|
||||||
|
*/
|
||||||
virtual qint32 micTestResult() const = 0;
|
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;
|
virtual QString micTestResultAsString() const = 0;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
//! setInputDevice
|
|
||||||
/*!
|
/*!
|
||||||
\param input device
|
* \brief Input device to be used
|
||||||
*/
|
*/
|
||||||
virtual void setInputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0;
|
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;
|
virtual void setOutputDevice(const BlackMisc::Voice::CAudioDevice &device) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get COM1/2 voice rooms, which then allows to retrieve information
|
* Get COM1/2 voice rooms, which then allows to retrieve information
|
||||||
* such as connection status etc.
|
* such as audio status etc.
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() = 0;
|
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get COM1/2 voice rooms, const and with no status update
|
* Get COM1/2 voice rooms, const and with no status update
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const = 0;
|
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Join voice room
|
* \brief Join voice room
|
||||||
* \param comUnit
|
* \param comUnit COM1/2
|
||||||
* \param voiceRoom
|
* \param voiceRoom
|
||||||
*/
|
*/
|
||||||
virtual void joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom) = 0;
|
virtual void joinVoiceRoom(const ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Leave voice room
|
* \brief Leave voice room
|
||||||
* \param comUnit
|
* \param comUnit COM1/2
|
||||||
*/
|
*/
|
||||||
virtual void leaveVoiceRoom(const ComUnit comUnit) = 0;
|
virtual void leaveVoiceRoom(const ComUnit comUnit) = 0;
|
||||||
|
|
||||||
@@ -185,7 +179,7 @@ namespace BlackCore
|
|||||||
* \param comUnit
|
* \param comUnit
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
virtual QSet<QString> getVoiceRoomCallsings(const ComUnit comUnit) const = 0;
|
virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// Signals regarding the voice server connection
|
// Signals regarding the voice server connection
|
||||||
@@ -198,8 +192,14 @@ namespace BlackCore
|
|||||||
void disconnected(const ComUnit comUnit);
|
void disconnected(const ComUnit comUnit);
|
||||||
|
|
||||||
// Signals about users joining and leaving
|
// 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
|
// Audio signals
|
||||||
void audioStarted(const ComUnit comUnit);
|
void audioStarted(const ComUnit comUnit);
|
||||||
@@ -208,10 +208,19 @@ namespace BlackCore
|
|||||||
void globalAudioStopped();
|
void globalAudioStopped();
|
||||||
|
|
||||||
// Test signals
|
// Test signals
|
||||||
|
/*!
|
||||||
|
* \brief Squelch test completed
|
||||||
|
*/
|
||||||
void squelchTestFinished();
|
void squelchTestFinished();
|
||||||
|
/*!
|
||||||
|
* \brief Microphone test completed
|
||||||
|
*/
|
||||||
void micTestFinished();
|
void micTestFinished();
|
||||||
|
|
||||||
// non protocol related signals
|
// non protocol related signals
|
||||||
|
/*!
|
||||||
|
* \brief Exception
|
||||||
|
*/
|
||||||
void exception(const QString &message, bool fatal = false); // let remote places know there was an 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;
|
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
|
* Enable audio
|
||||||
*/
|
*/
|
||||||
@@ -504,19 +514,18 @@ namespace BlackCore
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Paranoia...
|
// Paranoia...
|
||||||
if (!m_voice->IsRoomConnected(static_cast<qint32>(comUnit)))
|
if (!m_voice->IsRoomConnected(static_cast<qint32>(comUnit))) return;
|
||||||
return;
|
|
||||||
|
|
||||||
// Store the room index for the slot (called in static callback)
|
// Store the room index for the slot (called in static callback)
|
||||||
m_temporaryUserRoomIndex = static_cast<qint32>(comUnit);
|
m_temporaryUserRoomIndex = static_cast<qint32>(comUnit);
|
||||||
|
|
||||||
// Callbacks completed when function is called, after the method is done
|
// Callbacks already completed when function GetRoomUserList returns,
|
||||||
// m_voiceRoomCallsignsUpdate is filled with the latest callsigns
|
// thereafter m_voiceRoomCallsignsUpdate is filled with the latest callsigns
|
||||||
m_voice->GetRoomUserList(static_cast<qint32>(comUnit), onRoomUserReceived, this);
|
m_voice->GetRoomUserList(static_cast<qint32>(comUnit), onRoomUserReceived, this);
|
||||||
m_temporaryUserRoomIndex = CVoiceVatlib::InvalidRoomIndex; // reset
|
m_temporaryUserRoomIndex = CVoiceVatlib::InvalidRoomIndex; // reset
|
||||||
|
|
||||||
// we have all current users in m_voi
|
// 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))
|
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))
|
if (!m_voiceRoomCallsigns.value(comUnit).contains(callsign))
|
||||||
{
|
{
|
||||||
@@ -584,7 +593,7 @@ namespace BlackCore
|
|||||||
ComUnit comUnit = static_cast<ComUnit>(voiceClientVatlib->temporaryUserRoomIndex());
|
ComUnit comUnit = static_cast<ComUnit>(voiceClientVatlib->temporaryUserRoomIndex());
|
||||||
|
|
||||||
// add user
|
// 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 "voice.h"
|
||||||
#include "../blackmisc/vaudiodevicelist.h"
|
#include "../blackmisc/vaudiodevicelist.h"
|
||||||
#include "../blackmisc/nwuserlist.h"
|
#include "../blackmisc/nwuserlist.h"
|
||||||
|
#include "../blackmisc/avcallsignlist.h"
|
||||||
|
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
@@ -118,7 +120,6 @@ namespace BlackCore
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Voice rooms, const version with no updates
|
* \brief Voice rooms, const version with no updates
|
||||||
* \return
|
|
||||||
*/
|
*/
|
||||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const
|
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const
|
||||||
{
|
{
|
||||||
@@ -126,15 +127,11 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get voice room callsings
|
* \brief Get voice room callsigns
|
||||||
* \param comUnit
|
* \param comUnit COM1/2
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
virtual QSet<QString> getVoiceRoomCallsings(const ComUnit comUnit) const
|
virtual BlackMisc::Aviation::CCallsignList getVoiceRoomCallsigns(const ComUnit comUnit) const;
|
||||||
{
|
|
||||||
if (!this->m_voiceRoomCallsigns.contains(comUnit)) return QSet<QString>();
|
|
||||||
return this->m_voiceRoomCallsigns[comUnit];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Switch audio output
|
* \brief Switch audio output
|
||||||
@@ -209,7 +206,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
BlackMisc::Voice::CVoiceRoom voiceRoomForUnit(const ComUnit comUnit) const;
|
BlackMisc::Voice::CVoiceRoom voiceRoomForUnit(const ComUnit comUnit) const;
|
||||||
void setVoiceRoomForUnit(const IVoice::ComUnit comUnit, const BlackMisc::Voice::CVoiceRoom &voiceRoom);
|
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 removeUserFromRoom(const ComUnit comUnit, const QString &callsign);
|
||||||
void exceptionDispatcher(const char *caller);
|
void exceptionDispatcher(const char *caller);
|
||||||
void enableAudio(const ComUnit comUnit);
|
void enableAudio(const ComUnit comUnit);
|
||||||
@@ -301,8 +298,8 @@ namespace BlackCore
|
|||||||
bool m_pushToTalk; /*!< flag, PTT pressed */
|
bool m_pushToTalk; /*!< flag, PTT pressed */
|
||||||
float m_inputSquelch;
|
float m_inputSquelch;
|
||||||
Cvatlib_Voice_Simple::agc m_micTestResult;
|
Cvatlib_Voice_Simple::agc m_micTestResult;
|
||||||
QMap < ComUnit, QSet<QString> > m_voiceRoomCallsigns; /*!< voice room callsigns */
|
QMap <ComUnit, BlackMisc::Aviation::CCallsignList> m_voiceRoomCallsigns; /*!< voice room callsigns */
|
||||||
QSet<QString> m_temporaryVoiceRoomCallsigns; /*!< temp. storage of voice rooms during update */
|
BlackMisc::Aviation::CCallsignList m_temporaryVoiceRoomCallsigns; /*!< temp. storage of voice rooms during update */
|
||||||
QMap<ComUnit, bool> m_outputEnabled; /*!< output enabled, basically a mute flag */
|
QMap<ComUnit, bool> m_outputEnabled; /*!< output enabled, basically a mute flag */
|
||||||
|
|
||||||
// Need to keep the roomIndex?
|
// Need to keep the roomIndex?
|
||||||
|
|||||||
Reference in New Issue
Block a user