mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 21:45:34 +08:00
Implement followAircraft for X-Plane
ref T266
This commit is contained in:
committed by
Klaus Basan
parent
794137fc94
commit
33963041cc
@@ -78,5 +78,8 @@ R"(<node>
|
||||
<arg type="s" direction="out"/>
|
||||
<arg type="d" direction="out"/>
|
||||
</method>
|
||||
<method name="setFollowedAircraft">
|
||||
<arg name="callsign" type="s" direction="in"/>
|
||||
</method>
|
||||
</interface>
|
||||
</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 =
|
||||
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
|
||||
#include "org.swift_project.xswiftbus.traffic.xml"
|
||||
@@ -655,6 +663,17 @@ namespace XSwiftBus
|
||||
; sendDBusMessage(reply);
|
||||
});
|
||||
}
|
||||
else if (message.getMethodName() == "setFollowedAircraft")
|
||||
{
|
||||
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
||||
std::string callsign;
|
||||
message.beginArgumentRead();
|
||||
message.getArgument(callsign);
|
||||
queueDBusCall([ = ]()
|
||||
{
|
||||
setFollowedAircraft(callsign);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unknown message. Tell DBus that we cannot handle it
|
||||
|
||||
@@ -114,6 +114,9 @@ namespace XSwiftBus
|
||||
//! Get the ground elevation at an arbitrary position
|
||||
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;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user