refs #255 update context and sample to use the new IVoiceChannel API

This commit is contained in:
Roland Winklmeier
2014-07-23 13:28:18 +01:00
parent c05b8808b8
commit ff65f3f39d
4 changed files with 136 additions and 70 deletions

View File

@@ -21,15 +21,16 @@ Client::Client(QObject *parent) :
{ {
m_voice->moveToThread(&m_threadVoice); m_voice->moveToThread(&m_threadVoice);
m_threadVoice.start(); m_threadVoice.start();
m_channelCom1 = m_voice->getVoiceChannel(0);
using namespace BlackCore; using namespace BlackCore;
connect(m_voice, &IVoice::squelchTestFinished, this, &Client::onSquelchTestFinished); connect(m_voice, &IVoice::squelchTestFinished, this, &Client::onSquelchTestFinished);
connect(m_voice, &IVoice::micTestFinished, this, &Client::onMicTestFinished); connect(m_voice, &IVoice::micTestFinished, this, &Client::onMicTestFinished);
connect(m_voice, &IVoice::connectionStatusChanged, this, &Client::connectionStatusChanged); connect(m_channelCom1.data(), &IVoiceChannel::connectionStatusChanged, this, &Client::connectionStatusChanged);
connect(m_voice, &IVoice::audioStarted, this, &Client::audioStartedStream); connect(m_channelCom1.data(), &IVoiceChannel::audioStarted, this, &Client::audioStartedStream);
connect(m_voice, &IVoice::audioStopped, this, &Client::audioStoppedStream); connect(m_channelCom1.data(), &IVoiceChannel::audioStopped, this, &Client::audioStoppedStream);
connect(m_voice, &IVoice::userJoinedRoom, this, &Client::userJoinedRoom); connect(m_channelCom1.data(), &IVoiceChannel::userJoinedRoom, this, &Client::userJoinedRoom);
connect(m_voice, &IVoice::userLeftRoom, this, &Client::userLeftRoom); connect(m_channelCom1.data(), &IVoiceChannel::userLeftRoom, this, &Client::userLeftRoom);
using namespace std::placeholders; using namespace std::placeholders;
m_commands["help"] = std::bind(&Client::help, this, _1); m_commands["help"] = std::bind(&Client::help, this, _1);
@@ -119,7 +120,7 @@ void Client::setCallsignCmd(QTextStream &args)
{ {
QString callsign; QString callsign;
args >> callsign; args >> callsign;
m_voice->setMyAircraftCallsign(BlackMisc::Aviation::CCallsign(callsign)); m_channelCom1->setMyAircraftCallsign(BlackMisc::Aviation::CCallsign(callsign));
} }
void Client::initiateConnectionCmd(QTextStream &args) void Client::initiateConnectionCmd(QTextStream &args)
@@ -128,14 +129,14 @@ void Client::initiateConnectionCmd(QTextStream &args)
QString channel; QString channel;
args >> hostname >> channel; args >> hostname >> channel;
std::cout << "Joining voice room: " << hostname.toStdString() << "/" << channel.toStdString() << std::endl; std::cout << "Joining voice room: " << hostname.toStdString() << "/" << channel.toStdString() << std::endl;
m_voice->joinVoiceRoom(BlackCore::IVoice::COM1, BlackMisc::Audio::CVoiceRoom(hostname, channel)); m_channelCom1->joinVoiceRoom(BlackMisc::Audio::CVoiceRoom(hostname, channel));
printLinePrefix(); printLinePrefix();
} }
void Client::terminateConnectionCmd(QTextStream & /** args **/) void Client::terminateConnectionCmd(QTextStream & /** args **/)
{ {
std::cout << "Leaving room." << std::endl; std::cout << "Leaving room." << std::endl;
m_voice->leaveVoiceRoom(BlackCore::IVoice::COM1); m_channelCom1->leaveVoiceRoom();
printLinePrefix(); printLinePrefix();
} }
@@ -166,7 +167,7 @@ void Client::outputDevicesCmd(QTextStream & /** args **/)
void Client::listCallsignsCmd(QTextStream &args) void Client::listCallsignsCmd(QTextStream &args)
{ {
Q_UNUSED(args) Q_UNUSED(args)
CCallsignList callsigns = m_voice->getVoiceRoomCallsigns(BlackCore::IVoice::COM1); CCallsignList callsigns = m_channelCom1->getVoiceRoomCallsigns();
foreach(CCallsign callsign, callsigns) foreach(CCallsign callsign, callsigns)
{ {
std::cout << " " << callsign.toStdString() << std::endl; std::cout << " " << callsign.toStdString() << std::endl;
@@ -200,49 +201,48 @@ void Client::onMicTestFinished()
printLinePrefix(); printLinePrefix();
} }
void Client::connectionStatusChanged(BlackCore::IVoice::ComUnit /** comUnit **/, void Client::connectionStatusChanged( BlackCore::IVoiceChannel::ConnectionStatus /** oldStatus **/,
BlackCore::IVoice::ConnectionStatus /** oldStatus **/, BlackCore::IVoiceChannel::ConnectionStatus newStatus)
BlackCore::IVoice::ConnectionStatus newStatus)
{ {
switch (newStatus) switch (newStatus)
{ {
case BlackCore::IVoice::Disconnected: case BlackCore::IVoiceChannel::Disconnected:
std::cout << "CONN_STATUS_DISCONNECTED" << std::endl; std::cout << "CONN_STATUS_DISCONNECTED" << std::endl;
break; break;
case BlackCore::IVoice::Disconnecting: case BlackCore::IVoiceChannel::Disconnecting:
std::cout << "CONN_STATUS_DISCONNECTING" << std::endl; std::cout << "CONN_STATUS_DISCONNECTING" << std::endl;
break; break;
case BlackCore::IVoice::DisconnectedError: case BlackCore::IVoiceChannel::DisconnectedError:
std::cout << "CONN_STATUS_DISCONNECTED_ERROR" << std::endl; std::cout << "CONN_STATUS_DISCONNECTED_ERROR" << std::endl;
break; break;
case BlackCore::IVoice::Connecting: case BlackCore::IVoiceChannel::Connecting:
std::cout << "CONN_STATUS_CONNECTING" << std::endl; std::cout << "CONN_STATUS_CONNECTING" << std::endl;
break; break;
case BlackCore::IVoice::Connected: case BlackCore::IVoiceChannel::Connected:
std::cout << "CONN_STATUS_CONNECTED" << std::endl; std::cout << "CONN_STATUS_CONNECTED" << std::endl;
break; break;
case BlackCore::IVoice::ConnectingFailed: case BlackCore::IVoiceChannel::ConnectingFailed:
std::cout << "CONN_STATUS_CONNECTING_FAILED" << std::endl; std::cout << "CONN_STATUS_CONNECTING_FAILED" << std::endl;
break; break;
} }
printLinePrefix(); printLinePrefix();
} }
void Client::audioStartedStream(const BlackCore::IVoice::ComUnit comUnit) void Client::audioStartedStream()
{ {
std::cout << "Started stream in room index " << static_cast<qint32>(comUnit) << std::endl; std::cout << "Started stream in room index " << std::endl;
printLinePrefix(); printLinePrefix();
} }
void Client::audioStoppedStream(const BlackCore::IVoice::ComUnit comUnit) void Client::audioStoppedStream()
{ {
std::cout << "Stopped stream in room index " << static_cast<qint32>(comUnit) << std::endl; std::cout << "Stopped stream in room index " << std::endl;
printLinePrefix(); printLinePrefix();
} }
void Client::userJoinedRoom(const CCallsign &callsign) void Client::userJoinedRoom(const CCallsign &callsign)
{ {
std::cout << callsign.toStdString() << " joined the voice room." << std::endl; std::cout << ": " << callsign.toStdString() << " joined the voice room." << std::endl;
printLinePrefix(); printLinePrefix();
} }

View File

@@ -7,8 +7,10 @@
#define SAMPLE_VOICECLIENT #define SAMPLE_VOICECLIENT
#include "blackcore/voice.h" #include "blackcore/voice.h"
#include "blackcore/voice_channel.h"
#include <QObject> #include <QObject>
#include <QPointer>
#include <functional> #include <functional>
#include <QMap> #include <QMap>
#include <QThread> #include <QThread>
@@ -49,11 +51,10 @@ public slots:
void onMicTestFinished(); void onMicTestFinished();
private slots: private slots:
void connectionStatusChanged(BlackCore::IVoice::ComUnit comUnit, void connectionStatusChanged(BlackCore::IVoiceChannel::ConnectionStatus oldStatus,
BlackCore::IVoice::ConnectionStatus oldStatus, BlackCore::IVoiceChannel::ConnectionStatus newStatus);
BlackCore::IVoice::ConnectionStatus newStatus); void audioStartedStream();
void audioStartedStream(const BlackCore::IVoice::ComUnit comUnit); void audioStoppedStream();
void audioStoppedStream(const BlackCore::IVoice::ComUnit comUnit);
void userJoinedRoom(const BlackMisc::Aviation::CCallsign &callsign); void userJoinedRoom(const BlackMisc::Aviation::CCallsign &callsign);
void userLeftRoom(const BlackMisc::Aviation::CCallsign &callsign); void userLeftRoom(const BlackMisc::Aviation::CCallsign &callsign);
@@ -61,6 +62,7 @@ private:
QMap<QString, std::function<void(QTextStream &)>> m_commands; QMap<QString, std::function<void(QTextStream &)>> m_commands;
BlackCore::IVoice *m_voice; BlackCore::IVoice *m_voice;
QThread m_threadVoice; QThread m_threadVoice;
QPointer<BlackCore::IVoiceChannel> m_channelCom1;
}; };

