Files
pilotclient/src/blackcore/context_ownaircraft_proxy.cpp
Klaus Basan 269c65b578 As of workshop RW/KB, improved / fixed text messages
Also refs #351
* messages can be formatted with style sheet
* fixed: removed command from message
* added originator to command line
* msg parsing now in core
* using ITimestampBased for text messages and status messages
* allow to resize rows to content (view base)
* model / views for text messages
* removed old qt stylesheets
2015-03-20 17:10:58 +01:00

108 lines
4.7 KiB
C++

/* Copyright (C) 2013
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "blackcore/context_ownaircraft_proxy.h"
#include <QObject>
#include <QMetaEnum>
#include <QDBusConnection>
using namespace BlackMisc;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::Simulation;
namespace BlackCore
{
/*
* Constructor for DBus
*/
CContextOwnAircraftProxy::CContextOwnAircraftProxy(const QString &serviceName, QDBusConnection &connection, CRuntimeConfig::ContextMode mode, CRuntime *runtime) : IContextOwnAircraft(mode, runtime), m_dBusInterface(nullptr)
{
this->m_dBusInterface = new BlackMisc::CGenericDBusInterface(
serviceName , IContextOwnAircraft::ObjectPath(), IContextOwnAircraft::InterfaceName(),
connection, this);
this->relaySignals(serviceName, connection);
}
/*
* Connect signal / slots
*/
void CContextOwnAircraftProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
{
bool s = connection.connect(serviceName, IContextOwnAircraft::ObjectPath(), IContextOwnAircraft::InterfaceName(),
"changedAircraftCockpit", this, SIGNAL(changedAircraftCockpit(BlackMisc::Simulation::CSimulatedAircraft, QString)));
Q_ASSERT(s);
s = connection.connect(serviceName, IContextOwnAircraft::ObjectPath(), IContextOwnAircraft::InterfaceName(),
"fakedVoiceRoomRequest", this, SIGNAL(changedSelcal(BlackMisc::Aviation::CSelcal, QString)));
Q_ASSERT(s);
Q_UNUSED(s);
}
BlackMisc::Simulation::CSimulatedAircraft CContextOwnAircraftProxy::getOwnAircraft() const
{
return this->m_dBusInterface->callDBusRet<BlackMisc::Simulation::CSimulatedAircraft>(QLatin1Literal("getOwnAircraft"));
}
bool CContextOwnAircraftProxy::updatePosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("updatePosition"), position, altitude);
}
bool CContextOwnAircraftProxy::updateCockpit(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2, const BlackMisc::Aviation::CTransponder &transponder, const QString &originator)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("updateCockpit"), com1, com2, transponder, originator);
}
bool CContextOwnAircraftProxy::updateActiveComFrequency(const PhysicalQuantities::CFrequency &frequency, int comUnit, const QString &originator)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("updateActiveComFrequency"), frequency, comUnit, originator);
}
bool CContextOwnAircraftProxy::updatePilot(const BlackMisc::Network::CUser &pilot)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("updatePilot"), pilot);
}
bool CContextOwnAircraftProxy::updateSelcal(const CSelcal &selcal, const QString &originator)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("updateSelcal"), selcal, originator);
}
bool CContextOwnAircraftProxy::updateCallsign(const CCallsign &callsign)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("updateCallsign"), callsign);
}
bool CContextOwnAircraftProxy::updateIcaoData(const CAircraftIcao &icaoData)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("updateIcaoData"), icaoData);
}
void CContextOwnAircraftProxy::setAudioOutputVolume(int outputVolume)
{
this->m_dBusInterface->callDBus(QLatin1Literal("setAudioOutputVolume"), outputVolume);
}
void CContextOwnAircraftProxy::setAudioVoiceRoomOverrideUrls(const QString &voiceRoom1Url, const QString &voiceRoom2Url)
{
this->m_dBusInterface->callDBus(QLatin1Literal("setAudioVoiceRoomOverrideUrls"), voiceRoom1Url, voiceRoom2Url);
}
void CContextOwnAircraftProxy::enableAutomaticVoiceRoomResolution(bool enable)
{
this->m_dBusInterface->callDBus(QLatin1Literal("enableAutomaticVoiceRoomResolution"), enable);
}
bool CContextOwnAircraftProxy::parseCommandLine(const QString &commandLine, const QString &originator)
{
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("parseCommandLine"), commandLine, originator);
}
} // namespace