mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-01 06:06:09 +08:00
Refactored inheritance hierarchy of ContextAudio (former ContextVoice)
refs #85
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "tool.h"
|
||||
#include "blackcore/coreruntime.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_voice.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
#include "blackmisc/valuemap.h"
|
||||
#include "blackmisc/avallclasses.h"
|
||||
#include "blackmisc/pqallquantities.h"
|
||||
@@ -43,7 +43,7 @@ namespace BlackMiscTest
|
||||
while (line != "x")
|
||||
{
|
||||
const BlackCore::IContextNetwork *networkContext = core->getIContextNetwork();
|
||||
const BlackCore::IContextVoice *voiceContext = core->getIContextVoice();
|
||||
const BlackCore::IContextAudio *audioContext = core->getIContextAudio();
|
||||
|
||||
// display current status
|
||||
qDebug() << "-------------";
|
||||
@@ -95,7 +95,7 @@ namespace BlackMiscTest
|
||||
{
|
||||
qDebug() << "-------------";
|
||||
qDebug() << "voice rooms";
|
||||
qDebug() << voiceContext->getComVoiceRooms();
|
||||
qDebug() << audioContext->getComVoiceRooms();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
||||
m_modelAllUsers(nullptr), m_modelUsersVoiceCom1(nullptr), m_modelUsersVoiceCom2(nullptr), m_modelSettingsHotKeys(nullptr),
|
||||
// contexts and runtime
|
||||
m_coreMode(GuiModes::CoreExternal),
|
||||
m_coreAvailable(false), m_contextNetworkAvailable(false), m_contextVoiceAvailable(false),
|
||||
m_contextApplication(nullptr), m_contextNetwork(nullptr), m_contextVoice(nullptr), m_contextSettings(nullptr),
|
||||
m_coreAvailable(false), m_contextNetworkAvailable(false), m_contextAudioAvailable(false),
|
||||
m_contextApplication(nullptr), m_contextNetwork(nullptr), m_contextAudio(nullptr), m_contextSettings(nullptr),
|
||||
m_contextSimulator(nullptr),
|
||||
// timers
|
||||
m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr), m_timerUpdateUsers(nullptr),
|
||||
@@ -97,10 +97,10 @@ void MainWindow::gracefulShutdown()
|
||||
{
|
||||
if (this->m_contextNetwork->isConnected())
|
||||
{
|
||||
if (this->m_contextVoiceAvailable)
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
this->m_contextVoice->leaveAllVoiceRooms();
|
||||
this->m_contextVoice->disconnect(this); // break down signal / slots
|
||||
this->m_contextAudio->leaveAllVoiceRooms();
|
||||
this->m_contextAudio->disconnect(this); // break down signal / slots
|
||||
}
|
||||
this->m_contextNetwork->disconnectFromNetwork();
|
||||
this->m_contextNetwork->disconnect(this); // avoid any status update signals, etc.
|
||||
@@ -209,7 +209,7 @@ void MainWindow::toggleNetworkConnection()
|
||||
|
||||
// send latest aircraft to network/voice
|
||||
this->m_contextNetwork->setOwnAircraft(this->m_ownAircraft);
|
||||
if (this->m_contextVoiceAvailable) this->m_contextVoice->setOwnAircraft(this->m_ownAircraft);
|
||||
if (this->m_contextAudioAvailable) this->m_contextAudio->setOwnAircraft(this->m_ownAircraft);
|
||||
|
||||
// Login is based on setting current server
|
||||
INetwork::LoginMode mode = INetwork::LoginNormal;
|
||||
@@ -229,7 +229,7 @@ void MainWindow::toggleNetworkConnection()
|
||||
{
|
||||
// disconnect from network
|
||||
this->stopUpdateTimers(); // stop update timers, to avoid updates during disconnecting (a short time frame)
|
||||
if (this->m_contextVoiceAvailable) this->m_contextVoice->leaveAllVoiceRooms();
|
||||
if (this->m_contextAudioAvailable) this->m_contextAudio->leaveAllVoiceRooms();
|
||||
msgs = this->m_contextNetwork->disconnectFromNetwork();
|
||||
}
|
||||
if (!msgs.isEmpty()) this->displayStatusMessages(msgs);
|
||||
@@ -246,11 +246,11 @@ bool MainWindow::isContextNetworkAvailableCheck()
|
||||
}
|
||||
|
||||
/*
|
||||
* Is the voice context available?
|
||||
* Is the audio context available?
|
||||
*/
|
||||
bool MainWindow::isContextVoiceAvailableCheck()
|
||||
bool MainWindow::isContextAudioAvailableCheck()
|
||||
{
|
||||
if (this->m_contextVoiceAvailable) return true;
|
||||
if (this->m_contextAudioAvailable) return true;
|
||||
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeCore, CStatusMessage::SeverityError, "Voice context not available"));
|
||||
return false;
|
||||
}
|
||||
@@ -375,7 +375,7 @@ void MainWindow::setContextAvailability()
|
||||
qint64 t = QDateTime::currentMSecsSinceEpoch();
|
||||
this->m_coreAvailable = this->m_contextApplication->ping(t) == t;
|
||||
this->m_contextNetworkAvailable = this->m_coreAvailable || this->m_contextNetwork->usingLocalObjects();
|
||||
this->m_contextVoiceAvailable = this->m_coreAvailable || this->m_contextVoice->usingLocalObjects();
|
||||
this->m_contextAudioAvailable = this->m_coreAvailable || this->m_contextAudio->usingLocalObjects();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -409,9 +409,9 @@ void MainWindow::updateGuiStatusInformation()
|
||||
|
||||
// handle voice, mute
|
||||
QString voice("unavailable");
|
||||
if (this->m_contextVoiceAvailable)
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
voice = this->m_contextVoice->usingLocalObjects() ? "local" : now;
|
||||
voice = this->m_contextAudio->usingLocalObjects() ? "local" : now;
|
||||
this->ui->pb_SoundMute->setEnabled(true);
|
||||
}
|
||||
else
|
||||
@@ -422,7 +422,7 @@ void MainWindow::updateGuiStatusInformation()
|
||||
|
||||
// update status fields
|
||||
this->ui->le_StatusNetworkContext->setText(network);
|
||||
this->ui->le_StatusVoiceContext->setText(voice);
|
||||
this->ui->le_StatusAudioContext->setText(voice);
|
||||
this->ui->cb_StatusWithDBus->setCheckState(this->m_coreMode ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
// Connected button
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "infowindow.h"
|
||||
#include "guimodeenums.h"
|
||||
#include "blackcore/context_voice.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_settings_interface.h"
|
||||
#include "blackcore/context_application.h"
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "blackgui/statusmessagelistmodel.h"
|
||||
#include "blackgui/keyboardkeylistmodel.h"
|
||||
#include "blackmisc/nwtextmessage.h"
|
||||
#include "blacksound/soundgenerator.h"
|
||||
#include <QMainWindow>
|
||||
#include <QTextEdit>
|
||||
#include <QTableView>
|
||||
@@ -129,11 +130,11 @@ private:
|
||||
GuiModes::CoreMode m_coreMode;
|
||||
bool m_coreAvailable;
|
||||
bool m_contextNetworkAvailable;
|
||||
bool m_contextVoiceAvailable;
|
||||
bool m_contextAudioAvailable;
|
||||
QScopedPointer<BlackCore::CCoreRuntime> m_coreRuntime; /*!< runtime, if working with local core */
|
||||
BlackCore::IContextApplication *m_contextApplication; /*!< overall application state */
|
||||
BlackCore::IContextNetwork *m_contextNetwork;
|
||||
BlackCore::IContextVoice *m_contextVoice;
|
||||
BlackCore::IContextAudio *m_contextAudio;
|
||||
BlackCore::IContextSettings *m_contextSettings;
|
||||
BlackCore::IContextSimulator *m_contextSimulator;
|
||||
BlackMisc::Aviation::CAircraft m_ownAircraft; /*!< own aircraft's state */
|
||||
@@ -203,7 +204,7 @@ private:
|
||||
/*!
|
||||
* \brief Context voice availability check, otherwise status message
|
||||
*/
|
||||
bool isContextVoiceAvailableCheck();
|
||||
bool isContextAudioAvailableCheck();
|
||||
|
||||
/*!
|
||||
* \brief Own cockpit, update from context
|
||||
|
||||
@@ -523,7 +523,7 @@ QStatusBar QLabel {
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="le_StatusVoiceContext">
|
||||
<widget class="QLineEdit" name="le_StatusAudioContext">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -3131,7 +3131,7 @@ QStatusBar QLabel {
|
||||
<tabstops>
|
||||
<tabstop>cb_StatusWithDBus</tabstop>
|
||||
<tabstop>le_StatusNetworkContext</tabstop>
|
||||
<tabstop>le_StatusVoiceContext</tabstop>
|
||||
<tabstop>le_StatusAudioContext</tabstop>
|
||||
<tabstop>tv_StatusMessages</tabstop>
|
||||
<tabstop>le_CommandLineInput</tabstop>
|
||||
<tabstop>tw_AtcStations</tabstop>
|
||||
|
||||
@@ -130,11 +130,11 @@ void MainWindow::updateCockpitFromContext()
|
||||
//
|
||||
// Voice room override
|
||||
//
|
||||
if (this->m_contextVoiceAvailable)
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
// get all rooms, it is important to get the rooms from voice context here
|
||||
// these are the ones featuring the real audio status
|
||||
CVoiceRoomList rooms = this->m_contextVoice->getComVoiceRoomsWithAudioStatus();
|
||||
CVoiceRoomList rooms = this->m_contextAudio->getComVoiceRoomsWithAudioStatus();
|
||||
Q_ASSERT(rooms.size() == 2);
|
||||
Q_ASSERT(this->m_modelUsersVoiceCom1);
|
||||
Q_ASSERT(this->m_modelUsersVoiceCom2);
|
||||
@@ -145,12 +145,12 @@ void MainWindow::updateCockpitFromContext()
|
||||
bool com2Connected = room2.isConnected();
|
||||
|
||||
// update views
|
||||
this->m_modelUsersVoiceCom1->update(this->m_contextVoice->getCom1RoomUsers());
|
||||
this->m_modelUsersVoiceCom1->update(this->m_contextAudio->getCom1RoomUsers());
|
||||
this->ui->tv_CockpitVoiceRoom1->resizeColumnsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom1->resizeRowsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom1->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
this->m_modelUsersVoiceCom2->update(this->m_contextVoice->getCom2RoomUsers());
|
||||
this->m_modelUsersVoiceCom2->update(this->m_contextAudio->getCom2RoomUsers());
|
||||
this->ui->tv_CockpitVoiceRoom2->resizeColumnsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom2->resizeRowsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom2->horizontalHeader()->setStretchLastSection(true);
|
||||
@@ -316,7 +316,7 @@ void MainWindow::sendCockpitUpdates()
|
||||
*/
|
||||
void MainWindow::setAudioVoiceRooms()
|
||||
{
|
||||
if (!this->m_contextVoiceAvailable) return;
|
||||
if (!this->m_contextAudioAvailable) return;
|
||||
if (!this->m_contextNetworkAvailable) return;
|
||||
|
||||
// make fields readonly if not overriding
|
||||
@@ -347,7 +347,7 @@ void MainWindow::setAudioVoiceRooms()
|
||||
}
|
||||
|
||||
// set the real voice rooms for audio output
|
||||
this->m_contextVoice->setComVoiceRooms(room1, room2);
|
||||
this->m_contextAudio->setComVoiceRooms(room1, room2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -362,10 +362,10 @@ void MainWindow::testSelcal()
|
||||
CStatusMessage(CStatusMessage::TypeValidation, CStatusMessage::SeverityWarning, "invalid SELCAL codde"));
|
||||
return;
|
||||
}
|
||||
if (this->m_contextVoiceAvailable)
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
CSelcal selcal(selcalCode);
|
||||
this->m_contextVoice->playSelcalTone(selcal);
|
||||
this->m_contextAudio->playSelcalTone(selcal);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "blackcore/context_simulator_proxy.h"
|
||||
#include "blackcore/context_application_impl.h"
|
||||
#include "blackcore/context_application_proxy.h"
|
||||
#include "blackcore/context_audio_impl.h"
|
||||
#include "blackcore/context_audio_proxy.h"
|
||||
#include "blackcore/coreruntime.h"
|
||||
#include "blackgui/atcstationlistmodel.h"
|
||||
#include "blackgui/keyboardkeylistmodel.h"
|
||||
@@ -167,8 +169,8 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
|
||||
{
|
||||
this->m_dBusConnection = QDBusConnection::sessionBus();
|
||||
this->m_contextNetwork = new BlackCore::IContextNetwork(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_contextVoice = new BlackCore::IContextVoice(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_contextSettings = new BlackCore::IContextSettings(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_contextAudio = new BlackCore::CContextAudioProxy(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_contextApplication = new BlackCore::CContextApplicationProxy(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_contextSimulator = new BlackCore::CContextSimulatorProxy(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
}
|
||||
@@ -176,7 +178,7 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
|
||||
{
|
||||
this->m_coreRuntime.reset(new CCoreRuntime(false, this));
|
||||
this->m_contextNetwork = this->m_coreRuntime->getIContextNetwork();
|
||||
this->m_contextVoice = this->m_coreRuntime->getIContextVoice();
|
||||
this->m_contextAudio = this->m_coreRuntime->getIContextAudio();
|
||||
this->m_contextSettings = this->m_coreRuntime->getIContextSettings();
|
||||
this->m_contextApplication = this->m_coreRuntime->getIContextApplication();
|
||||
this->m_contextSimulator = this->m_coreRuntime->getIContextSimulator();
|
||||
@@ -224,7 +226,7 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
|
||||
this->connect(this->m_timerCollectedCockpitUpdates, &QTimer::timeout, this, &MainWindow::sendCockpitUpdates);
|
||||
this->connect(this->m_timerAudioTests, &QTimer::timeout, this, &MainWindow::audioTestUpdate);
|
||||
this->connect(this->m_timerSimulator, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
|
||||
connect = this->connect(this->m_contextVoice, &IContextVoice::audioTestCompleted, this, &MainWindow::audioTestUpdate);
|
||||
connect = this->connect(this->m_contextAudio, &IContextAudio::audioTestCompleted, this, &MainWindow::audioTestUpdate);
|
||||
|
||||
// start timers, update timers will be started when network is connected
|
||||
this->m_timerContextWatchdog->start(2 * 1000);
|
||||
|
||||
@@ -26,9 +26,9 @@ void MainWindow::appendTextMessagesToGui(const CTextMessageList &messages, bool
|
||||
if (this->m_ownAircraft.isActiveFrequencyWithin25kHzChannel(message.getFrequency()))
|
||||
{
|
||||
// this is SELCAL for me
|
||||
if (this->m_contextVoiceAvailable)
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
CAudioDevice dev = this->m_contextVoice->getCurrentAudioDevices().getOutputDevices()[0];
|
||||
CAudioDevice dev = this->m_contextAudio->getCurrentAudioDevices().getOutputDevices()[0];
|
||||
BlackSound::CSoundGenerator::playSelcal(90, CSelcal(currentSelcal), dev);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "blackgui/atcstationlistmodel.h"
|
||||
#include "blackcore/dbus_server.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_voice.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
#include "blacksound/soundgenerator.h"
|
||||
|
||||
using namespace BlackCore;
|
||||
@@ -23,11 +23,11 @@ using namespace BlackMisc::Math;
|
||||
*/
|
||||
void MainWindow::setAudioDeviceLists()
|
||||
{
|
||||
if (!this->isContextVoiceAvailableCheck()) return;
|
||||
if (!this->isContextAudioAvailableCheck()) return;
|
||||
this->ui->cb_SettingsAudioOutputDevice->clear();
|
||||
this->ui->cb_SettingsAudioInputDevice->clear();
|
||||
|
||||
foreach(CAudioDevice device, this->m_contextVoice->getAudioDevices())
|
||||
foreach(CAudioDevice device, this->m_contextAudio->getAudioDevices())
|
||||
{
|
||||
if (device.getType() == CAudioDevice::InputDevice)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ void MainWindow::setAudioDeviceLists()
|
||||
}
|
||||
}
|
||||
|
||||
foreach(CAudioDevice device, this->m_contextVoice->getCurrentAudioDevices())
|
||||
foreach(CAudioDevice device, this->m_contextAudio->getCurrentAudioDevices())
|
||||
{
|
||||
if (device.getType() == CAudioDevice::InputDevice)
|
||||
{
|
||||
@@ -58,9 +58,9 @@ void MainWindow::setAudioDeviceLists()
|
||||
void MainWindow::audioDeviceSelected(int index)
|
||||
{
|
||||
if (!this->m_init) return; // not during init
|
||||
if (!this->isContextVoiceAvailableCheck()) return;
|
||||
if (!this->isContextAudioAvailableCheck()) return;
|
||||
if (index < 0)return;
|
||||
CAudioDeviceList devices = this->m_contextVoice->getAudioDevices();
|
||||
CAudioDeviceList devices = this->m_contextAudio->getAudioDevices();
|
||||
if (devices.isEmpty()) return;
|
||||
CAudioDevice selectedDevice;
|
||||
QObject *sender = QObject::sender();
|
||||
@@ -69,14 +69,14 @@ void MainWindow::audioDeviceSelected(int index)
|
||||
CAudioDeviceList inputDevices = devices.getInputDevices();
|
||||
if (index >= inputDevices.size()) return;
|
||||
selectedDevice = inputDevices[index];
|
||||
this->m_contextVoice->setCurrentAudioDevice(selectedDevice);
|
||||
this->m_contextAudio->setCurrentAudioDevice(selectedDevice);
|
||||
}
|
||||
else if (sender == this->ui->cb_SettingsAudioOutputDevice)
|
||||
{
|
||||
CAudioDeviceList outputDevices = devices.getOutputDevices();
|
||||
if (index >= outputDevices.size()) return;
|
||||
selectedDevice = outputDevices[index];
|
||||
this->m_contextVoice->setCurrentAudioDevice(selectedDevice);
|
||||
this->m_contextAudio->setCurrentAudioDevice(selectedDevice);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ void MainWindow::audioDeviceSelected(int index)
|
||||
*/
|
||||
void MainWindow::audioVolumes()
|
||||
{
|
||||
if (!this->m_contextVoiceAvailable)
|
||||
if (!this->m_contextAudioAvailable)
|
||||
{
|
||||
this->ui->pb_SoundMute->setEnabled(false);
|
||||
this->ui->pb_SoundMaxVolume->setEnabled(false);
|
||||
@@ -103,7 +103,7 @@ void MainWindow::audioVolumes()
|
||||
|
||||
if (sender == this->ui->pb_SoundMute)
|
||||
{
|
||||
if (this->m_contextVoice->isMuted())
|
||||
if (this->m_contextAudio->isMuted())
|
||||
{
|
||||
// muted right now, now unmute
|
||||
muted = false;
|
||||
@@ -146,7 +146,7 @@ void MainWindow::audioVolumes()
|
||||
// update own aircraft, also set volume/mute in voice
|
||||
this->m_ownAircraft.setCom1System(com1);
|
||||
this->m_ownAircraft.setCom2System(com2);
|
||||
this->m_contextVoice->setVolumes(this->m_ownAircraft.getCom1System(), this->m_ownAircraft.getCom2System());
|
||||
this->m_contextAudio->setVolumes(this->m_ownAircraft.getCom1System(), this->m_ownAircraft.getCom2System());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -154,7 +154,7 @@ void MainWindow::audioVolumes()
|
||||
*/
|
||||
void MainWindow::startAudioTest()
|
||||
{
|
||||
if (!this->m_contextVoiceAvailable)
|
||||
if (!this->m_contextAudioAvailable)
|
||||
{
|
||||
CStatusMessage m(CStatusMessage::TypeAudio, CStatusMessage::SeverityError, "voice context not available");
|
||||
this->displayStatusMessage(m);
|
||||
@@ -174,13 +174,13 @@ void MainWindow::startAudioTest()
|
||||
if (sender == this->ui->pb_SettingsAudioMicrophoneTest)
|
||||
{
|
||||
this->m_audioTestRunning = MicrophoneTest;
|
||||
this->m_contextVoice->runMicrophoneTest();
|
||||
this->m_contextAudio->runMicrophoneTest();
|
||||
this->ui->pte_SettingsAudioTestActionAndResult->appendPlainText("Speak normally for 5 seconds");
|
||||
}
|
||||
else if (sender == this->ui->pb_SettingsAudioSquelchTest)
|
||||
{
|
||||
this->m_audioTestRunning = SquelchTest;
|
||||
this->m_contextVoice->runSquelchTest();
|
||||
this->m_contextAudio->runSquelchTest();
|
||||
this->ui->pte_SettingsAudioTestActionAndResult->appendPlainText("Silence for 5 seconds");
|
||||
}
|
||||
this->ui->prb_SettingsAudioTestProgress->setVisible(true);
|
||||
@@ -210,16 +210,16 @@ void MainWindow::audioTestUpdate()
|
||||
// getting here we assume the audio test finished signal
|
||||
// fetch results
|
||||
this->ui->pte_SettingsAudioTestActionAndResult->clear();
|
||||
if (this->m_contextVoiceAvailable)
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
if (this->m_audioTestRunning == SquelchTest)
|
||||
{
|
||||
double s = this->m_contextVoice->getSquelchValue();
|
||||
double s = this->m_contextAudio->getSquelchValue();
|
||||
this->ui->pte_SettingsAudioTestActionAndResult->appendPlainText(QString::number(s));
|
||||
}
|
||||
else if (this->m_audioTestRunning == MicrophoneTest)
|
||||
{
|
||||
QString m = this->m_contextVoice->getMicrophoneTestResult();
|
||||
QString m = this->m_contextAudio->getMicrophoneTestResult();
|
||||
this->ui->pte_SettingsAudioTestActionAndResult->appendPlainText(m);
|
||||
}
|
||||
}
|
||||
@@ -236,8 +236,8 @@ void MainWindow::audioTestUpdate()
|
||||
*/
|
||||
void MainWindow::playNotifcationSound(CSoundGenerator::Notification notification) const
|
||||
{
|
||||
if (!this->m_contextVoiceAvailable) return;
|
||||
if (!this->m_contextAudioAvailable) return;
|
||||
if (!this->ui->cb_SettingsAudioPlayNotificationSounds->isChecked()) return;
|
||||
if (notification == CSoundGenerator::NotificationTextMessage && !this->ui->cb_SettingsAudioNotificationTextMessage->isChecked()) return;
|
||||
this->m_contextVoice->playNotification(static_cast<uint>(notification));
|
||||
this->m_contextAudio->playNotification(static_cast<uint>(notification));
|
||||
}
|
||||
|
||||
@@ -3,232 +3,198 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef BLACKCORE_CONTEXTVOICE_INTERFACE_H
|
||||
#define BLACKCORE_CONTEXTVOICE_INTERFACE_H
|
||||
#ifndef BLACKCORE_CONTEXTAUDIO_H
|
||||
#define BLACKCORE_CONTEXTAUDIO_H
|
||||
|
||||
#include "blackmisc/genericdbusinterface.h"
|
||||
#include "blackmisc/audiodevicelist.h"
|
||||
#include "blackmisc/voiceroomlist.h"
|
||||
#include "blackmisc/nwuserlist.h"
|
||||
#include "blackmisc/avaircraft.h"
|
||||
#include "blackcore/voice_vatlib.h"
|
||||
#include "blackmisc/avcallsignlist.h"
|
||||
#include "blackmisc/avselcal.h"
|
||||
#include <QObject>
|
||||
#include <QDBusAbstractInterface>
|
||||
|
||||
#define BLACKCORE_CONTEXTVOICE_INTERFACENAME "blackcore.contextvoice"
|
||||
#define BLACKCORE_CONTEXTVOICE_SERVICEPATH "/voice"
|
||||
|
||||
// SERVICENAME must contain at least one ".", otherwise generation fails
|
||||
// as this is interpreted in the way comain.somename
|
||||
#define BLACKCORE_CONTEXTAUDIO_INTERFACENAME "net.vatsim.PilotClient.BlackCore.ContextAudio"
|
||||
#define BLACKCORE_CONTEXTAUDIO_OBJECTPATH "/Audio"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
/*!
|
||||
* \brief The IContextVoice class
|
||||
*/
|
||||
class IContextVoice : public QObject
|
||||
//! \brief Audio context interface
|
||||
class IContextAudio : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTVOICE_INTERFACENAME)
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTAUDIO_INTERFACENAME)
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Service name
|
||||
* \brief Interface name
|
||||
* \return
|
||||
*/
|
||||
static const QString &InterfaceName()
|
||||
{
|
||||
static QString s(BLACKCORE_CONTEXTVOICE_INTERFACENAME);
|
||||
static QString s(BLACKCORE_CONTEXTAUDIO_INTERFACENAME);
|
||||
return s;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Service path
|
||||
* \brief Object path
|
||||
* \return
|
||||
*/
|
||||
static const QString &ServicePath()
|
||||
static const QString &ObjectPath()
|
||||
{
|
||||
static QString s(BLACKCORE_CONTEXTVOICE_SERVICEPATH);
|
||||
static QString s(BLACKCORE_CONTEXTAUDIO_OBJECTPATH);
|
||||
return s;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief DBus version constructor
|
||||
* \param serviceName
|
||||
* \param connection
|
||||
* \brief Constructor
|
||||
* \param parent
|
||||
*/
|
||||
IContextVoice(const QString &serviceName, QDBusConnection &connection, QObject *parent = nullptr);
|
||||
IContextAudio(QObject *parent = nullptr) : QObject(parent) {}
|
||||
|
||||
/*!
|
||||
* Destructor
|
||||
*/
|
||||
~IContextVoice() {}
|
||||
virtual ~IContextAudio() {}
|
||||
|
||||
/*!
|
||||
* \brief Using local objects?
|
||||
* \return
|
||||
*/
|
||||
virtual bool usingLocalObjects() const { return false; }
|
||||
|
||||
private:
|
||||
BlackMisc::CGenericDBusInterface *m_dBusInterface;
|
||||
|
||||
/*!
|
||||
* Relay connection signals to local signals
|
||||
* No idea why this has to be wired and is not done automatically
|
||||
* \param connection
|
||||
*/
|
||||
void relaySignals(const QString &serviceName, QDBusConnection &connection);
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief IContextVoice
|
||||
* \param parent
|
||||
*/
|
||||
IContextVoice(QObject *parent = nullptr) : QObject(parent), m_dBusInterface(nullptr) {}
|
||||
|
||||
/*!
|
||||
* \brief Helper for logging, likely to be removed / changed
|
||||
* \param method
|
||||
* \param m1
|
||||
* \param m2
|
||||
* \param m3
|
||||
* \param m4
|
||||
*/
|
||||
void log(const QString &method, const QString &m1 = "", const QString &m2 = "", const QString &m3 = "", const QString &m4 = "") const;
|
||||
|
||||
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:
|
||||
* From this connection audio status can be obtained
|
||||
*/
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const;
|
||||
|
||||
/*!
|
||||
* Get voice rooms for COM1, COM2, but without latest audio status
|
||||
* \return all voice rooms
|
||||
*/
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const;
|
||||
|
||||
/*!
|
||||
* \brief COM 1 voice room
|
||||
* \param withAudioStatus update audio status
|
||||
* \return
|
||||
*/
|
||||
virtual BlackMisc::Audio::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const;
|
||||
|
||||
/*!
|
||||
* \brief COM 2 voice room
|
||||
* \param withAudioStatus update audio status
|
||||
* \return
|
||||
*/
|
||||
virtual BlackMisc::Audio::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const;
|
||||
|
||||
/*!
|
||||
* \brief Set voice rooms
|
||||
*/
|
||||
virtual void setComVoiceRooms(const BlackMisc::Audio::CVoiceRoom &voiceRoomCom1, const BlackMisc::Audio::CVoiceRoom &voiceRoomCom2);
|
||||
|
||||
/*!
|
||||
* Leave all voice rooms
|
||||
*/
|
||||
virtual void leaveAllVoiceRooms();
|
||||
|
||||
/*!
|
||||
* \brief COM1 room users callsigns
|
||||
*/
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom1RoomCallsigns() const;
|
||||
|
||||
/*!
|
||||
* \brief COM2 room users callsigns
|
||||
*/
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom2RoomCallsigns() const;
|
||||
|
||||
/*!
|
||||
* \brief COM1 room users
|
||||
*/
|
||||
virtual BlackMisc::Network::CUserList getCom1RoomUsers() const;
|
||||
|
||||
/*!
|
||||
* \brief COM2 room users
|
||||
*/
|
||||
virtual BlackMisc::Network::CUserList getCom2RoomUsers() const;
|
||||
|
||||
/*!
|
||||
* \brief Audio devices
|
||||
*/
|
||||
virtual BlackMisc::Audio::CAudioDeviceList getAudioDevices() const;
|
||||
|
||||
/*!
|
||||
* \brief Get current audio device
|
||||
* \return input and output devices
|
||||
*/
|
||||
virtual BlackMisc::Audio::CAudioDeviceList getCurrentAudioDevices() const;
|
||||
|
||||
/*!
|
||||
* \brief Set current audio device
|
||||
* \param audioDevice can be input or audio device
|
||||
*/
|
||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDevice &audioDevice);
|
||||
|
||||
/*!
|
||||
* \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?
|
||||
*/
|
||||
virtual bool isMuted() const;
|
||||
|
||||
/*!
|
||||
* \brief Play SELCAL tone
|
||||
*/
|
||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const;
|
||||
|
||||
/*!
|
||||
* \brief Play notification sound
|
||||
* \param notification CSoundGenerator::Notification
|
||||
*/
|
||||
virtual void playNotification(uint notification) const;
|
||||
|
||||
/*!
|
||||
* \brief Microphone test
|
||||
*/
|
||||
virtual void runMicrophoneTest();
|
||||
|
||||
/*!
|
||||
* \brief Microphone test
|
||||
*/
|
||||
virtual void runSquelchTest();
|
||||
|
||||
/*!
|
||||
* \brief Get the microphone test result
|
||||
*/
|
||||
virtual QString getMicrophoneTestResult() const;
|
||||
|
||||
/*!
|
||||
* \brief Get the squelch value
|
||||
*/
|
||||
virtual double getSquelchValue() const;
|
||||
virtual bool usingLocalObjects() const = 0;
|
||||
|
||||
signals:
|
||||
/*!
|
||||
* \brief Audio test has been completed
|
||||
*/
|
||||
void audioTestCompleted();
|
||||
|
||||
public slots:
|
||||
|
||||
/*!
|
||||
* Set my own identity for the voice rooms.
|
||||
* \remarks Actually at this time the callsign alone was sufficient. But pass the
|
||||
* whole aircraft object so further information are present if needed any time later.
|
||||
*/
|
||||
virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAiricraft) = 0;
|
||||
|
||||
/*!
|
||||
* Get voice rooms for COM1, COM2:
|
||||
* From this connection audio status can be obtained
|
||||
*/
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const = 0;
|
||||
|
||||
/*!
|
||||
* Get voice rooms for COM1, COM2, but without latest audio status
|
||||
* \return all voice rooms
|
||||
*/
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM 1 voice room
|
||||
* \param withAudioStatus update audio status
|
||||
* \return
|
||||
*/
|
||||
virtual BlackMisc::Audio::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM 2 voice room
|
||||
* \param withAudioStatus update audio status
|
||||
* \return
|
||||
*/
|
||||
virtual BlackMisc::Audio::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Set voice rooms
|
||||
*/
|
||||
virtual void setComVoiceRooms(const BlackMisc::Audio::CVoiceRoom &voiceRoomCom1, const BlackMisc::Audio::CVoiceRoom &voiceRoomCom2) = 0;
|
||||
|
||||
/*!
|
||||
* Leave all voice rooms
|
||||
*/
|
||||
virtual void leaveAllVoiceRooms() = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM1 room users callsigns
|
||||
*/
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom1RoomCallsigns() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM2 room users callsigns
|
||||
*/
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom2RoomCallsigns() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM1 room users
|
||||
*/
|
||||
virtual BlackMisc::Network::CUserList getCom1RoomUsers() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief COM2 room users
|
||||
*/
|
||||
virtual BlackMisc::Network::CUserList getCom2RoomUsers() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Audio devices
|
||||
*/
|
||||
virtual BlackMisc::Audio::CAudioDeviceList getAudioDevices() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Get current audio device
|
||||
* \return input and output devices
|
||||
*/
|
||||
virtual BlackMisc::Audio::CAudioDeviceList getCurrentAudioDevices() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Set current audio device
|
||||
* \param audioDevice can be input or audio device
|
||||
*/
|
||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDevice &audioDevice) = 0;
|
||||
|
||||
/*!
|
||||
* \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) = 0;
|
||||
|
||||
/*!
|
||||
* \brief Is muted?
|
||||
*/
|
||||
virtual bool isMuted() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Play SELCAL tone
|
||||
*/
|
||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Play notification sound
|
||||
* \param notification CSoundGenerator::Notification
|
||||
*/
|
||||
virtual void playNotification(uint notification) const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Microphone test
|
||||
*/
|
||||
virtual void runMicrophoneTest() = 0;
|
||||
|
||||
/*!
|
||||
* \brief Microphone test
|
||||
*/
|
||||
virtual void runSquelchTest() = 0;
|
||||
|
||||
/*!
|
||||
* \brief Get the microphone test result
|
||||
*/
|
||||
virtual QString getMicrophoneTestResult() const = 0;
|
||||
|
||||
/*!
|
||||
* \brief Get the squelch value
|
||||
*/
|
||||
virtual double getSquelchValue() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "context_voice.h"
|
||||
#include "context_audio_impl.h"
|
||||
#include "context_network.h"
|
||||
#include "coreruntime.h"
|
||||
#include "../blacksound/soundgenerator.h"
|
||||
|
||||
#include "blacksound/soundgenerator.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -18,22 +21,20 @@ namespace BlackCore
|
||||
/*
|
||||
* Init this context
|
||||
*/
|
||||
CContextVoice::CContextVoice(CCoreRuntime *runtime) : IContextVoice(runtime), m_voice(nullptr)
|
||||
CContextAudio::CContextAudio(QObject *parent) : IContextAudio(parent), m_voice(nullptr)
|
||||
{
|
||||
Q_ASSERT(runtime);
|
||||
|
||||
// 1. Init by "voice driver"
|
||||
this->m_voice = new CVoiceVatlib(this);
|
||||
|
||||
// 2. Signal / slots
|
||||
connect(this->m_voice, &CVoiceVatlib::micTestFinished, this, &CContextVoice::audioTestCompleted);
|
||||
connect(this->m_voice, &CVoiceVatlib::squelchTestFinished, this, &CContextVoice::audioTestCompleted);
|
||||
connect(this->m_voice, &CVoiceVatlib::micTestFinished, this, &CContextAudio::audioTestCompleted);
|
||||
connect(this->m_voice, &CVoiceVatlib::squelchTestFinished, this, &CContextAudio::audioTestCompleted);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleanup
|
||||
*/
|
||||
CContextVoice::~CContextVoice()
|
||||
CContextAudio::~CContextAudio()
|
||||
{
|
||||
this->leaveAllVoiceRooms();
|
||||
}
|
||||
@@ -41,7 +42,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Own aircraft
|
||||
*/
|
||||
void CContextVoice::setOwnAircraft(const CAircraft &ownAircraft)
|
||||
void CContextAudio::setOwnAircraft(const CAircraft &ownAircraft)
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
this->m_voice->setMyAircraftCallsign(ownAircraft.getCallsign());
|
||||
@@ -50,7 +51,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Voice rooms for COM
|
||||
*/
|
||||
CVoiceRoomList CContextVoice::getComVoiceRoomsWithAudioStatus() const
|
||||
CVoiceRoomList CContextAudio::getComVoiceRoomsWithAudioStatus() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
return this->m_voice->getComVoiceRoomsWithAudioStatus();
|
||||
@@ -59,7 +60,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Voice rooms for COM
|
||||
*/
|
||||
CVoiceRoom CContextVoice::getCom1VoiceRoom(bool withAudioStatus) const
|
||||
CVoiceRoom CContextAudio::getCom1VoiceRoom(bool withAudioStatus) const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
if (withAudioStatus)
|
||||
@@ -71,7 +72,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Voice rooms for COM
|
||||
*/
|
||||
CVoiceRoom CContextVoice::getCom2VoiceRoom(bool withAudioStatus) const
|
||||
CVoiceRoom CContextAudio::getCom2VoiceRoom(bool withAudioStatus) const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
if (withAudioStatus)
|
||||
@@ -83,7 +84,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Voice rooms for COM (const)
|
||||
*/
|
||||
CVoiceRoomList CContextVoice::getComVoiceRooms() const
|
||||
CVoiceRoomList CContextAudio::getComVoiceRooms() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
return this->m_voice->getComVoiceRooms();
|
||||
@@ -92,7 +93,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Leave all voice rooms
|
||||
*/
|
||||
void CContextVoice::leaveAllVoiceRooms()
|
||||
void CContextAudio::leaveAllVoiceRooms()
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
this->m_voice->leaveAllVoiceRooms();
|
||||
@@ -101,7 +102,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Audio devices
|
||||
*/
|
||||
CAudioDeviceList CContextVoice::getAudioDevices() const
|
||||
CAudioDeviceList CContextAudio::getAudioDevices() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
return this->m_voice->audioDevices();
|
||||
@@ -110,7 +111,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Audio default devices
|
||||
*/
|
||||
CAudioDeviceList CContextVoice::getCurrentAudioDevices() const
|
||||
CAudioDeviceList CContextAudio::getCurrentAudioDevices() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
CAudioDeviceList devices;
|
||||
@@ -122,7 +123,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Set current device
|
||||
*/
|
||||
void CContextVoice::setCurrentAudioDevice(const CAudioDevice &audioDevice)
|
||||
void CContextAudio::setCurrentAudioDevice(const CAudioDevice &audioDevice)
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(audioDevice.getType() != CAudioDevice::Unknown);
|
||||
@@ -139,7 +140,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Set volumes
|
||||
*/
|
||||
void CContextVoice::setVolumes(const CComSystem &com1, const CComSystem &com2)
|
||||
void CContextAudio::setVolumes(const CComSystem &com1, const CComSystem &com2)
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
this->m_voice->setRoomOutputVolume(IVoice::COM1, com1.getVolumeOutput());
|
||||
@@ -151,7 +152,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Muted?
|
||||
*/
|
||||
bool CContextVoice::isMuted() const
|
||||
bool CContextAudio::isMuted() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
return this->m_voice->isMuted();
|
||||
@@ -160,7 +161,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Set voice rooms
|
||||
*/
|
||||
void CContextVoice::setComVoiceRooms(const CVoiceRoom &voiceRoomCom1, const CVoiceRoom &voiceRoomCom2)
|
||||
void CContextAudio::setComVoiceRooms(const CVoiceRoom &voiceRoomCom1, const CVoiceRoom &voiceRoomCom2)
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
CVoiceRoomList currentRooms = this->m_voice->getComVoiceRoomsWithAudioStatus();
|
||||
@@ -181,7 +182,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Room 1 callsigns
|
||||
*/
|
||||
CCallsignList CContextVoice::getCom1RoomCallsigns() const
|
||||
CCallsignList CContextAudio::getCom1RoomCallsigns() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
return this->m_voice->getVoiceRoomCallsigns(IVoice::COM1);
|
||||
@@ -190,7 +191,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Room 2 callsigns
|
||||
*/
|
||||
CCallsignList CContextVoice::getCom2RoomCallsigns() const
|
||||
CCallsignList CContextAudio::getCom2RoomCallsigns() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
return this->m_voice->getVoiceRoomCallsigns(IVoice::COM2);
|
||||
@@ -199,7 +200,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Room 1 users
|
||||
*/
|
||||
Network::CUserList CContextVoice::getCom1RoomUsers() const
|
||||
Network::CUserList CContextAudio::getCom1RoomUsers() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(this->getRuntime());
|
||||
@@ -211,7 +212,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Room 2 users
|
||||
*/
|
||||
Network::CUserList CContextVoice::getCom2RoomUsers() const
|
||||
Network::CUserList CContextAudio::getCom2RoomUsers() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(this->getRuntime());
|
||||
@@ -223,7 +224,7 @@ namespace BlackCore
|
||||
/*
|
||||
* SELCAL tone
|
||||
*/
|
||||
void CContextVoice::playSelcalTone(const CSelcal &selcal) const
|
||||
void CContextAudio::playSelcalTone(const CSelcal &selcal) const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
CAudioDevice outputDevice = m_voice->getCurrentOutputDevice();
|
||||
@@ -233,7 +234,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Notification
|
||||
*/
|
||||
void CContextVoice::playNotification(uint notification) const
|
||||
void CContextAudio::playNotification(uint notification) const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
BlackSound::CSoundGenerator::playNotificationSound(90, static_cast<BlackSound::CSoundGenerator::Notification>(notification));
|
||||
@@ -242,7 +243,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Mic test.
|
||||
*/
|
||||
void CContextVoice::runMicrophoneTest()
|
||||
void CContextAudio::runMicrophoneTest()
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
this->m_voice->runMicrophoneTest();
|
||||
@@ -251,7 +252,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Squelch test.
|
||||
*/
|
||||
void CContextVoice::runSquelchTest()
|
||||
void CContextAudio::runSquelchTest()
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
this->m_voice->runSquelchTest();
|
||||
@@ -260,7 +261,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Microphone test
|
||||
*/
|
||||
QString CContextVoice::getMicrophoneTestResult() const
|
||||
QString CContextAudio::getMicrophoneTestResult() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
return this->m_voice->micTestResultAsString();
|
||||
@@ -269,7 +270,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Squelch value
|
||||
*/
|
||||
double CContextVoice::getSquelchValue() const
|
||||
double CContextAudio::getSquelchValue() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
return static_cast<double>(this->m_voice->inputSquelch());
|
||||
@@ -3,46 +3,29 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef BLACKCORE_CONTEXTVOICE_H
|
||||
#define BLACKCORE_CONTEXTVOICE_H
|
||||
#ifndef BLACKCORE_CONTEXTAUDIO_IMPL_H
|
||||
#define BLACKCORE_CONTEXTAUDIO_IMPL_H
|
||||
|
||||
#include "blackcore/dbus_server.h"
|
||||
#include "blackcore/voice_vatlib.h"
|
||||
#include "blackcore/context_voice_interface.h"
|
||||
#include "blackmisc/avallclasses.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/nwuserlist.h"
|
||||
#include "blackcore/coreruntime.h"
|
||||
#include <QObject>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QTimer>
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
|
||||
#define BLACKCORE_CONTEXTVOICE_INTERFACENAME "blackcore.contextvoice"
|
||||
#include "context_audio.h"
|
||||
#include "coreruntime.h"
|
||||
#include "dbus_server.h"
|
||||
#include "voice_vatlib.h"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
/*!
|
||||
* \brief Network context
|
||||
*/
|
||||
class CContextVoice : public IContextVoice
|
||||
//! \brief Audio context implementation
|
||||
class CContextAudio : public IContextAudio
|
||||
{
|
||||
// Register by same name, make signals sender independent
|
||||
// http://dbus.freedesktop.org/doc/dbus-faq.html#idp48032144
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTVOICE_INTERFACENAME)
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTAUDIO_INTERFACENAME)
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! \brief Constructor
|
||||
CContextVoice(CCoreRuntime *runtime);
|
||||
CContextAudio(QObject *runtime);
|
||||
|
||||
//! \brief Destructor
|
||||
virtual ~CContextVoice();
|
||||
virtual ~CContextAudio();
|
||||
|
||||
/*!
|
||||
* \brief Register myself in DBus
|
||||
@@ -50,83 +33,90 @@ namespace BlackCore
|
||||
*/
|
||||
void registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
server->addObject(IContextVoice::ServicePath(), this);
|
||||
Q_ASSERT(server);
|
||||
server->addObject(IContextAudio::ObjectPath(), this);
|
||||
}
|
||||
|
||||
//! \brief Runtime
|
||||
CCoreRuntime *getRuntime()
|
||||
{
|
||||
return static_cast<CCoreRuntime *>(this->parent());
|
||||
}
|
||||
|
||||
//! \brief Const runtime
|
||||
const CCoreRuntime *getRuntime() const
|
||||
{
|
||||
return static_cast<CCoreRuntime *>(this->parent());
|
||||
}
|
||||
|
||||
//! \brief Using local objects?
|
||||
virtual bool usingLocalObjects() const { return true; }
|
||||
//! \copydoc IContextAudio::usingLocalObjects()
|
||||
virtual bool usingLocalObjects() const override { return true; }
|
||||
|
||||
public slots:
|
||||
//! \copydoc IContextVoice::setOwnAircraft
|
||||
//! \copydoc IContextAudio::setOwnAircraft()
|
||||
virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft) override;
|
||||
|
||||
//! \copydoc IContextVoice::getComVoiceRooms()
|
||||
//! \copydoc IContextAudio::getComVoiceRooms()
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRooms() const override;
|
||||
|
||||
//! \copydoc IContextVoice::getComVoiceRoomsWithAudioStatus()
|
||||
//! \copydoc IContextAudio::getComVoiceRoomsWithAudioStatus()
|
||||
virtual BlackMisc::Audio::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const override;
|
||||
|
||||
//! \copydoc IContextVoice::getCom1VoiceRoom
|
||||
//! \copydoc IContextAudio::getCom1VoiceRoom
|
||||
virtual BlackMisc::Audio::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const override;
|
||||
|
||||
//! \copydoc IContextVoice::getCom2VoiceRoom
|
||||
//! \copydoc IContextAudio::getCom2VoiceRoom
|
||||
virtual BlackMisc::Audio::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const override;
|
||||
|
||||
//! \copydoc IContextVoice::setComVoiceRooms()
|
||||
//! \copydoc IContextAudio::setComVoiceRooms()
|
||||
virtual void setComVoiceRooms(const BlackMisc::Audio::CVoiceRoom &voiceRoomCom1, const BlackMisc::Audio::CVoiceRoom &voiceRoomCom2) override;
|
||||
|
||||
//! \copydoc IContextVoice::getCom1RoomCallsigns()
|
||||
//! \copydoc IContextAudio::getCom1RoomCallsigns()
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom1RoomCallsigns() const override;
|
||||
|
||||
//! \copydoc IContextVoice::getCom2RoomCallsigns()
|
||||
//! \copydoc IContextAudio::getCom2RoomCallsigns()
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom2RoomCallsigns() const override;
|
||||
|
||||
//! \copydoc IContextVoice::getCom1RoomUsers()
|
||||
//! \copydoc IContextAudio::getCom1RoomUsers()
|
||||
virtual BlackMisc::Network::CUserList getCom1RoomUsers() const override;
|
||||
|
||||
//! \copydoc IContextVoice::getCom2RoomUsers()
|
||||
//! \copydoc IContextAudio::getCom2RoomUsers()
|
||||
virtual BlackMisc::Network::CUserList getCom2RoomUsers() const override;
|
||||
|
||||
//! \copydoc IContextVoice::leaveAllVoiceRooms
|
||||
//! \copydoc IContextAudio::leaveAllVoiceRooms
|
||||
virtual void leaveAllVoiceRooms() override;
|
||||
|
||||
//! \copydoc IContextVoice::getAudioDevices()
|
||||
//! \copydoc IContextAudio::getAudioDevices()
|
||||
virtual BlackMisc::Audio::CAudioDeviceList getAudioDevices() const override;
|
||||
|
||||
//! \copydoc IContextVoice::getCurrentAudioDevices()
|
||||
//! \copydoc IContextAudio::getCurrentAudioDevices()
|
||||
virtual BlackMisc::Audio::CAudioDeviceList getCurrentAudioDevices() const override;
|
||||
|
||||
//! \copydoc IContextVoice::setCurrentAudioDevice()
|
||||
//! \copydoc IContextAudio::setCurrentAudioDevice()
|
||||
virtual void setCurrentAudioDevice(const BlackMisc::Audio::CAudioDevice &audioDevice) override;
|
||||
|
||||
//! \copydoc IContextVoice::setVolumes()
|
||||
//! \copydoc IContextAudio::setVolumes()
|
||||
virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2) override;
|
||||
|
||||
//! \copydoc IContextVoice::isMuted()
|
||||
//! \copydoc IContextAudio::isMuted()
|
||||
virtual bool isMuted() const override;
|
||||
|
||||
//! \copydoc IContextVoice::playSelcalTone()
|
||||
//! \copydoc IContextAudio::playSelcalTone()
|
||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
|
||||
|
||||
//! \copydoc IContextVoice::playNotification()
|
||||
//! \copydoc IContextAudio::playNotification()
|
||||
virtual void playNotification(uint notification) const override;
|
||||
|
||||
//! \copydoc IContextVoice::runMicrophoneTest()
|
||||
//! \copydoc IContextAudio::runMicrophoneTest()
|
||||
virtual void runMicrophoneTest() override;
|
||||
|
||||
//! \copydoc IContextVoice::runSquelchTest()
|
||||
//! \copydoc IContextAudio::runSquelchTest()
|
||||
virtual void runSquelchTest() override;
|
||||
|
||||
//! \copydoc IContextVoice::getMicrophoneTestResult()
|
||||
//! \copydoc IContextAudio::getMicrophoneTestResult()
|
||||
virtual QString getMicrophoneTestResult() const override;
|
||||
|
||||
//! \copydoc IContextVoice::getSquelchValue()
|
||||
//! \copydoc IContextAudio::getSquelchValue()
|
||||
virtual double getSquelchValue() const override;
|
||||
|
||||
private:
|
||||
@@ -3,8 +3,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "blackcore/context_voice_interface.h"
|
||||
#include <QObject>
|
||||
#include "context_audio_proxy.h"
|
||||
#include <QDBusConnection>
|
||||
|
||||
using namespace BlackMisc::Audio;
|
||||
@@ -17,25 +16,27 @@ namespace BlackCore
|
||||
/*
|
||||
* Constructor for DBus
|
||||
*/
|
||||
IContextVoice::IContextVoice(const QString &serviceName, QDBusConnection &connection, QObject *parent) : QObject(parent), m_dBusInterface(0)
|
||||
CContextAudioProxy::CContextAudioProxy(const QString &serviceName, QDBusConnection &connection, QObject *parent) : IContextAudio(parent), m_dBusInterface(nullptr)
|
||||
{
|
||||
this->m_dBusInterface = new BlackMisc::CGenericDBusInterface(serviceName , IContextVoice::ServicePath(), IContextVoice::InterfaceName(), connection, this);
|
||||
this->m_dBusInterface = new BlackMisc::CGenericDBusInterface(
|
||||
serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
connection, this);
|
||||
this->relaySignals(serviceName, connection);
|
||||
}
|
||||
|
||||
/*
|
||||
* Workaround for signals, not working without, but why?
|
||||
*/
|
||||
void IContextVoice::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
void CContextAudioProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
{
|
||||
connection.connect(serviceName, IContextVoice::ServicePath(), IContextVoice::InterfaceName(),
|
||||
connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"audioTestCompleted", this, SIGNAL(audioTestCompleted()));
|
||||
}
|
||||
|
||||
/*
|
||||
* Own aircraft
|
||||
*/
|
||||
void IContextVoice::setOwnAircraft(const CAircraft &ownAircraft)
|
||||
void CContextAudioProxy::setOwnAircraft(const CAircraft &ownAircraft)
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("setOwnAircraft"), ownAircraft);
|
||||
}
|
||||
@@ -43,7 +44,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Leave all voice rooms
|
||||
*/
|
||||
void IContextVoice::leaveAllVoiceRooms()
|
||||
void CContextAudioProxy::leaveAllVoiceRooms()
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("leaveAllVoiceRooms"));
|
||||
}
|
||||
@@ -51,7 +52,7 @@ namespace BlackCore
|
||||
/*
|
||||
* COM1 callsigns
|
||||
*/
|
||||
BlackMisc::Aviation::CCallsignList IContextVoice::getCom1RoomCallsigns() const
|
||||
BlackMisc::Aviation::CCallsignList CContextAudioProxy::getCom1RoomCallsigns() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Aviation::CCallsignList>(QLatin1Literal("getCom1RoomCallsigns"));
|
||||
}
|
||||
@@ -59,7 +60,7 @@ namespace BlackCore
|
||||
/*
|
||||
* COM2 callsigns
|
||||
*/
|
||||
BlackMisc::Aviation::CCallsignList IContextVoice::getCom2RoomCallsigns() const
|
||||
BlackMisc::Aviation::CCallsignList CContextAudioProxy::getCom2RoomCallsigns() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Aviation::CCallsignList>(QLatin1Literal("getCom2RoomCallsigns"));
|
||||
}
|
||||
@@ -67,7 +68,7 @@ namespace BlackCore
|
||||
/*
|
||||
* COM1 users
|
||||
*/
|
||||
BlackMisc::Network::CUserList IContextVoice::getCom1RoomUsers() const
|
||||
BlackMisc::Network::CUserList CContextAudioProxy::getCom1RoomUsers() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Network::CUserList>(QLatin1Literal("getCom1RoomUsers"));
|
||||
}
|
||||
@@ -75,7 +76,7 @@ namespace BlackCore
|
||||
/*
|
||||
* COM2 users
|
||||
*/
|
||||
BlackMisc::Network::CUserList IContextVoice::getCom2RoomUsers() const
|
||||
BlackMisc::Network::CUserList CContextAudioProxy::getCom2RoomUsers() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<BlackMisc::Network::CUserList>(QLatin1Literal("getCom2RoomUsers"));
|
||||
}
|
||||
@@ -83,7 +84,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Audio devices
|
||||
*/
|
||||
CAudioDeviceList IContextVoice::getAudioDevices() const
|
||||
CAudioDeviceList CContextAudioProxy::getAudioDevices() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<CAudioDeviceList>(QLatin1Literal("getAudioDevices"));
|
||||
}
|
||||
@@ -91,7 +92,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Get current audio devices
|
||||
*/
|
||||
BlackMisc::Audio::CAudioDeviceList IContextVoice::getCurrentAudioDevices() const
|
||||
BlackMisc::Audio::CAudioDeviceList CContextAudioProxy::getCurrentAudioDevices() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<CAudioDeviceList>(QLatin1Literal("getCurrentAudioDevices"));
|
||||
}
|
||||
@@ -99,7 +100,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Set current audio device
|
||||
*/
|
||||
void IContextVoice::setCurrentAudioDevice(const CAudioDevice &audioDevice)
|
||||
void CContextAudioProxy::setCurrentAudioDevice(const CAudioDevice &audioDevice)
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("setCurrentAudioDevice"), audioDevice);
|
||||
}
|
||||
@@ -107,7 +108,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Voice rooms, with audio status
|
||||
*/
|
||||
CVoiceRoomList IContextVoice::getComVoiceRoomsWithAudioStatus() const
|
||||
CVoiceRoomList CContextAudioProxy::getComVoiceRoomsWithAudioStatus() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<CVoiceRoomList>(QLatin1Literal("getComVoiceRoomsWithAudioStatus"));
|
||||
}
|
||||
@@ -115,7 +116,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Voice rooms, without audio status
|
||||
*/
|
||||
CVoiceRoomList IContextVoice::getComVoiceRooms() const
|
||||
CVoiceRoomList CContextAudioProxy::getComVoiceRooms() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<CVoiceRoomList>(QLatin1Literal("getComVoiceRooms"));
|
||||
}
|
||||
@@ -123,7 +124,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Voice room
|
||||
*/
|
||||
CVoiceRoom IContextVoice::getCom1VoiceRoom(bool withAudioStatus) const
|
||||
CVoiceRoom CContextAudioProxy::getCom1VoiceRoom(bool withAudioStatus) const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<CVoiceRoom>(QLatin1Literal("getCom1VoiceRoom"), withAudioStatus);
|
||||
}
|
||||
@@ -131,7 +132,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Voice room
|
||||
*/
|
||||
CVoiceRoom IContextVoice::getCom2VoiceRoom(bool withAudioStatus) const
|
||||
CVoiceRoom CContextAudioProxy::getCom2VoiceRoom(bool withAudioStatus) const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<CVoiceRoom>(QLatin1Literal("getCom2VoiceRoom"), withAudioStatus);
|
||||
}
|
||||
@@ -139,7 +140,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Set voice rooms
|
||||
*/
|
||||
void IContextVoice::setComVoiceRooms(const BlackMisc::Audio::CVoiceRoom &voiceRoomCom1, const BlackMisc::Audio::CVoiceRoom &voiceRoomCom2)
|
||||
void CContextAudioProxy::setComVoiceRooms(const BlackMisc::Audio::CVoiceRoom &voiceRoomCom1, const BlackMisc::Audio::CVoiceRoom &voiceRoomCom2)
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("setComVoiceRooms"), voiceRoomCom1, voiceRoomCom2);
|
||||
}
|
||||
@@ -147,7 +148,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Play SELCAL tone
|
||||
*/
|
||||
void IContextVoice::playSelcalTone(const CSelcal &selcal) const
|
||||
void CContextAudioProxy::playSelcalTone(const CSelcal &selcal) const
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("playSelcalTone"), selcal);
|
||||
}
|
||||
@@ -155,7 +156,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Notification sound
|
||||
*/
|
||||
void IContextVoice::playNotification(uint notification) const
|
||||
void CContextAudioProxy::playNotification(uint notification) const
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("playNotification"), notification);
|
||||
}
|
||||
@@ -163,7 +164,7 @@ namespace BlackCore
|
||||
/*
|
||||
* MIC test
|
||||
*/
|
||||
void IContextVoice::runMicrophoneTest()
|
||||
void CContextAudioProxy::runMicrophoneTest()
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("runMicrophoneTest"));
|
||||
}
|
||||
@@ -171,7 +172,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Mic test
|
||||
*/
|
||||
void IContextVoice::runSquelchTest()
|
||||
void CContextAudioProxy::runSquelchTest()
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("runSquelchTest"));
|
||||
}
|
||||
@@ -179,7 +180,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Test result
|
||||
*/
|
||||
QString IContextVoice::getMicrophoneTestResult() const
|
||||
QString CContextAudioProxy::getMicrophoneTestResult() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<QString>(QLatin1Literal("getMicrophoneTestResult"));
|
||||
}
|
||||
@@ -187,7 +188,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Squelch value
|
||||
*/
|
||||
double IContextVoice::getSquelchValue() const
|
||||
double CContextAudioProxy::getSquelchValue() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<double>(QLatin1Literal("getSquelchValue"));
|
||||
}
|
||||
@@ -195,7 +196,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Volumes, by COM systems
|
||||
*/
|
||||
void IContextVoice::setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2)
|
||||
void CContextAudioProxy::setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2)
|
||||
{
|
||||
this->m_dBusInterface->callDBus(QLatin1Literal("setVolumes"), com1, com2);
|
||||
}
|
||||
@@ -203,7 +204,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Muted?
|
||||
*/
|
||||
bool IContextVoice::isMuted() const
|
||||
bool CContextAudioProxy::isMuted() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isMuted"));
|
||||
}
|
||||
@@ -211,7 +212,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Logging
|
||||
*/
|
||||
void IContextVoice::log(const QString &method, const QString &m1, const QString &m2, const QString &m3, const QString &m4) const
|
||||
void CContextAudioProxy::log(const QString &method, const QString &m1, const QString &m2, const QString &m3, const QString &m4) const
|
||||
{
|
||||
if (m1.isEmpty())
|
||||
qDebug() << " LOG: " << method;
|
||||
141
src/blackcore/context_audio_proxy.h
Normal file
141
src/blackcore/context_audio_proxy.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/* Copyright (C) 2013x VATSIM Community / authors
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef BLACKCORE_CONTEXTVOICE_PROXY_H
|
||||
#define BLACKCORE_CONTEXTVOICE_PROXY_H
|
||||
|
||||
#include "context_audio.h"
|
||||
|
||||
#include "blackmisc/genericdbusinterface.h"
|
||||
#include "blackmisc/vaudiodevicelist.h"
|
||||
#include "blackmisc/vvoiceroomlist.h"
|
||||
#include "blackmisc/nwuserlist.h"
|
||||
#include "blackmisc/avaircraft.h"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
//! \brief Audio context proxy
|
||||
class CContextAudioProxy : public IContextAudio
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTAUDIO_INTERFACENAME)
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* \brief DBus version constructor
|
||||
* \param serviceName
|
||||
* \param connection
|
||||
* \param parent
|
||||
*/
|
||||
CContextAudioProxy(const QString &serviceName, QDBusConnection &connection, QObject *parent = nullptr);
|
||||
|
||||
/*!
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~CContextAudioProxy() {}
|
||||
|
||||
//! \copydoc IContextVoice::usingLocalObjects()
|
||||
virtual bool usingLocalObjects() const override { return false; }
|
||||
|
||||
private:
|
||||
BlackMisc::CGenericDBusInterface *m_dBusInterface;
|
||||
|
||||
/*!
|
||||
* Relay connection signals to local signals
|
||||
* No idea why this has to be wired and is not done automatically
|
||||
* \param connection
|
||||
*/
|
||||
void relaySignals(const QString &serviceName, QDBusConnection &connection);
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* \brief IContextVoice
|
||||
* \param parent
|
||||
*/
|
||||
CContextAudioProxy(QObject *parent = nullptr) : IContextAudio(parent), m_dBusInterface(nullptr) {}
|
||||
|
||||
/*!
|
||||
* \brief Helper for logging, likely to be removed / changed
|
||||
* \param method
|
||||
* \param m1
|
||||
* \param m2
|
||||
* \param m3
|
||||
* \param m4
|
||||
*/
|
||||
void log(const QString &method, const QString &m1 = "", const QString &m2 = "", const QString &m3 = "", const QString &m4 = "") const;
|
||||
|
||||
public slots:
|
||||
|
||||
//! \copydoc IContextAudio::setOwnAircraft()
|
||||
virtual void setOwnAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft) override;
|
||||
|
||||
//! \copydoc IContextAudio::getComVoiceRooms()
|
||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRooms() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getComVoiceRoomsWithAudioStatus()
|
||||
virtual BlackMisc::Voice::CVoiceRoomList getComVoiceRoomsWithAudioStatus() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getCom1VoiceRoom
|
||||
virtual BlackMisc::Voice::CVoiceRoom getCom1VoiceRoom(bool withAudioStatus) const override;
|
||||
|
||||
//! \copydoc IContextAudio::getCom2VoiceRoom
|
||||
virtual BlackMisc::Voice::CVoiceRoom getCom2VoiceRoom(bool withAudioStatus) const override;
|
||||
|
||||
//! \copydoc IContextAudio::setComVoiceRooms()
|
||||
virtual void setComVoiceRooms(const BlackMisc::Voice::CVoiceRoom &voiceRoomCom1, const BlackMisc::Voice::CVoiceRoom &voiceRoomCom2) override;
|
||||
|
||||
//! \copydoc IContextAudio::getCom1RoomCallsigns()
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom1RoomCallsigns() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getCom2RoomCallsigns()
|
||||
virtual BlackMisc::Aviation::CCallsignList getCom2RoomCallsigns() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getCom1RoomUsers()
|
||||
virtual BlackMisc::Network::CUserList getCom1RoomUsers() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getCom2RoomUsers()
|
||||
virtual BlackMisc::Network::CUserList getCom2RoomUsers() const override;
|
||||
|
||||
//! \copydoc IContextAudio::leaveAllVoiceRooms
|
||||
virtual void leaveAllVoiceRooms() override;
|
||||
|
||||
//! \copydoc IContextAudio::getAudioDevices()
|
||||
virtual BlackMisc::Voice::CAudioDeviceList getAudioDevices() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getCurrentAudioDevices()
|
||||
virtual BlackMisc::Voice::CAudioDeviceList getCurrentAudioDevices() const override;
|
||||
|
||||
//! \copydoc IContextAudio::setCurrentAudioDevice()
|
||||
virtual void setCurrentAudioDevice(const BlackMisc::Voice::CAudioDevice &audioDevice) override;
|
||||
|
||||
//! \copydoc IContextAudio::setVolumes()
|
||||
virtual void setVolumes(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2) override;
|
||||
|
||||
//! \copydoc IContextAudio::isMuted()
|
||||
virtual bool isMuted() const override;
|
||||
|
||||
//! \copydoc IContextAudio::playSelcalTone()
|
||||
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
|
||||
|
||||
//! \copydoc IContextAudio::playNotification()
|
||||
virtual void playNotification(uint notification) const override;
|
||||
|
||||
//! \copydoc IContextAudio::runMicrophoneTest()
|
||||
virtual void runMicrophoneTest() override;
|
||||
|
||||
//! \copydoc IContextAudio::runSquelchTest()
|
||||
virtual void runSquelchTest() override;
|
||||
|
||||
//! \copydoc IContextAudio::getMicrophoneTestResult()
|
||||
virtual QString getMicrophoneTestResult() const override;
|
||||
|
||||
//! \copydoc IContextAudio::getSquelchValue()
|
||||
virtual double getSquelchValue() const override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "blackcore/coreruntime.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include "blackmisc/nwserver.h"
|
||||
#include "blackcore/context_application.h"
|
||||
#include "blackcore/context_application_impl.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackcore/context_voice.h"
|
||||
#include "blackcore/context_audio_impl.h"
|
||||
#include "blackcore/context_simulator_impl.h"
|
||||
|
||||
namespace BlackCore
|
||||
@@ -14,7 +14,7 @@ namespace BlackCore
|
||||
*/
|
||||
CCoreRuntime::CCoreRuntime(bool withDbus, QObject *parent) :
|
||||
QObject(parent), m_init(false), m_dbusServer(nullptr),
|
||||
m_contextNetwork(nullptr), m_contextVoice(nullptr),
|
||||
m_contextNetwork(nullptr), m_contextAudio(nullptr),
|
||||
m_contextSettings(nullptr), m_contextApplication(nullptr),
|
||||
m_contextSimulator(nullptr)
|
||||
{
|
||||
@@ -46,8 +46,8 @@ void CCoreRuntime::init(bool withDbus)
|
||||
this->m_contextApplication = new CContextApplication(this);
|
||||
if (withDbus) this->m_contextApplication->registerWithDBus(this->m_dbusServer);
|
||||
|
||||
this->m_contextVoice = new CContextVoice(this);
|
||||
if (withDbus) this->m_contextVoice->registerWithDBus(this->m_dbusServer);
|
||||
this->m_contextAudio = new CContextAudio(this);
|
||||
if (withDbus) this->m_contextAudio->registerWithDBus(this->m_dbusServer);
|
||||
|
||||
this->m_contextSimulator = new CContextSimulator(this);
|
||||
if (withDbus) this->m_contextSimulator->registerWithDBus(this->m_dbusServer);
|
||||
@@ -66,14 +66,14 @@ const IContextNetwork *CCoreRuntime::getIContextNetwork() const
|
||||
return this->m_contextNetwork;
|
||||
}
|
||||
|
||||
IContextVoice *CCoreRuntime::getIContextVoice()
|
||||
IContextAudio *CCoreRuntime::getIContextAudio()
|
||||
{
|
||||
return this->m_contextVoice;
|
||||
return this->m_contextAudio;
|
||||
}
|
||||
|
||||
const IContextVoice *CCoreRuntime::getIContextVoice() const
|
||||
const IContextAudio *CCoreRuntime::getIContextAudio() const
|
||||
{
|
||||
return this->m_contextVoice;
|
||||
return this->m_contextAudio;
|
||||
}
|
||||
|
||||
IContextSettings *CCoreRuntime::getIContextSettings()
|
||||
|
||||
@@ -9,12 +9,12 @@ namespace BlackCore
|
||||
// https://dev.vatsim-germany.org/boards/22/topics/1350?r=1359#message-1359
|
||||
class CDBusServer;
|
||||
class CContextNetwork;
|
||||
class CContextVoice;
|
||||
class CContextAudio;
|
||||
class CContextSettings;
|
||||
class CContextApplication;
|
||||
class CContextSimulator;
|
||||
class IContextNetwork;
|
||||
class IContextVoice;
|
||||
class IContextAudio;
|
||||
class IContextSettings;
|
||||
class IContextApplication;
|
||||
class IContextSimulator;
|
||||
@@ -30,7 +30,7 @@ private:
|
||||
bool m_init; /*!< flag */
|
||||
CDBusServer *m_dbusServer;
|
||||
CContextNetwork *m_contextNetwork;
|
||||
CContextVoice *m_contextVoice;
|
||||
CContextAudio *m_contextAudio;
|
||||
CContextSettings *m_contextSettings;
|
||||
CContextApplication *m_contextApplication;
|
||||
CContextSimulator *m_contextSimulator;
|
||||
@@ -79,13 +79,13 @@ public:
|
||||
* \brief Context for network
|
||||
* \return
|
||||
*/
|
||||
IContextVoice *getIContextVoice();
|
||||
IContextAudio *getIContextAudio();
|
||||
|
||||
/*!
|
||||
* \brief Context for network
|
||||
* \return
|
||||
*/
|
||||
const IContextVoice *getIContextVoice() const;
|
||||
const IContextAudio *getIContextAudio() const;
|
||||
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user