mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35:38 +08:00
refs #199, further slot logging for network / simulator , added log method for bool values
This commit is contained in:
@@ -50,6 +50,7 @@ namespace BlackCore
|
|||||||
void CContextAudio::setOwnAircraft(const CAircraft &ownAircraft)
|
void CContextAudio::setOwnAircraft(const CAircraft &ownAircraft)
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, ownAircraft.toQString());
|
||||||
this->m_voice->setMyAircraftCallsign(ownAircraft.getCallsign());
|
this->m_voice->setMyAircraftCallsign(ownAircraft.getCallsign());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ namespace BlackCore
|
|||||||
CVoiceRoomList CContextAudio::getComVoiceRoomsWithAudioStatus() const
|
CVoiceRoomList CContextAudio::getComVoiceRoomsWithAudioStatus() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return this->m_voice->getComVoiceRoomsWithAudioStatus();
|
return this->m_voice->getComVoiceRoomsWithAudioStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +70,7 @@ namespace BlackCore
|
|||||||
CVoiceRoom CContextAudio::getCom1VoiceRoom(bool withAudioStatus) const
|
CVoiceRoom CContextAudio::getCom1VoiceRoom(bool withAudioStatus) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, withAudioStatus);
|
||||||
if (withAudioStatus)
|
if (withAudioStatus)
|
||||||
return this->m_voice->getComVoiceRoomsWithAudioStatus()[0];
|
return this->m_voice->getComVoiceRoomsWithAudioStatus()[0];
|
||||||
else
|
else
|
||||||
@@ -80,6 +83,7 @@ namespace BlackCore
|
|||||||
CVoiceRoom CContextAudio::getCom2VoiceRoom(bool withAudioStatus) const
|
CVoiceRoom CContextAudio::getCom2VoiceRoom(bool withAudioStatus) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, withAudioStatus);
|
||||||
if (withAudioStatus)
|
if (withAudioStatus)
|
||||||
return this->m_voice->getComVoiceRoomsWithAudioStatus()[1];
|
return this->m_voice->getComVoiceRoomsWithAudioStatus()[1];
|
||||||
else
|
else
|
||||||
@@ -92,6 +96,7 @@ namespace BlackCore
|
|||||||
CVoiceRoomList CContextAudio::getComVoiceRooms() const
|
CVoiceRoomList CContextAudio::getComVoiceRooms() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return this->m_voice->getComVoiceRooms();
|
return this->m_voice->getComVoiceRooms();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,6 +106,7 @@ namespace BlackCore
|
|||||||
void CContextAudio::leaveAllVoiceRooms()
|
void CContextAudio::leaveAllVoiceRooms()
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
this->m_voice->leaveAllVoiceRooms();
|
this->m_voice->leaveAllVoiceRooms();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +116,7 @@ namespace BlackCore
|
|||||||
CAudioDeviceList CContextAudio::getAudioDevices() const
|
CAudioDeviceList CContextAudio::getAudioDevices() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return this->m_voice->audioDevices();
|
return this->m_voice->audioDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +126,7 @@ namespace BlackCore
|
|||||||
CAudioDeviceList CContextAudio::getCurrentAudioDevices() const
|
CAudioDeviceList CContextAudio::getCurrentAudioDevices() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
CAudioDeviceList devices;
|
CAudioDeviceList devices;
|
||||||
devices.push_back(this->m_voice->getCurrentInputDevice());
|
devices.push_back(this->m_voice->getCurrentInputDevice());
|
||||||
devices.push_back(this->m_voice->getCurrentOutputDevice());
|
devices.push_back(this->m_voice->getCurrentOutputDevice());
|
||||||
@@ -132,6 +140,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
Q_ASSERT(audioDevice.getType() != CAudioDevice::Unknown);
|
Q_ASSERT(audioDevice.getType() != CAudioDevice::Unknown);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, audioDevice.toQString());
|
||||||
if (audioDevice.getType() == CAudioDevice::InputDevice)
|
if (audioDevice.getType() == CAudioDevice::InputDevice)
|
||||||
{
|
{
|
||||||
this->m_voice->setInputDevice(audioDevice);
|
this->m_voice->setInputDevice(audioDevice);
|
||||||
@@ -148,6 +157,7 @@ namespace BlackCore
|
|||||||
void CContextAudio::setVolumes(const CComSystem &com1, const CComSystem &com2)
|
void CContextAudio::setVolumes(const CComSystem &com1, const CComSystem &com2)
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, com1.toQString(), com2.toQString());
|
||||||
this->m_voice->setRoomOutputVolume(IVoice::COM1, com1.getVolumeOutput());
|
this->m_voice->setRoomOutputVolume(IVoice::COM1, com1.getVolumeOutput());
|
||||||
this->m_voice->setRoomOutputVolume(IVoice::COM2, com2.getVolumeOutput());
|
this->m_voice->setRoomOutputVolume(IVoice::COM2, com2.getVolumeOutput());
|
||||||
this->m_voice->switchAudioOutput(IVoice::COM1, com1.isEnabled());
|
this->m_voice->switchAudioOutput(IVoice::COM1, com1.isEnabled());
|
||||||
@@ -160,6 +170,7 @@ namespace BlackCore
|
|||||||
bool CContextAudio::isMuted() const
|
bool CContextAudio::isMuted() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return this->m_voice->isMuted();
|
return this->m_voice->isMuted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,6 +180,7 @@ namespace BlackCore
|
|||||||
void CContextAudio::setComVoiceRooms(const CVoiceRoom &voiceRoomCom1, const CVoiceRoom &voiceRoomCom2)
|
void CContextAudio::setComVoiceRooms(const CVoiceRoom &voiceRoomCom1, const CVoiceRoom &voiceRoomCom2)
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, voiceRoomCom1.toQString(), voiceRoomCom2.toQString());
|
||||||
CVoiceRoomList currentRooms = this->m_voice->getComVoiceRoomsWithAudioStatus();
|
CVoiceRoomList currentRooms = this->m_voice->getComVoiceRoomsWithAudioStatus();
|
||||||
CVoiceRoom currentRoom1 = currentRooms[0];
|
CVoiceRoom currentRoom1 = currentRooms[0];
|
||||||
CVoiceRoom currentRoom2 = currentRooms[1];
|
CVoiceRoom currentRoom2 = currentRooms[1];
|
||||||
@@ -190,6 +202,7 @@ namespace BlackCore
|
|||||||
CCallsignList CContextAudio::getCom1RoomCallsigns() const
|
CCallsignList CContextAudio::getCom1RoomCallsigns() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return this->m_voice->getVoiceRoomCallsigns(IVoice::COM1);
|
return this->m_voice->getVoiceRoomCallsigns(IVoice::COM1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,6 +212,7 @@ namespace BlackCore
|
|||||||
CCallsignList CContextAudio::getCom2RoomCallsigns() const
|
CCallsignList CContextAudio::getCom2RoomCallsigns() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return this->m_voice->getVoiceRoomCallsigns(IVoice::COM2);
|
return this->m_voice->getVoiceRoomCallsigns(IVoice::COM2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,6 +223,8 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
Q_ASSERT(this->getRuntime());
|
Q_ASSERT(this->getRuntime());
|
||||||
|
if (!this->getRuntime()->getIContextNetwork()) return Network::CUserList();
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return this->getIContextNetwork()->getUsersForCallsigns(this->getCom1RoomCallsigns());
|
return this->getIContextNetwork()->getUsersForCallsigns(this->getCom1RoomCallsigns());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,9 +235,9 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
Q_ASSERT(this->getRuntime());
|
Q_ASSERT(this->getRuntime());
|
||||||
Q_ASSERT(this->getRuntime()->getIContextNetwork());
|
if (!this->getRuntime()->getIContextNetwork()) return Network::CUserList();
|
||||||
return this->getRuntime()->getIContextNetwork()->
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
getUsersForCallsigns(this->getCom2RoomCallsigns());
|
return this->getRuntime()->getIContextNetwork()->getUsersForCallsigns(this->getCom2RoomCallsigns());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -230,6 +246,7 @@ namespace BlackCore
|
|||||||
void CContextAudio::playSelcalTone(const CSelcal &selcal) const
|
void CContextAudio::playSelcalTone(const CSelcal &selcal) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, selcal.toQString());
|
||||||
CAudioDevice outputDevice = m_voice->getCurrentOutputDevice();
|
CAudioDevice outputDevice = m_voice->getCurrentOutputDevice();
|
||||||
BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice);
|
BlackSound::CSoundGenerator::playSelcal(90, selcal, outputDevice);
|
||||||
}
|
}
|
||||||
@@ -240,6 +257,7 @@ namespace BlackCore
|
|||||||
void CContextAudio::playNotification(uint notification) const
|
void CContextAudio::playNotification(uint notification) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, QString::number(notification));
|
||||||
BlackSound::CSoundGenerator::playNotificationSound(90, static_cast<BlackSound::CSoundGenerator::Notification>(notification));
|
BlackSound::CSoundGenerator::playNotificationSound(90, static_cast<BlackSound::CSoundGenerator::Notification>(notification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +267,7 @@ namespace BlackCore
|
|||||||
void CContextAudio::runMicrophoneTest()
|
void CContextAudio::runMicrophoneTest()
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
this->m_voice->runMicrophoneTest();
|
this->m_voice->runMicrophoneTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,6 +277,7 @@ namespace BlackCore
|
|||||||
void CContextAudio::runSquelchTest()
|
void CContextAudio::runSquelchTest()
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
this->m_voice->runSquelchTest();
|
this->m_voice->runSquelchTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,6 +287,7 @@ namespace BlackCore
|
|||||||
QString CContextAudio::getMicrophoneTestResult() const
|
QString CContextAudio::getMicrophoneTestResult() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return this->m_voice->micTestResultAsString();
|
return this->m_voice->micTestResultAsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,9 +297,13 @@ namespace BlackCore
|
|||||||
double CContextAudio::getSquelchValue() const
|
double CContextAudio::getSquelchValue() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_voice);
|
Q_ASSERT(this->m_voice);
|
||||||
|
if (this->getRuntime()->isSlotLogForAudioEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return static_cast<double>(this->m_voice->inputSquelch());
|
return static_cast<double>(this->m_voice->inputSquelch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Settings changed
|
||||||
|
*/
|
||||||
void CContextAudio::settingsChanged(uint typeValue)
|
void CContextAudio::settingsChanged(uint typeValue)
|
||||||
{
|
{
|
||||||
if (!this->getIContextSettings()) return;
|
if (!this->getIContextSettings()) return;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTAUDIO_INTERFACENAME)
|
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTAUDIO_INTERFACENAME)
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
friend class CRuntime;
|
friend class CRuntime;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
bool CContextNetwork::isConnected() const
|
bool CContextNetwork::isConnected() const
|
||||||
{
|
{
|
||||||
|
if (this->getRuntime()->isSlotLogForNetworkEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return this->m_network->isConnected();
|
return this->m_network->isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,6 +217,11 @@ namespace BlackCore
|
|||||||
qDebug() << func << p1 << p2 << p3 << p4; return;
|
qDebug() << func << p1 << p2 << p3 << p4; return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRuntime::logSlot(const char *func, bool boolValue) const
|
||||||
|
{
|
||||||
|
qDebug() << func << boolValue;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Init runtime
|
* Init runtime
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -93,9 +93,11 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Slot logging
|
//! Slot logging
|
||||||
//! \todo to be replace if initializer lists becomes available
|
//! \todo to be replace if initializer lists becomes available
|
||||||
//! \sa signalLog(QOb)
|
|
||||||
void logSlot(const char *func, const QString &p1 = "", const QString &p2 = "", const QString &p3 = "", const QString &p4 = "") const;
|
void logSlot(const char *func, const QString &p1 = "", const QString &p2 = "", const QString &p3 = "", const QString &p4 = "") const;
|
||||||
|
|
||||||
|
//! Slot logging for bool value
|
||||||
|
void logSlot(const char *func, bool boolValue) const;
|
||||||
|
|
||||||
//! shutdown
|
//! shutdown
|
||||||
void gracefulShutdown();
|
void gracefulShutdown();
|
||||||
|
|
||||||
@@ -157,6 +159,9 @@ namespace BlackCore
|
|||||||
//! \remarks only applicable for local object
|
//! \remarks only applicable for local object
|
||||||
CContextSimulator *getCContextSimulator() const;
|
CContextSimulator *getCContextSimulator() const;
|
||||||
|
|
||||||
|
//! Init
|
||||||
|
void init(const CRuntimeConfig &config);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_init; /*!< flag */
|
bool m_init; /*!< flag */
|
||||||
CDBusServer *m_dbusServer;
|
CDBusServer *m_dbusServer;
|
||||||
@@ -179,8 +184,6 @@ namespace BlackCore
|
|||||||
IContextSimulator *m_contextSimulator;
|
IContextSimulator *m_contextSimulator;
|
||||||
QMultiMap<QString, QMetaObject::Connection> m_logSignalConnections;
|
QMultiMap<QString, QMetaObject::Connection> m_logSignalConnections;
|
||||||
|
|
||||||
//! Init
|
|
||||||
void init(const CRuntimeConfig &config);
|
|
||||||
|
|
||||||
//! initialization of DBus connection (where applicable)
|
//! initialization of DBus connection (where applicable)
|
||||||
void initDBusConnection();
|
void initDBusConnection();
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ using namespace BlackMisc::Geo;
|
|||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
// Init this context
|
|
||||||
CContextSimulator::CContextSimulator(CRuntimeConfig::ContextMode mode, CRuntime *runtime) : IContextSimulator(mode, runtime),
|
CContextSimulator::CContextSimulator(CRuntimeConfig::ContextMode mode, CRuntime *runtime) : IContextSimulator(mode, runtime),
|
||||||
m_simulator(nullptr), m_updateTimer(nullptr)
|
m_simulator(nullptr), m_updateTimer(nullptr)
|
||||||
{
|
{
|
||||||
@@ -27,17 +26,18 @@ namespace BlackCore
|
|||||||
connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft);
|
connect(m_updateTimer, &QTimer::timeout, this, &CContextSimulator::updateOwnAircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
CContextSimulator::~CContextSimulator() {}
|
CContextSimulator::~CContextSimulator() {}
|
||||||
|
|
||||||
bool CContextSimulator::isConnected() const
|
bool CContextSimulator::isConnected() const
|
||||||
{
|
{
|
||||||
|
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
if (!m_simulator) return false;
|
if (!m_simulator) return false;
|
||||||
return m_simulator->isConnected();
|
return m_simulator->isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackMisc::Aviation::CAircraft CContextSimulator::getOwnAircraft() const
|
BlackMisc::Aviation::CAircraft CContextSimulator::getOwnAircraft() const
|
||||||
{
|
{
|
||||||
|
if (this->getRuntime()->isSlotLogForSimulatorEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO);
|
||||||
return m_ownAircraft;
|
return m_ownAircraft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user