View File

@@ -7,10 +7,10 @@
#include "context_network.h" #include "context_network.h"
#include "context_ownaircraft.h" #include "context_ownaircraft.h"
#include "context_application.h" #include "context_application.h"
#include "voice_channel.h"
#include "blacksound/soundgenerator.h" #include "blacksound/soundgenerator.h"
#include "blackmisc/notificationsounds.h" #include "blackmisc/notificationsounds.h"
#include "blackmisc/voiceroomlist.h"
#include <QTimer> #include <QTimer>
@@ -37,14 +37,21 @@ namespace BlackCore
m_keyboard = BlackInput::IKeyboard::getInstance(); m_keyboard = BlackInput::IKeyboard::getInstance();
// 3. own aircraft, if possible // 3. own aircraft, if possible
if (this->getIContextOwnAircraft()) m_voice->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign()); //if (this->getIContextOwnAircraft()) m_voice->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign());
// 4. Signal / slots // 4. Signal / slots
connect(this->m_voice, &CVoiceVatlib::micTestFinished, this, &CContextAudio::audioTestCompleted); connect(this->m_voice, &CVoiceVatlib::micTestFinished, this, &CContextAudio::audioTestCompleted);
connect(this->m_voice, &CVoiceVatlib::squelchTestFinished, this, &CContextAudio::audioTestCompleted); connect(this->m_voice, &CVoiceVatlib::squelchTestFinished, this, &CContextAudio::audioTestCompleted);
connect(this->m_voice, &CVoiceVatlib::connectionStatusChanged, this, &CContextAudio::ps_connectionStatusChanged); //connect(this->m_voice, &CVoiceVatlib::connectionStatusChanged, this, &CContextAudio::ps_connectionStatusChanged);
if (this->getIContextApplication()) this->connect(this->m_voice, &IVoice::statusMessage, this->getIContextApplication(), &IContextApplication::sendStatusMessage); if (this->getIContextApplication()) this->connect(this->m_voice, &IVoice::statusMessage, this->getIContextApplication(), &IContextApplication::sendStatusMessage);
m_channelCom1 = m_voice->getVoiceChannel(0);
m_channelCom1->setMyAircraftCallsign(getIContextOwnAircraft()->getOwnAircraft().getCallsign());
connect(m_channelCom1.data(), &IVoiceChannel::connectionStatusChanged, this, &CContextAudio::ps_com1ConnectionStatusChanged);
m_channelCom2 = m_voice->getVoiceChannel(1);
m_channelCom2->setMyAircraftCallsign(getIContextOwnAircraft()->getOwnAircraft().getCallsign());
connect(m_channelCom2.data(), &IVoiceChannel::connectionStatusChanged, this, &CContextAudio::ps_com2ConnectionStatusChanged);
// 5. load sounds (init), not possible in own thread // 5. load sounds (init), not possible in own thread
QTimer::singleShot(10 * 1000, this, SLOT(ps_initNotificationSounds())); QTimer::singleShot(10 * 1000, this, SLOT(ps_initNotificationSounds()));
} }
@@ -66,7 +73,7 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
return this->m_voice->getComVoiceRoomsWithAudioStatus(); return getComVoiceRooms();
} }
/* /*
@@ -76,10 +83,8 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, withAudioStatus); if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, withAudioStatus);
if (withAudioStatus) // We always have the audio status due to shared status
return this->m_voice->getComVoiceRoomsWithAudioStatus()[0]; return m_channelCom1->getVoiceRoom();
else
return this->m_voice->getComVoiceRooms()[0];
} }
/* /*
@@ -89,10 +94,8 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, withAudioStatus); if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, withAudioStatus);
if (withAudioStatus) // We always have the audio status due to shared status
return this->m_voice->getComVoiceRoomsWithAudioStatus()[1]; return m_channelCom2->getVoiceRoom();
else
return this->m_voice->getComVoiceRooms()[1];
} }
/* /*
@@ -102,7 +105,10 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
return this->m_voice->getComVoiceRooms(); CVoiceRoomList voiceRoomList;
voiceRoomList.push_back(m_channelCom1->getVoiceRoom());
voiceRoomList.push_back(m_channelCom2->getVoiceRoom());
return voiceRoomList;
} }
/* /*
@@ -112,7 +118,8 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
this->m_voice->leaveAllVoiceRooms(); m_channelCom1->leaveVoiceRoom();
m_channelCom2->leaveVoiceRoom();
} }
/* /*
@@ -167,12 +174,12 @@ namespace BlackCore
// volumes // volumes
qint32 vol1 = com1.getVolumeOutput(); qint32 vol1 = com1.getVolumeOutput();
qint32 vol2 = com2.getVolumeOutput(); qint32 vol2 = com2.getVolumeOutput();
this->m_voice->setRoomOutputVolume(IVoice::COM1, vol1); m_channelCom1->setRoomOutputVolume(vol1);
this->m_voice->setRoomOutputVolume(IVoice::COM2, vol2); m_channelCom2->setRoomOutputVolume(vol2);
// enable / disable in the same step // enable / disable in the same step
this->m_voice->switchAudioOutput(IVoice::COM1, com1.isEnabled()); m_channelCom1->switchAudioOutput(com1.isEnabled());
this->m_voice->switchAudioOutput(IVoice::COM2, com2.isEnabled()); m_channelCom2->switchAudioOutput(com2.isEnabled());
} }
/* /*
@@ -182,7 +189,7 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
return this->m_voice->isMuted(); return m_channelCom1->isMuted() && m_channelCom2->isMuted();
} }
/* /*
@@ -194,7 +201,7 @@ namespace BlackCore
Q_ASSERT(newRooms.size() == 2); Q_ASSERT(newRooms.size() == 2);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, newRooms.toQString()); if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, newRooms.toQString());
CVoiceRoomList currentRooms = this->m_voice->getComVoiceRooms(); CVoiceRoomList currentRooms = getComVoiceRooms();
CVoiceRoom currentRoom1 = currentRooms[0]; CVoiceRoom currentRoom1 = currentRooms[0];
CVoiceRoom currentRoom2 = currentRooms[1]; CVoiceRoom currentRoom2 = currentRooms[1];
CVoiceRoom newRoom1 = newRooms[0]; CVoiceRoom newRoom1 = newRooms[0];
@@ -205,14 +212,20 @@ namespace BlackCore
// changed rooms? But only compare on "URL", not status as connected etc. // changed rooms? But only compare on "URL", not status as connected etc.
if (currentRoom1.getVoiceRoomUrl() != newRoom1.getVoiceRoomUrl()) if (currentRoom1.getVoiceRoomUrl() != newRoom1.getVoiceRoomUrl())
{ {
this->m_voice->leaveVoiceRoom(IVoice::COM1); m_channelCom1->leaveVoiceRoom();
if (newRoom1.isValid()) this->m_voice->joinVoiceRoom(IVoice::COM1, newRoom1); if (newRoom1.isValid())
{
m_channelCom1->joinVoiceRoom(newRoom1);
}
changed = true; changed = true;
} }
if (currentRoom2.getVoiceRoomUrl() != newRoom2.getVoiceRoomUrl()) if (currentRoom2.getVoiceRoomUrl() != newRoom2.getVoiceRoomUrl())
{ {
this->m_voice->leaveVoiceRoom(IVoice::COM2); m_channelCom2->leaveVoiceRoom();
if (newRoom2.isValid()) this->m_voice->joinVoiceRoom(IVoice::COM2, newRoom2); if (newRoom2.isValid())
{
m_channelCom2->joinVoiceRoom(newRoom2);
}
changed = true; changed = true;
} }
@@ -228,8 +241,7 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
CCallsignList callsigns = this->m_voice->getVoiceRoomCallsigns(IVoice::COM1); return m_channelCom1->getVoiceRoomCallsigns();
return callsigns;
} }
/* /*
@@ -239,8 +251,7 @@ namespace BlackCore
{ {
Q_ASSERT(this->m_voice); Q_ASSERT(this->m_voice);
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO); if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
CCallsignList callsigns = this->m_voice->getVoiceRoomCallsigns(IVoice::COM2); return m_channelCom2->getVoiceRoomCallsigns();
return callsigns;
} }
/* /*
@@ -360,7 +371,11 @@ namespace BlackCore
*/ */
void CContextAudio::ps_settingsChanged(uint typeValue) void CContextAudio::ps_settingsChanged(uint typeValue)
{ {
if (this->getIContextOwnAircraft()) m_voice->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign()); if (this->getIContextOwnAircraft())
{
m_channelCom1->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign());
m_channelCom2->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign());
}
if (!this->getIContextSettings()) return; if (!this->getIContextSettings()) return;
IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue); IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue);
if (type == IContextSettings::SettingsHotKeys) if (type == IContextSettings::SettingsHotKeys)
@@ -376,32 +391,70 @@ namespace BlackCore
/* /*
* Connection status changed * Connection status changed
*/ */
void CContextAudio::ps_connectionStatusChanged(IVoice::ComUnit comUnit, IVoice::ConnectionStatus oldStatus, IVoice::ConnectionStatus newStatus) void CContextAudio::ps_com1ConnectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus)
{ {
Q_UNUSED(comUnit);
Q_UNUSED(oldStatus); Q_UNUSED(oldStatus);
switch (newStatus) switch (newStatus)
{ {
case IVoice::Connected: case IVoiceChannel::Connected:
emit this->changedVoiceRooms(this->m_voice->getComVoiceRooms(), true); emit this->changedVoiceRooms(getComVoiceRooms(), true);
break; break;
case IVoice::Disconnecting: case IVoiceChannel::Disconnecting:
break; break;
case IVoice::Connecting: case IVoiceChannel::Connecting:
break; break;
case IVoice::ConnectingFailed: case IVoiceChannel::ConnectingFailed:
case IVoice::DisconnectedError: case IVoiceChannel::DisconnectedError:
{ {
const QString e = QString("Voice room %1 error").arg(comUnit); const QString e = QString("Voice room COM1 error");
qWarning(e.toUtf8().constData()); qWarning(e.toUtf8().constData());
// no break here! // no break here!
} }
case IVoice::Disconnected: case IVoiceChannel::Disconnected:
// good chance to update aircraft // good chance to update aircraft
if (this->getIContextOwnAircraft()) m_voice->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign()); if (this->getIContextOwnAircraft())
emit this->changedVoiceRooms(this->m_voice->getComVoiceRooms(), false); {
m_channelCom1->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign());
m_channelCom2->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign());
}
emit this->changedVoiceRooms(getComVoiceRooms(), false);
break;
default:
break;
}
}
void CContextAudio::ps_com2ConnectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus)
{
Q_UNUSED(oldStatus);
switch (newStatus)
{
case IVoiceChannel::Connected:
emit this->changedVoiceRooms(getComVoiceRooms(), true);
break;
case IVoiceChannel::Disconnecting:
break;
case IVoiceChannel::Connecting:
break;
case IVoiceChannel::ConnectingFailed:
case IVoiceChannel::DisconnectedError:
{
const QString e = QString("Voice room COM2 error");
qWarning(e.toUtf8().constData());
// no break here!
}
case IVoiceChannel::Disconnected:
// good chance to update aircraft
if (this->getIContextOwnAircraft())
{
m_channelCom1->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign());
m_channelCom2->setMyAircraftCallsign(this->getIContextOwnAircraft()->getOwnAircraft().getCallsign());
}
emit this->changedVoiceRooms(getComVoiceRooms(), false);
break; break;
default: default:
break; break;

View File

@@ -11,13 +11,18 @@
#include "context_runtime.h" #include "context_runtime.h"
#include "dbus_server.h" #include "dbus_server.h"
#include "voice_vatlib.h" #include "voice_vatlib.h"
#include "voice_channel.h"
#include "blackinput/keyboard.h" #include "blackinput/keyboard.h"
#include "blackmisc/voiceroomlist.h"
#include <QThread> #include <QThread>
#include <QQueue> #include <QQueue>
#include <QPointer>
namespace BlackCore namespace BlackCore
{ {
class IVoiceChannel;
//! Audio context implementation //! Audio context implementation
class CContextAudio : public IContextAudio class CContextAudio : public IContextAudio
{ {
@@ -117,7 +122,11 @@ namespace BlackCore
//! \copydoc IVoice::connectionStatusChanged //! \copydoc IVoice::connectionStatusChanged
//! \sa IContextAudio::changedVoiceRooms //! \sa IContextAudio::changedVoiceRooms
void ps_connectionStatusChanged(IVoice::ComUnit comUnit, IVoice::ConnectionStatus oldStatus, IVoice::ConnectionStatus newStatus); void ps_com1ConnectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus);
//! \copydoc IVoice::connectionStatusChanged
//! \sa IContextAudio::changedVoiceRooms
void ps_com2ConnectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus);
//! Init notification sounds //! Init notification sounds
void ps_initNotificationSounds(); void ps_initNotificationSounds();
@@ -130,6 +139,8 @@ namespace BlackCore
BlackInput::IKeyboard *m_keyboard; BlackInput::IKeyboard *m_keyboard;
BlackInput::IKeyboard::RegistrationHandle m_handlePtt; BlackInput::IKeyboard::RegistrationHandle m_handlePtt;
QThread m_threadVoice; QThread m_threadVoice;
QPointer<IVoiceChannel> m_channelCom1;
QPointer<IVoiceChannel> m_channelCom2;
}; };
} }