mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Formatting, comments, Doxygen, minor tweaks
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c5381b01c6
commit
9748b5a442
@@ -34,7 +34,7 @@ namespace BlackCore
|
||||
|
||||
CContextApplication *CContextApplication::registerWithDBus(BlackMisc::CDBusServer *server)
|
||||
{
|
||||
if (!server || this->m_mode != CCoreFacadeConfig::LocalInDbusServer) { return this; }
|
||||
if (!server || m_mode != CCoreFacadeConfig::LocalInDbusServer) { return this; }
|
||||
server->addObject(IContextApplication::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ namespace BlackCore
|
||||
void CContextApplication::unregisterApplication(const CIdentifier &application)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << application; }
|
||||
int r = this->m_registeredApplications.remove(application);
|
||||
int r = m_registeredApplications.remove(application);
|
||||
if (r > 0) { emit registrationChanged(); }
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace BlackCore
|
||||
|
||||
CContextAudio *CContextAudio::registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
if (!server || this->m_mode != CCoreFacadeConfig::LocalInDbusServer) { return this; }
|
||||
if (!server || m_mode != CCoreFacadeConfig::LocalInDbusServer) { return this; }
|
||||
server->addObject(IContextAudio::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
@@ -106,14 +106,14 @@ namespace BlackCore
|
||||
|
||||
CVoiceRoomList CContextAudio::getComVoiceRoomsWithAudioStatus() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return getComVoiceRooms();
|
||||
}
|
||||
|
||||
CVoiceRoom CContextAudio::getVoiceRoom(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue, bool withAudioStatus) const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << withAudioStatus; }
|
||||
|
||||
auto voiceChannel = m_voiceChannelMapping.value(comUnitValue);
|
||||
@@ -129,7 +129,7 @@ namespace BlackCore
|
||||
|
||||
CVoiceRoomList CContextAudio::getComVoiceRooms() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
CVoiceRoomList voiceRoomList;
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace BlackCore
|
||||
|
||||
void CContextAudio::leaveAllVoiceRooms()
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;}
|
||||
m_voiceChannelMapping.clear();
|
||||
m_channel1->leaveVoiceRoom();
|
||||
@@ -171,7 +171,7 @@ namespace BlackCore
|
||||
|
||||
CIdentifier CContextAudio::audioRunsWhere() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
static const BlackMisc::CIdentifier i("CContextAudio");
|
||||
return i;
|
||||
@@ -179,34 +179,34 @@ namespace BlackCore
|
||||
|
||||
CAudioDeviceInfoList CContextAudio::getAudioDevices() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
CAudioDeviceInfoList devices = this->m_voiceOutputDevice->getOutputDevices();
|
||||
devices = devices.join(this->m_voiceInputDevice->getInputDevices());
|
||||
CAudioDeviceInfoList devices = m_voiceOutputDevice->getOutputDevices();
|
||||
devices = devices.join(m_voiceInputDevice->getInputDevices());
|
||||
return devices;
|
||||
}
|
||||
|
||||
CAudioDeviceInfoList CContextAudio::getCurrentAudioDevices() const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
CAudioDeviceInfoList devices;
|
||||
devices.push_back(this->m_voiceInputDevice->getCurrentInputDevice());
|
||||
devices.push_back(this->m_voiceOutputDevice->getCurrentOutputDevice());
|
||||
devices.push_back(m_voiceInputDevice->getCurrentInputDevice());
|
||||
devices.push_back(m_voiceOutputDevice->getCurrentOutputDevice());
|
||||
return devices;
|
||||
}
|
||||
|
||||
void CContextAudio::setCurrentAudioDevice(const CAudioDeviceInfo &audioDevice)
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
Q_ASSERT(audioDevice.getType() != CAudioDeviceInfo::Unknown);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << audioDevice; }
|
||||
bool changed = false;
|
||||
if (audioDevice.getType() == CAudioDeviceInfo::InputDevice)
|
||||
{
|
||||
if (this->m_voiceInputDevice->getCurrentInputDevice() != audioDevice)
|
||||
if (m_voiceInputDevice->getCurrentInputDevice() != audioDevice)
|
||||
{
|
||||
this->m_voiceInputDevice->setInputDevice(audioDevice);
|
||||
m_voiceInputDevice->setInputDevice(audioDevice);
|
||||
changed = true;
|
||||
}
|
||||
if (m_inputDeviceSetting.get() != audioDevice.getName())
|
||||
@@ -216,9 +216,9 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->m_voiceOutputDevice->getCurrentOutputDevice() != audioDevice)
|
||||
if (m_voiceOutputDevice->getCurrentOutputDevice() != audioDevice)
|
||||
{
|
||||
this->m_voiceOutputDevice->setOutputDevice(audioDevice);
|
||||
m_voiceOutputDevice->setOutputDevice(audioDevice);
|
||||
changed = true;
|
||||
}
|
||||
if (m_outputDeviceSetting.get() != audioDevice.getName())
|
||||
@@ -267,8 +267,8 @@ namespace BlackCore
|
||||
int newVolume;
|
||||
if (muted)
|
||||
{
|
||||
Q_ASSERT(this->m_voiceOutputDevice);
|
||||
m_outVolumeBeforeMute = this->m_voiceOutputDevice->getOutputVolume();
|
||||
Q_ASSERT(m_voiceOutputDevice);
|
||||
m_outVolumeBeforeMute = m_voiceOutputDevice->getOutputVolume();
|
||||
newVolume = 0;
|
||||
}
|
||||
else
|
||||
@@ -296,7 +296,7 @@ namespace BlackCore
|
||||
|
||||
void CContextAudio::setComVoiceRooms(const CVoiceRoomList &newRooms)
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
Q_ASSERT(newRooms.size() == 2);
|
||||
Q_ASSERT(getIContextOwnAircraft());
|
||||
if (m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << newRooms; }
|
||||
@@ -405,7 +405,7 @@ namespace BlackCore
|
||||
|
||||
CCallsignSet CContextAudio::getRoomCallsigns(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue) const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
|
||||
auto voiceChannel = m_voiceChannelMapping.value(comUnitValue);
|
||||
@@ -421,7 +421,7 @@ namespace BlackCore
|
||||
|
||||
Network::CUserList CContextAudio::getRoomUsers(BlackMisc::Aviation::CComSystem::ComUnit comUnit) const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
Q_ASSERT(this->getRuntime());
|
||||
if (!this->getRuntime()->getIContextNetwork()) return Network::CUserList();
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
@@ -431,14 +431,14 @@ namespace BlackCore
|
||||
|
||||
void CContextAudio::playSelcalTone(const CSelcal &selcal) const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << selcal; }
|
||||
m_selcalPlayer->play(90, selcal);
|
||||
}
|
||||
|
||||
void CContextAudio::playNotification(CNotificationSounds::Notification notification, bool considerSettings) const
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
Q_ASSERT(m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << notification; }
|
||||
|
||||
bool play = !considerSettings || m_audioSettings.getThreadLocal().getNotificationFlag(notification);
|
||||
@@ -456,7 +456,7 @@ namespace BlackCore
|
||||
|
||||
void CContextAudio::enableAudioLoopback(bool enable)
|
||||
{
|
||||
Q_ASSERT(this->m_audioMixer);
|
||||
Q_ASSERT(m_audioMixer);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (enable)
|
||||
{
|
||||
@@ -470,9 +470,9 @@ namespace BlackCore
|
||||
|
||||
bool CContextAudio::isAudioLoopbackEnabled() const
|
||||
{
|
||||
Q_ASSERT(this->m_audioMixer);
|
||||
Q_ASSERT(m_audioMixer);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_audioMixer->hasMixerConnection(IAudioMixer::InputMicrophone, IAudioMixer::OutputOutputDevice1);
|
||||
return m_audioMixer->hasMixerConnection(IAudioMixer::InputMicrophone, IAudioMixer::OutputOutputDevice1);
|
||||
}
|
||||
|
||||
bool CContextAudio::parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator)
|
||||
@@ -561,7 +561,7 @@ namespace BlackCore
|
||||
|
||||
void CContextAudio::changeDeviceSettings()
|
||||
{
|
||||
QString inputDeviceName = m_inputDeviceSetting.get();
|
||||
const QString inputDeviceName = m_inputDeviceSetting.get();
|
||||
if (!inputDeviceName.isEmpty())
|
||||
{
|
||||
for (auto device : m_voiceInputDevice->getInputDevices())
|
||||
@@ -574,7 +574,7 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
QString outputDeviceName = m_outputDeviceSetting.get();
|
||||
const QString outputDeviceName = m_outputDeviceSetting.get();
|
||||
if (!outputDeviceName.isEmpty())
|
||||
{
|
||||
for (auto device : m_voiceOutputDevice->getOutputDevices())
|
||||
|
||||
@@ -65,36 +65,36 @@ namespace BlackCore
|
||||
CContextNetwork::registerHelp();
|
||||
|
||||
// 1. Init by "network driver"
|
||||
this->m_network = new CNetworkVatlib(this->getRuntime()->getCContextOwnAircraft(), this);
|
||||
connect(this->m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::ps_fsdConnectionStatusChanged);
|
||||
connect(this->m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::textMessagesReceived);
|
||||
connect(this->m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::ps_checkForSupervisiorTextMessage);
|
||||
connect(this->m_network, &INetwork::textMessageSent, this, &CContextNetwork::textMessageSent);
|
||||
m_network = new CNetworkVatlib(this->getRuntime()->getCContextOwnAircraft(), this);
|
||||
connect(m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::ps_fsdConnectionStatusChanged);
|
||||
connect(m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::textMessagesReceived);
|
||||
connect(m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::ps_checkForSupervisiorTextMessage);
|
||||
connect(m_network, &INetwork::textMessageSent, this, &CContextNetwork::textMessageSent);
|
||||
|
||||
// 2. Update timer for data (network data such as frequency)
|
||||
this->m_networkDataUpdateTimer = new QTimer(this);
|
||||
connect(this->m_networkDataUpdateTimer, &QTimer::timeout, this, &CContextNetwork::requestDataUpdates);
|
||||
this->m_networkDataUpdateTimer->start(30 * 1000);
|
||||
m_networkDataUpdateTimer = new QTimer(this);
|
||||
connect(m_networkDataUpdateTimer, &QTimer::timeout, this, &CContextNetwork::requestDataUpdates);
|
||||
m_networkDataUpdateTimer->start(30 * 1000);
|
||||
|
||||
// 3. data reader, start reading when setup is synced with xx delay
|
||||
Q_ASSERT_X(sApp->getWebDataServices(), Q_FUNC_INFO, "Missing web data services");
|
||||
Q_ASSERT_X(sApp->hasWebDataServices(), Q_FUNC_INFO, "Missing web data services");
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CContextNetwork::webServiceDataRead);
|
||||
|
||||
// 4. Airspace contents
|
||||
Q_ASSERT_X(this->getRuntime()->getCContextOwnAircraft(), Q_FUNC_INFO, "this and own aircraft context must be local");
|
||||
this->m_airspace = new CAirspaceMonitor(this->getRuntime()->getCContextOwnAircraft(), this->m_network, this);
|
||||
connect(this->m_airspace, &CAirspaceMonitor::changedAtcStationsOnline, this, &CContextNetwork::changedAtcStationsOnline);
|
||||
connect(this->m_airspace, &CAirspaceMonitor::changedAtcStationsBooked, this, &CContextNetwork::changedAtcStationsBooked);
|
||||
connect(this->m_airspace, &CAirspaceMonitor::changedAtcStationOnlineConnectionStatus, this, &CContextNetwork::changedAtcStationOnlineConnectionStatus);
|
||||
connect(this->m_airspace, &CAirspaceMonitor::changedAircraftInRange, this, &CContextNetwork::changedAircraftInRange);
|
||||
connect(this->m_airspace, &CAirspaceMonitor::removedAircraft, this, &IContextNetwork::removedAircraft); // DBus
|
||||
connect(this->m_airspace, &CAirspaceMonitor::readyForModelMatching, this, &CContextNetwork::readyForModelMatching);
|
||||
connect(this->m_airspace, &CAirspaceMonitor::addedAircraft, this, &CContextNetwork::addedAircraft);
|
||||
m_airspace = new CAirspaceMonitor(this->getRuntime()->getCContextOwnAircraft(), m_network, this);
|
||||
connect(m_airspace, &CAirspaceMonitor::changedAtcStationsOnline, this, &CContextNetwork::changedAtcStationsOnline);
|
||||
connect(m_airspace, &CAirspaceMonitor::changedAtcStationsBooked, this, &CContextNetwork::changedAtcStationsBooked);
|
||||
connect(m_airspace, &CAirspaceMonitor::changedAtcStationOnlineConnectionStatus, this, &CContextNetwork::changedAtcStationOnlineConnectionStatus);
|
||||
connect(m_airspace, &CAirspaceMonitor::changedAircraftInRange, this, &CContextNetwork::changedAircraftInRange);
|
||||
connect(m_airspace, &CAirspaceMonitor::removedAircraft, this, &IContextNetwork::removedAircraft); // DBus
|
||||
connect(m_airspace, &CAirspaceMonitor::readyForModelMatching, this, &CContextNetwork::readyForModelMatching);
|
||||
connect(m_airspace, &CAirspaceMonitor::addedAircraft, this, &CContextNetwork::addedAircraft);
|
||||
}
|
||||
|
||||
CContextNetwork *CContextNetwork::registerWithDBus(BlackMisc::CDBusServer *server)
|
||||
{
|
||||
if (!server || this->m_mode != CCoreFacadeConfig::LocalInDbusServer) return this;
|
||||
if (!server || m_mode != CCoreFacadeConfig::LocalInDbusServer) return this;
|
||||
server->addObject(IContextNetwork::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
@@ -106,31 +106,31 @@ namespace BlackCore
|
||||
|
||||
CAircraftSituationList CContextNetwork::remoteAircraftSituations(const CCallsign &callsign) const
|
||||
{
|
||||
Q_ASSERT(this->m_airspace);
|
||||
Q_ASSERT(m_airspace);
|
||||
return m_airspace->remoteAircraftSituations(callsign);
|
||||
}
|
||||
|
||||
CAircraftPartsList CContextNetwork::remoteAircraftParts(const CCallsign &callsign, qint64 cutoffTimeBefore) const
|
||||
{
|
||||
Q_ASSERT(this->m_airspace);
|
||||
Q_ASSERT(m_airspace);
|
||||
return m_airspace->remoteAircraftParts(callsign, cutoffTimeBefore);
|
||||
}
|
||||
|
||||
int CContextNetwork::remoteAircraftSituationsCount(const CCallsign &callsign) const
|
||||
{
|
||||
Q_ASSERT(this->m_airspace);
|
||||
Q_ASSERT(m_airspace);
|
||||
return m_airspace->remoteAircraftSituationsCount(callsign);
|
||||
}
|
||||
|
||||
bool CContextNetwork::isRemoteAircraftSupportingParts(const CCallsign &callsign) const
|
||||
{
|
||||
Q_ASSERT(this->m_airspace);
|
||||
Q_ASSERT(m_airspace);
|
||||
return m_airspace->isRemoteAircraftSupportingParts(callsign);
|
||||
}
|
||||
|
||||
CCallsignSet CContextNetwork::remoteAircraftSupportingParts() const
|
||||
{
|
||||
Q_ASSERT(this->m_airspace);
|
||||
Q_ASSERT(m_airspace);
|
||||
return m_airspace->remoteAircraftSupportingParts();
|
||||
}
|
||||
|
||||
@@ -141,15 +141,15 @@ namespace BlackCore
|
||||
std::function<void (const CCallsign &)> removedAircraftSlot,
|
||||
std::function<void (const BlackMisc::Simulation::CAirspaceAircraftSnapshot &)> aircraftSnapshotSlot)
|
||||
{
|
||||
Q_ASSERT_X(this->m_airspace, Q_FUNC_INFO, "Missing airspace");
|
||||
return this->m_airspace->connectRemoteAircraftProviderSignals(receiver, situationSlot, partsSlot, removedAircraftSlot, aircraftSnapshotSlot);
|
||||
Q_ASSERT_X(m_airspace, Q_FUNC_INFO, "Missing airspace");
|
||||
return m_airspace->connectRemoteAircraftProviderSignals(receiver, situationSlot, partsSlot, removedAircraftSlot, aircraftSnapshotSlot);
|
||||
}
|
||||
|
||||
void CContextNetwork::gracefulShutdown()
|
||||
{
|
||||
this->disconnect(); // all signals
|
||||
if (this->isConnected()) { this->disconnectFromNetwork(); }
|
||||
if (this->m_airspace) { this->m_airspace->gracefulShutdown(); }
|
||||
if (m_airspace) { m_airspace->gracefulShutdown(); }
|
||||
}
|
||||
|
||||
CStatusMessage CContextNetwork::connectToNetwork(const CServer &server, INetwork::LoginMode mode)
|
||||
@@ -168,7 +168,7 @@ namespace BlackCore
|
||||
{
|
||||
return CStatusMessage(CStatusMessage::SeverityError, msg);
|
||||
}
|
||||
else if (this->m_network->isConnected())
|
||||
else if (m_network->isConnected())
|
||||
{
|
||||
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, "Already connected");
|
||||
}
|
||||
@@ -178,10 +178,10 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_currentStatus = INetwork::Connecting; // as semaphore we are going to connect
|
||||
m_currentStatus = INetwork::Connecting; // as semaphore we are going to connect
|
||||
this->getIContextOwnAircraft()->updateOwnAircraftPilot(server.getUser());
|
||||
const CSimulatedAircraft ownAircraft(this->ownAircraft());
|
||||
this->m_network->presetServer(server);
|
||||
m_network->presetServer(server);
|
||||
|
||||
// Fall back to observer mode, if no simulator is available or not simulating
|
||||
if (CBuildConfig::isStableBranch() && !this->getIContextSimulator()->isSimulatorSimulating())
|
||||
@@ -190,18 +190,18 @@ namespace BlackCore
|
||||
mode = INetwork::LoginAsObserver;
|
||||
}
|
||||
|
||||
this->m_network->presetLoginMode(mode);
|
||||
this->m_network->presetCallsign(ownAircraft.getCallsign());
|
||||
this->m_network->presetIcaoCodes(ownAircraft);
|
||||
m_network->presetLoginMode(mode);
|
||||
m_network->presetCallsign(ownAircraft.getCallsign());
|
||||
m_network->presetIcaoCodes(ownAircraft);
|
||||
if (getIContextSimulator())
|
||||
{
|
||||
this->m_network->presetSimulatorInfo(getIContextSimulator()->getSimulatorPluginInfo());
|
||||
m_network->presetSimulatorInfo(getIContextSimulator()->getSimulatorPluginInfo());
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_network->presetSimulatorInfo(CSimulatorPluginInfo());
|
||||
m_network->presetSimulatorInfo(CSimulatorPluginInfo());
|
||||
}
|
||||
this->m_network->initiateConnection();
|
||||
m_network->initiateConnection();
|
||||
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, "Connection pending " + server.getAddress() + " " + QString::number(server.getPort()));
|
||||
}
|
||||
}
|
||||
@@ -209,17 +209,17 @@ namespace BlackCore
|
||||
CServer CContextNetwork::getConnectedServer() const
|
||||
{
|
||||
return this->isConnected() ?
|
||||
this->m_network->getPresetServer() :
|
||||
m_network->getPresetServer() :
|
||||
CServer();
|
||||
}
|
||||
|
||||
CStatusMessage CContextNetwork::disconnectFromNetwork()
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (this->m_network->isConnected() || this->m_network->isPendingConnection())
|
||||
if (m_network->isConnected() || m_network->isPendingConnection())
|
||||
{
|
||||
this->m_currentStatus = INetwork::Disconnecting; // as semaphore we are going to disconnect
|
||||
this->m_network->terminateConnection();
|
||||
m_currentStatus = INetwork::Disconnecting; // as semaphore we are going to disconnect
|
||||
m_network->terminateConnection();
|
||||
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, "Connection terminating");
|
||||
}
|
||||
else
|
||||
@@ -231,16 +231,16 @@ namespace BlackCore
|
||||
bool CContextNetwork::isConnected() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_network->isConnected();
|
||||
return m_network->isConnected();
|
||||
}
|
||||
|
||||
bool CContextNetwork::isPendingConnection() const
|
||||
{
|
||||
// if underlying class says pending, we believe it. But not all states (e.g. disconnecting) are covered
|
||||
if (this->m_network->isPendingConnection()) return true;
|
||||
if (m_network->isPendingConnection()) return true;
|
||||
|
||||
// now check out own extra states, e.g. disconnecting
|
||||
return INetwork::isPendingStatus(this->m_currentStatus);
|
||||
return INetwork::isPendingStatus(m_currentStatus);
|
||||
}
|
||||
|
||||
bool CContextNetwork::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
|
||||
@@ -333,26 +333,26 @@ namespace BlackCore
|
||||
void CContextNetwork::sendTextMessages(const CTextMessageList &textMessages)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << textMessages; }
|
||||
this->m_network->sendTextMessages(textMessages);
|
||||
m_network->sendTextMessages(textMessages);
|
||||
}
|
||||
|
||||
void CContextNetwork::sendFlightPlan(const CFlightPlan &flightPlan)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << flightPlan; }
|
||||
this->m_network->sendFlightPlan(flightPlan);
|
||||
this->m_network->sendFlightPlanQuery(this->ownAircraft().getCallsign());
|
||||
m_network->sendFlightPlan(flightPlan);
|
||||
m_network->sendFlightPlanQuery(this->ownAircraft().getCallsign());
|
||||
}
|
||||
|
||||
CFlightPlan CContextNetwork::loadFlightPlanFromNetwork(const BlackMisc::Aviation::CCallsign &callsign) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->loadFlightPlanFromNetwork(callsign);
|
||||
return m_airspace->loadFlightPlanFromNetwork(callsign);
|
||||
}
|
||||
|
||||
CUserList CContextNetwork::getUsers() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->getUsers();
|
||||
return m_airspace->getUsers();
|
||||
}
|
||||
|
||||
CUserList CContextNetwork::getUsersForCallsigns(const CCallsignSet &callsigns) const
|
||||
@@ -360,7 +360,7 @@ namespace BlackCore
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
CUserList users;
|
||||
if (callsigns.isEmpty()) return users;
|
||||
return this->m_airspace->getUsersForCallsigns(callsigns);
|
||||
return m_airspace->getUsersForCallsigns(callsigns);
|
||||
}
|
||||
|
||||
CUser CContextNetwork::getUserForCallsign(const CCallsign &callsign) const
|
||||
@@ -376,13 +376,13 @@ namespace BlackCore
|
||||
CClientList CContextNetwork::getOtherClients() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->getOtherClients();
|
||||
return m_airspace->getOtherClients();
|
||||
}
|
||||
|
||||
CClientList CContextNetwork::getOtherClientsForCallsigns(const CCallsignSet &callsigns) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->getOtherClientsForCallsigns(callsigns);
|
||||
return m_airspace->getOtherClientsForCallsigns(callsigns);
|
||||
}
|
||||
|
||||
CServerList CContextNetwork::getVatsimFsdServers() const
|
||||
@@ -402,8 +402,8 @@ namespace BlackCore
|
||||
void CContextNetwork::ps_fsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << from << to; }
|
||||
auto fromOld = this->m_currentStatus; // own status cached
|
||||
this->m_currentStatus = to;
|
||||
auto fromOld = m_currentStatus; // own status cached
|
||||
m_currentStatus = to;
|
||||
|
||||
if (fromOld == INetwork::Disconnecting)
|
||||
{
|
||||
@@ -475,125 +475,125 @@ namespace BlackCore
|
||||
CAtcStationList CContextNetwork::getAtcStationsOnline() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->getAtcStationsOnline();
|
||||
return m_airspace->getAtcStationsOnline();
|
||||
}
|
||||
|
||||
CAtcStationList CContextNetwork::getAtcStationsBooked() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->getAtcStationsBooked();
|
||||
return m_airspace->getAtcStationsBooked();
|
||||
}
|
||||
|
||||
CSimulatedAircraftList CContextNetwork::getAircraftInRange() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->getAircraftInRange();
|
||||
return m_airspace->getAircraftInRange();
|
||||
}
|
||||
|
||||
CCallsignSet CContextNetwork::getAircraftInRangeCallsigns() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->getAircraftInRangeCallsigns();
|
||||
return m_airspace->getAircraftInRangeCallsigns();
|
||||
}
|
||||
|
||||
int CContextNetwork::getAircraftInRangeCount() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->getAircraftInRangeCount();
|
||||
return m_airspace->getAircraftInRangeCount();
|
||||
}
|
||||
|
||||
bool CContextNetwork::isAircraftInRange(const CCallsign &callsign) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->isAircraftInRange(callsign);
|
||||
return m_airspace->isAircraftInRange(callsign);
|
||||
}
|
||||
|
||||
CSimulatedAircraft CContextNetwork::getAircraftInRangeForCallsign(const CCallsign &callsign) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
return this->m_airspace->getAircraftInRangeForCallsign(callsign);
|
||||
return m_airspace->getAircraftInRangeForCallsign(callsign);
|
||||
}
|
||||
|
||||
CAircraftModel CContextNetwork::getAircraftInRangeModelForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
return this->m_airspace->getAircraftInRangeModelForCallsign(callsign);
|
||||
return m_airspace->getAircraftInRangeModelForCallsign(callsign);
|
||||
}
|
||||
|
||||
CStatusMessageList CContextNetwork::getReverseLookupMessages(const CCallsign &callsign) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
return this->m_airspace->getReverseLookupMessages(callsign);
|
||||
return m_airspace->getReverseLookupMessages(callsign);
|
||||
}
|
||||
|
||||
bool CContextNetwork::isReverseLookupMessagesEnabled() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->isReverseLookupMessagesEnabled();
|
||||
return m_airspace->isReverseLookupMessagesEnabled();
|
||||
}
|
||||
|
||||
void CContextNetwork::enableReverseLookupMessages(bool enabled)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; }
|
||||
if (this->m_airspace->isReverseLookupMessagesEnabled() == enabled) { return; }
|
||||
this->m_airspace->enableReverseLookupMessages(enabled);
|
||||
if (m_airspace->isReverseLookupMessagesEnabled() == enabled) { return; }
|
||||
m_airspace->enableReverseLookupMessages(enabled);
|
||||
emit CContext::changedLogOrDebugSettings();
|
||||
}
|
||||
|
||||
CStatusMessageList CContextNetwork::getAircraftPartsHistory(const CCallsign &callsign) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
return this->m_airspace->getAircraftPartsHistory(callsign);
|
||||
return m_airspace->getAircraftPartsHistory(callsign);
|
||||
}
|
||||
|
||||
CAircraftPartsList CContextNetwork::getRemoteAircraftParts(const CCallsign &callsign, qint64 cutoffTimeValuesBefore) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
return this->m_airspace->remoteAircraftParts(callsign, cutoffTimeValuesBefore);
|
||||
return m_airspace->remoteAircraftParts(callsign, cutoffTimeValuesBefore);
|
||||
}
|
||||
|
||||
bool CContextNetwork::isAircraftPartsHistoryEnabled() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return this->m_airspace->isAircraftPartsHistoryEnabled();
|
||||
return m_airspace->isAircraftPartsHistoryEnabled();
|
||||
}
|
||||
|
||||
void CContextNetwork::enableAircraftPartsHistory(bool enabled)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << enabled; }
|
||||
this->m_airspace->enableAircraftPartsHistory(enabled);
|
||||
m_airspace->enableAircraftPartsHistory(enabled);
|
||||
emit CContext::changedLogOrDebugSettings();
|
||||
}
|
||||
|
||||
CAtcStation CContextNetwork::getOnlineStationForCallsign(const CCallsign &callsign) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
return this->m_airspace->getAtcStationsOnline().findFirstByCallsign(callsign);
|
||||
return m_airspace->getAtcStationsOnline().findFirstByCallsign(callsign);
|
||||
}
|
||||
|
||||
void CContextNetwork::requestDataUpdates()
|
||||
{
|
||||
Q_ASSERT(this->m_network);
|
||||
Q_ASSERT(m_network);
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!this->isConnected()) { return; }
|
||||
|
||||
this->requestAtisUpdates();
|
||||
this->m_airspace->requestDataUpdates();
|
||||
m_airspace->requestDataUpdates();
|
||||
}
|
||||
|
||||
void CContextNetwork::requestAtisUpdates()
|
||||
{
|
||||
Q_ASSERT(this->m_network);
|
||||
Q_ASSERT(m_network);
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!this->isConnected()) { return; }
|
||||
|
||||
this->m_airspace->requestAtisUpdates();
|
||||
m_airspace->requestAtisUpdates();
|
||||
}
|
||||
|
||||
bool CContextNetwork::updateAircraftEnabled(const CCallsign &callsign, bool enabledForRendering)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << enabledForRendering; }
|
||||
bool c = this->m_airspace->updateAircraftEnabled(callsign, enabledForRendering);
|
||||
bool c = m_airspace->updateAircraftEnabled(callsign, enabledForRendering);
|
||||
if (c)
|
||||
{
|
||||
CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign));
|
||||
@@ -606,7 +606,7 @@ namespace BlackCore
|
||||
bool CContextNetwork::updateAircraftModel(const CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << model; }
|
||||
bool c = this->m_airspace->updateAircraftModel(callsign, model, originator);
|
||||
bool c = m_airspace->updateAircraftModel(callsign, model, originator);
|
||||
if (c)
|
||||
{
|
||||
const CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign));
|
||||
@@ -619,7 +619,7 @@ namespace BlackCore
|
||||
bool CContextNetwork::updateAircraftNetworkModel(const CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << model; }
|
||||
const bool c = this->m_airspace->updateAircraftNetworkModel(callsign, model, originator);
|
||||
const bool c = m_airspace->updateAircraftNetworkModel(callsign, model, originator);
|
||||
if (c)
|
||||
{
|
||||
const CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign));
|
||||
@@ -631,7 +631,7 @@ namespace BlackCore
|
||||
bool CContextNetwork::updateFastPositionEnabled(const CCallsign &callsign, bool enableFastPositonUpdates)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign << enableFastPositonUpdates; }
|
||||
bool c = this->m_airspace->updateFastPositionEnabled(callsign, enableFastPositonUpdates);
|
||||
bool c = m_airspace->updateFastPositionEnabled(callsign, enableFastPositonUpdates);
|
||||
if (c)
|
||||
{
|
||||
CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign));
|
||||
@@ -644,61 +644,61 @@ namespace BlackCore
|
||||
void CContextNetwork::requestAtcBookingsUpdate() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
this->m_airspace->requestAtcBookingsUpdate();
|
||||
m_airspace->requestAtcBookingsUpdate();
|
||||
}
|
||||
|
||||
bool CContextNetwork::updateAircraftRendered(const CCallsign &callsign, bool rendered)
|
||||
{
|
||||
bool c = this->m_airspace->updateAircraftRendered(callsign, rendered);
|
||||
bool c = m_airspace->updateAircraftRendered(callsign, rendered);
|
||||
return c;
|
||||
}
|
||||
|
||||
bool CContextNetwork::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation)
|
||||
{
|
||||
return this->m_airspace->updateAircraftGroundElevation(callsign, elevation);
|
||||
return m_airspace->updateAircraftGroundElevation(callsign, elevation);
|
||||
}
|
||||
|
||||
void CContextNetwork::updateMarkAllAsNotRendered()
|
||||
{
|
||||
this->m_airspace->updateMarkAllAsNotRendered();
|
||||
m_airspace->updateMarkAllAsNotRendered();
|
||||
}
|
||||
|
||||
CAirspaceAircraftSnapshot CContextNetwork::getLatestAirspaceAircraftSnapshot() const
|
||||
{
|
||||
return this->m_airspace->getLatestAirspaceAircraftSnapshot();
|
||||
return m_airspace->getLatestAirspaceAircraftSnapshot();
|
||||
}
|
||||
|
||||
void CContextNetwork::setFastPositionEnabledCallsigns(CCallsignSet &callsigns)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsigns; }
|
||||
Q_ASSERT(this->m_network);
|
||||
this->m_network->setInterimPositionReceivers(callsigns);
|
||||
Q_ASSERT(m_network);
|
||||
m_network->setInterimPositionReceivers(callsigns);
|
||||
}
|
||||
|
||||
CCallsignSet CContextNetwork::getFastPositionEnabledCallsigns() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
Q_ASSERT(this->m_network);
|
||||
return this->m_network->getInterimPositionReceivers();
|
||||
Q_ASSERT(m_network);
|
||||
return m_network->getInterimPositionReceivers();
|
||||
}
|
||||
|
||||
void CContextNetwork::testRequestAircraftConfig(const CCallsign &callsign)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
Q_ASSERT(this->m_network);
|
||||
this->m_network->sendAircraftConfigQuery(callsign);
|
||||
Q_ASSERT(m_network);
|
||||
m_network->sendAircraftConfigQuery(callsign);
|
||||
}
|
||||
|
||||
void CContextNetwork::testCreateDummyOnlineAtcStations(int number)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << number; }
|
||||
this->m_airspace->testCreateDummyOnlineAtcStations(number);
|
||||
m_airspace->testCreateDummyOnlineAtcStations(number);
|
||||
}
|
||||
|
||||
void CContextNetwork::testAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const CAircraftParts &parts, bool incremental)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << parts << incremental; }
|
||||
this->m_airspace->testAddAircraftParts(callsign, parts, incremental);
|
||||
m_airspace->testAddAircraftParts(callsign, parts, incremental);
|
||||
}
|
||||
|
||||
void CContextNetwork::testReceivedTextMessages(const CTextMessageList &textMessages)
|
||||
@@ -719,8 +719,8 @@ namespace BlackCore
|
||||
CAtcStationList CContextNetwork::getSelectedAtcStations() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
CAtcStation com1Station = this->m_airspace->getAtcStationForComUnit(this->ownAircraft().getCom1System());
|
||||
CAtcStation com2Station = this->m_airspace->getAtcStationForComUnit(this->ownAircraft().getCom2System());
|
||||
CAtcStation com1Station = m_airspace->getAtcStationForComUnit(this->ownAircraft().getCom1System());
|
||||
CAtcStation com2Station = m_airspace->getAtcStationForComUnit(this->ownAircraft().getCom2System());
|
||||
|
||||
CAtcStationList selectedStations;
|
||||
selectedStations.push_back(com1Station);
|
||||
|
||||
@@ -205,10 +205,10 @@ namespace BlackCore
|
||||
CAirspaceMonitor *airspace() const { return m_airspace; }
|
||||
|
||||
private:
|
||||
CAirspaceMonitor *m_airspace = nullptr;
|
||||
INetwork *m_network = nullptr;
|
||||
INetwork::ConnectionStatus m_currentStatus = INetwork::Disconnected; //!< used to detect pending connections
|
||||
QTimer *m_networkDataUpdateTimer = nullptr; //!< general updates such as ATIS, frequencies, see requestDataUpdates()
|
||||
CAirspaceMonitor *m_airspace = nullptr;
|
||||
INetwork *m_network = nullptr;
|
||||
INetwork::ConnectionStatus m_currentStatus = INetwork::Disconnected; //!< used to detect pending connections
|
||||
QTimer *m_networkDataUpdateTimer = nullptr; //!< general updates such as ATIS, frequencies, see requestDataUpdates()
|
||||
|
||||
// Digest signals, only sending after some time
|
||||
BlackMisc::CDigestSignal m_dsAtcStationsBookedChanged { this, &IContextNetwork::changedAtcStationsBooked, &IContextNetwork::changedAtcStationsBookedDigest, 750, 2 };
|
||||
|
||||
@@ -73,40 +73,40 @@ namespace BlackCore
|
||||
|
||||
CContextOwnAircraft *CContextOwnAircraft::registerWithDBus(CDBusServer *server)
|
||||
{
|
||||
if (!server || this->m_mode != CCoreFacadeConfig::LocalInDbusServer) return this;
|
||||
if (!server || m_mode != CCoreFacadeConfig::LocalInDbusServer) return this;
|
||||
server->addObject(IContextOwnAircraft::ObjectPath(), this);
|
||||
return this;
|
||||
}
|
||||
|
||||
CSimulatedAircraft CContextOwnAircraft::getOwnAircraft() const
|
||||
{
|
||||
if (this->m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
QReadLocker l(&m_lockAircraft);
|
||||
return this->m_ownAircraft;
|
||||
return m_ownAircraft;
|
||||
}
|
||||
|
||||
CCoordinateGeodetic CContextOwnAircraft::getOwnAircraftPosition() const
|
||||
{
|
||||
QReadLocker l(&m_lockAircraft);
|
||||
return this->m_ownAircraft.getPosition();
|
||||
return m_ownAircraft.getPosition();
|
||||
}
|
||||
|
||||
CAircraftSituation CContextOwnAircraft::getOwnAircraftSituation() const
|
||||
{
|
||||
QReadLocker l(&m_lockAircraft);
|
||||
return this->m_ownAircraft.getSituation();
|
||||
return m_ownAircraft.getSituation();
|
||||
}
|
||||
|
||||
CAircraftParts CContextOwnAircraft::getOwnAircraftParts() const
|
||||
{
|
||||
QReadLocker l(&m_lockAircraft);
|
||||
return this->m_ownAircraft.getParts();
|
||||
return m_ownAircraft.getParts();
|
||||
}
|
||||
|
||||
CAircraftModel CContextOwnAircraft::getOwnAircraftModel() const
|
||||
{
|
||||
QReadLocker l(&m_lockAircraft);
|
||||
return this->m_ownAircraft.getModel();
|
||||
return m_ownAircraft.getModel();
|
||||
}
|
||||
|
||||
CLength CContextOwnAircraft::getDistanceToOwnAircraft(const ICoordinateGeodetic &position) const
|
||||
@@ -121,13 +121,13 @@ namespace BlackCore
|
||||
{
|
||||
// use copy to minimize lock time
|
||||
QReadLocker rl(&m_lockAircraft);
|
||||
ownAircraft = this->m_ownAircraft;
|
||||
ownAircraft = m_ownAircraft;
|
||||
}
|
||||
|
||||
ownAircraft.initComSystems();
|
||||
ownAircraft.initTransponder();
|
||||
ownAircraft.setSituation(getDefaultSituation());
|
||||
ownAircraft.setPilot(this->m_currentNetworkServer.get().getUser());
|
||||
ownAircraft.setPilot(m_currentNetworkServer.get().getUser());
|
||||
|
||||
// If we already have a model from somehwere, keep it, otherwise init default
|
||||
ownAircraft.setModel(this->reverseLookupModel(ownAircraft.getModel()));
|
||||
@@ -163,16 +163,16 @@ namespace BlackCore
|
||||
if (!this->getIContextNetwork() || !this->getIContextAudio() || !this->getIContextApplication()) { return; } // no chance to resolve rooms
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
|
||||
if (this->m_voiceRoom1UrlOverride.isEmpty() && this->m_voiceRoom2UrlOverride.isEmpty() && !this->m_automaticVoiceRoomResolution) { return; }
|
||||
if (!this->m_automaticVoiceRoomResolution) { return; } // not responsible
|
||||
if (m_voiceRoom1UrlOverride.isEmpty() && m_voiceRoom2UrlOverride.isEmpty() && !m_automaticVoiceRoomResolution) { return; }
|
||||
if (!m_automaticVoiceRoomResolution) { return; } // not responsible
|
||||
|
||||
// requires correct frequencies set
|
||||
// but local network uses exactly this object here, so if frequencies are set here,
|
||||
// they are for network context as well
|
||||
CVoiceRoomList rooms = this->getIContextNetwork()->getSelectedVoiceRooms();
|
||||
|
||||
if (!this->m_voiceRoom1UrlOverride.isEmpty()) rooms[0] = CVoiceRoom(this->m_voiceRoom1UrlOverride);
|
||||
if (!this->m_voiceRoom2UrlOverride.isEmpty()) rooms[1] = CVoiceRoom(this->m_voiceRoom2UrlOverride);
|
||||
if (!m_voiceRoom1UrlOverride.isEmpty()) rooms[0] = CVoiceRoom(m_voiceRoom1UrlOverride);
|
||||
if (!m_voiceRoom2UrlOverride.isEmpty()) rooms[1] = CVoiceRoom(m_voiceRoom2UrlOverride);
|
||||
|
||||
// set the rooms
|
||||
emit this->getIContextApplication()->fakedSetComVoiceRoom(rooms);
|
||||
@@ -189,9 +189,9 @@ namespace BlackCore
|
||||
{
|
||||
CAircraftModel updateModel(this->reverseLookupModel(model));
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
const bool changed = (this->m_ownAircraft.getModel() != updateModel);
|
||||
const bool changed = (m_ownAircraft.getModel() != updateModel);
|
||||
if (!changed) { return false; }
|
||||
this->m_ownAircraft.setModel(updateModel);
|
||||
m_ownAircraft.setModel(updateModel);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -199,46 +199,46 @@ namespace BlackCore
|
||||
{
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
// there is intentionally no equal check
|
||||
this->m_ownAircraft.setSituation(situation);
|
||||
m_ownAircraft.setSituation(situation);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::updateOwnParts(const CAircraftParts &parts)
|
||||
{
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
bool changed = (this->m_ownAircraft.getParts() != parts);
|
||||
bool changed = (m_ownAircraft.getParts() != parts);
|
||||
if (!changed) { return false; }
|
||||
this->m_ownAircraft.setParts(parts);
|
||||
m_ownAircraft.setParts(parts);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::updateOwnPosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude)
|
||||
{
|
||||
if (this->m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << position << altitude; }
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << position << altitude; }
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
bool changed = (this->m_ownAircraft.getPosition() != position);
|
||||
if (changed) { this->m_ownAircraft.setPosition(position); }
|
||||
bool changed = (m_ownAircraft.getPosition() != position);
|
||||
if (changed) { m_ownAircraft.setPosition(position); }
|
||||
|
||||
if (this->m_ownAircraft.getAltitude() != altitude)
|
||||
if (m_ownAircraft.getAltitude() != altitude)
|
||||
{
|
||||
changed = true;
|
||||
this->m_ownAircraft.setAltitude(altitude);
|
||||
m_ownAircraft.setAltitude(altitude);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::updateCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder, const CIdentifier &originator)
|
||||
{
|
||||
if (this->m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder; }
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder; }
|
||||
bool changed;
|
||||
{
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
changed = this->m_ownAircraft.hasChangedCockpitData(com1, com2, transponder);
|
||||
if (changed) { this->m_ownAircraft.setCockpit(com1, com2, transponder); }
|
||||
changed = m_ownAircraft.hasChangedCockpitData(com1, com2, transponder);
|
||||
if (changed) { m_ownAircraft.setCockpit(com1, com2, transponder); }
|
||||
}
|
||||
if (changed)
|
||||
{
|
||||
emit this->changedAircraftCockpit(this->m_ownAircraft, originator);
|
||||
emit this->changedAircraftCockpit(m_ownAircraft, originator);
|
||||
this->resolveVoiceRooms();
|
||||
}
|
||||
return changed;
|
||||
@@ -252,9 +252,9 @@ namespace BlackCore
|
||||
CTransponder xpdr;
|
||||
{
|
||||
QReadLocker l(&m_lockAircraft);
|
||||
com1 = this->m_ownAircraft.getCom1System();
|
||||
com2 = this->m_ownAircraft.getCom2System();
|
||||
xpdr = this->m_ownAircraft.getTransponder();
|
||||
com1 = m_ownAircraft.getCom1System();
|
||||
com2 = m_ownAircraft.getCom2System();
|
||||
xpdr = m_ownAircraft.getTransponder();
|
||||
}
|
||||
if (unit == CComSystem::Com1)
|
||||
{
|
||||
@@ -271,8 +271,8 @@ namespace BlackCore
|
||||
{
|
||||
{
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
if (this->m_ownAircraft.getPilot() == pilot) { return false; }
|
||||
this->m_ownAircraft.setPilot(pilot);
|
||||
if (m_ownAircraft.getPilot() == pilot) { return false; }
|
||||
m_ownAircraft.setPilot(pilot);
|
||||
}
|
||||
emit this->changedPilot(pilot);
|
||||
return true;
|
||||
@@ -282,8 +282,8 @@ namespace BlackCore
|
||||
{
|
||||
{
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
if (this->m_ownAircraft.getCallsign() == callsign) { return false; }
|
||||
this->m_ownAircraft.setCallsign(callsign);
|
||||
if (m_ownAircraft.getCallsign() == callsign) { return false; }
|
||||
m_ownAircraft.setCallsign(callsign);
|
||||
}
|
||||
emit this->changedCallsign(callsign);
|
||||
return true;
|
||||
@@ -293,7 +293,7 @@ namespace BlackCore
|
||||
{
|
||||
{
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
if (!this->m_ownAircraft.setIcaoCodes(aircraftIcaoCode, airlineIcaoCode)) { return false; }
|
||||
if (!m_ownAircraft.setIcaoCodes(aircraftIcaoCode, airlineIcaoCode)) { return false; }
|
||||
}
|
||||
emit this->changedAircraftIcaoCodes(aircraftIcaoCode, airlineIcaoCode);
|
||||
return true;
|
||||
@@ -303,8 +303,8 @@ namespace BlackCore
|
||||
{
|
||||
{
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
if (this->m_ownAircraft.getSelcal() == selcal) { return false; }
|
||||
this->m_ownAircraft.setSelcal(selcal);
|
||||
if (m_ownAircraft.getSelcal() == selcal) { return false; }
|
||||
m_ownAircraft.setSelcal(selcal);
|
||||
}
|
||||
emit this->changedSelcal(selcal, originator);
|
||||
return true;
|
||||
@@ -338,16 +338,16 @@ namespace BlackCore
|
||||
|
||||
void CContextOwnAircraft::setAudioVoiceRoomOverrideUrls(const QString &voiceRoom1Url, const QString &voiceRoom2Url)
|
||||
{
|
||||
if (this->m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << voiceRoom1Url << voiceRoom2Url; }
|
||||
this->m_voiceRoom1UrlOverride = voiceRoom1Url.trimmed();
|
||||
this->m_voiceRoom2UrlOverride = voiceRoom2Url.trimmed();
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << voiceRoom1Url << voiceRoom2Url; }
|
||||
m_voiceRoom1UrlOverride = voiceRoom1Url.trimmed();
|
||||
m_voiceRoom2UrlOverride = voiceRoom2Url.trimmed();
|
||||
this->resolveVoiceRooms();
|
||||
}
|
||||
|
||||
void CContextOwnAircraft::enableAutomaticVoiceRoomResolution(bool enable)
|
||||
{
|
||||
if (this->m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << enable; }
|
||||
this->m_automaticVoiceRoomResolution = enable;
|
||||
if (m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << enable; }
|
||||
m_automaticVoiceRoomResolution = enable;
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
|
||||
|
||||
Reference in New Issue
Block a user