mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +08:00
Implement followAircraft for X-Plane
ref T266
This commit is contained in:
committed by
Klaus Basan
parent
794137fc94
commit
33963041cc
@@ -599,6 +599,13 @@ namespace BlackSimPlugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CSimulatorXPlane::followAircraft(const CCallsign &callsign)
|
||||||
|
{
|
||||||
|
if (! m_trafficProxy || ! m_trafficProxy->isValid()) { return false; }
|
||||||
|
m_trafficProxy->setFollowedAircraft(callsign.toQString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CSimulatorXPlane::injectWeatherGrid(const Weather::CWeatherGrid &weatherGrid)
|
void CSimulatorXPlane::injectWeatherGrid(const Weather::CWeatherGrid &weatherGrid)
|
||||||
{
|
{
|
||||||
Q_ASSERT(isConnected());
|
Q_ASSERT(isConnected());
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ namespace BlackSimPlugin
|
|||||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return BlackMisc::PhysicalQuantities::CTime(0, BlackMisc::PhysicalQuantities::CTimeUnit::hrmin()); }
|
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return BlackMisc::PhysicalQuantities::CTime(0, BlackMisc::PhysicalQuantities::CTimeUnit::hrmin()); }
|
||||||
virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||||
virtual BlackMisc::Aviation::CCallsignSet physicallyRenderedAircraft() const override;
|
virtual BlackMisc::Aviation::CCallsignSet physicallyRenderedAircraft() const override;
|
||||||
|
virtual bool followAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||||
virtual void unload() override;
|
virtual void unload() override;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|||||||
@@ -148,5 +148,10 @@ namespace BlackSimPlugin
|
|||||||
};
|
};
|
||||||
m_dbusInterface->callDBusAsync(QLatin1String("getEelevationAtPosition"), callback, callsign.asString(), latitude, longitude, altitude);
|
m_dbusInterface->callDBusAsync(QLatin1String("getEelevationAtPosition"), callback, callsign.asString(), latitude, longitude, altitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CXSwiftBusTrafficProxy::setFollowedAircraft(const QString &callsign)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBus(QLatin1String("setFollowedAircraft"), callsign);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,6 +136,9 @@ namespace BlackSimPlugin
|
|||||||
void getEelevationAtPosition(const BlackMisc::Aviation::CCallsign &callsign, double latitude, double longitude, double altitude,
|
void getEelevationAtPosition(const BlackMisc::Aviation::CCallsign &callsign, double latitude, double longitude, double altitude,
|
||||||
const ElevationCallback &setter);
|
const ElevationCallback &setter);
|
||||||
|
|
||||||
|
//! \copydoc XSwiftBus::CTraffic::setFollowedAircraft
|
||||||
|
void setFollowedAircraft(const QString &callsign);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlackMisc::CGenericDBusInterface *m_dbusInterface = nullptr;
|
BlackMisc::CGenericDBusInterface *m_dbusInterface = nullptr;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -78,5 +78,8 @@ R"(<node>
|
|||||||
<arg type="s" direction="out"/>
|
<arg type="s" direction="out"/>
|
||||||
<arg type="d" direction="out"/>
|
<arg type="d" direction="out"/>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="setFollowedAircraft">
|
||||||
|
<arg name="callsign" type="s" direction="in"/>
|
||||||
|
</method>
|
||||||
</interface>
|
</interface>
|
||||||
</node>)"
|
</node>)"
|
||||||
|
|||||||
@@ -393,6 +393,14 @@ namespace XSwiftBus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CTraffic::setFollowedAircraft(const std::string &callsign)
|
||||||
|
{
|
||||||
|
auto planeIt = m_planesByCallsign.find(callsign);
|
||||||
|
if (planeIt == m_planesByCallsign.end()) { return; }
|
||||||
|
|
||||||
|
orbitRemotePlane(callsign);
|
||||||
|
}
|
||||||
|
|
||||||
const char *introspection_traffic =
|
const char *introspection_traffic =
|
||||||
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
|
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
|
||||||
#include "org.swift_project.xswiftbus.traffic.xml"
|
#include "org.swift_project.xswiftbus.traffic.xml"
|
||||||
@@ -655,6 +663,17 @@ namespace XSwiftBus
|
|||||||
; sendDBusMessage(reply);
|
; sendDBusMessage(reply);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if (message.getMethodName() == "setFollowedAircraft")
|
||||||
|
{
|
||||||
|
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
||||||
|
std::string callsign;
|
||||||
|
message.beginArgumentRead();
|
||||||
|
message.getArgument(callsign);
|
||||||
|
queueDBusCall([ = ]()
|
||||||
|
{
|
||||||
|
setFollowedAircraft(callsign);
|
||||||
|
});
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Unknown message. Tell DBus that we cannot handle it
|
// Unknown message. Tell DBus that we cannot handle it
|
||||||
|
|||||||
@@ -114,6 +114,9 @@ namespace XSwiftBus
|
|||||||
//! Get the ground elevation at an arbitrary position
|
//! Get the ground elevation at an arbitrary position
|
||||||
double getEelevationAtPosition(const std::string &callsign, double latitude, double longitude, double altitude);
|
double getEelevationAtPosition(const std::string &callsign, double latitude, double longitude, double altitude);
|
||||||
|
|
||||||
|
//! Sets the aircraft with callsign to be followed in plane view
|
||||||
|
void setFollowedAircraft(const std::string &callsign);
|
||||||
|
|
||||||
int processDBus() override;
|
int processDBus() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user