mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +08:00
[XSwiftBus] Convert setPlanesTransponders to list setter
ref T374
This commit is contained in:
committed by
Klaus Basan
parent
65d00dca6e
commit
616cc241f4
@@ -115,9 +115,11 @@ namespace BlackSimPlugin
|
|||||||
planesSurfaces.navLights, planesSurfaces.lightPatterns);
|
planesSurfaces.navLights, planesSurfaces.lightPatterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXSwiftBusTrafficProxy::setPlaneTransponder(const QString &callsign, int code, bool modeC, bool ident)
|
void CXSwiftBusTrafficProxy::setPlanesTransponders(const PlanesTransponders &planesTransponders)
|
||||||
{
|
{
|
||||||
m_dbusInterface->callDBus(QLatin1String("setPlaneTransponder"), callsign, code, modeC, ident);
|
m_dbusInterface->callDBus(QLatin1String("setPlanesTransponders"),
|
||||||
|
planesTransponders.callsigns, planesTransponders.codes,
|
||||||
|
planesTransponders.modeCs, planesTransponders.idents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXSwiftBusTrafficProxy::setInterpolatorMode(const QString &callsign, bool spline)
|
void CXSwiftBusTrafficProxy::setInterpolatorMode(const QString &callsign, bool spline)
|
||||||
|
|||||||
@@ -87,6 +87,18 @@ namespace BlackSimPlugin
|
|||||||
QList<int> lightPatterns; //!< List of lightPatterns
|
QList<int> lightPatterns; //!< List of lightPatterns
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Plane Transponders
|
||||||
|
struct PlanesTransponders
|
||||||
|
{
|
||||||
|
//! Is empty?
|
||||||
|
bool isEmpty() const { return callsigns.isEmpty(); }
|
||||||
|
|
||||||
|
QStringList callsigns;
|
||||||
|
QList<int> codes;
|
||||||
|
QList<bool> modeCs;
|
||||||
|
QList<bool> idents;
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Proxy object connected to a real XSwiftBus::CTraffic object via DBus
|
* Proxy object connected to a real XSwiftBus::CTraffic object via DBus
|
||||||
*/
|
*/
|
||||||
@@ -172,8 +184,8 @@ namespace BlackSimPlugin
|
|||||||
//! \copydoc XSwiftBus::CTraffic::setPlanesSurfaces
|
//! \copydoc XSwiftBus::CTraffic::setPlanesSurfaces
|
||||||
void setPlanesSurfaces(const PlanesSurfaces &planesSurfaces);
|
void setPlanesSurfaces(const PlanesSurfaces &planesSurfaces);
|
||||||
|
|
||||||
//! \copydoc XSwiftBus::CTraffic::setPlaneTransponder
|
//! \copydoc XSwiftBus::CTraffic::setPlanesTransponders
|
||||||
void setPlaneTransponder(const QString &callsign, int code, bool modeC, bool ident);
|
void setPlanesTransponders(const PlanesTransponders &planesTransponders);
|
||||||
|
|
||||||
//! \deprecated XSwiftBus::CTraffic::setInterpolatorMode
|
//! \deprecated XSwiftBus::CTraffic::setInterpolatorMode
|
||||||
void setInterpolatorMode(const QString &callsign, bool spline);
|
void setInterpolatorMode(const QString &callsign, bool spline);
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ R"(<node>
|
|||||||
<arg name="navLights" type="ab" direction="in"/>
|
<arg name="navLights" type="ab" direction="in"/>
|
||||||
<arg name="lightPatterns" type="ai" direction="in"/>
|
<arg name="lightPatterns" type="ai" direction="in"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="setPlaneTransponder">
|
<method name="setPlanesTransponders">
|
||||||
<arg name="callsign" type="s" direction="in"/>
|
<arg name="callsigns" type="as" direction="in"/>
|
||||||
<arg name="code" type="i" direction="in"/>
|
<arg name="codes" type="ai" direction="in"/>
|
||||||
<arg name="modeC" type="b" direction="in"/>
|
<arg name="modeCs" type="ab" direction="in"/>
|
||||||
<arg name="ident" type="b" direction="in"/>
|
<arg name="idents" type="ab" direction="in"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="getRemoteAircraftData">
|
<method name="getRemoteAircraftData">
|
||||||
<arg name="callsigns" type="as" direction="in"/>
|
<arg name="callsigns" type="as" direction="in"/>
|
||||||
|
|||||||
@@ -370,19 +370,23 @@ namespace XSwiftBus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraffic::setPlaneTransponder(const std::string &callsign, int code, bool modeC, bool ident)
|
void CTraffic::setPlanesTransponders(const std::vector<std::string> &callsigns, const std::vector<int> &codes, const std::vector<bool> &modeCs, const std::vector<bool> &idents)
|
||||||
{
|
{
|
||||||
auto planeIt = m_planesByCallsign.find(callsign);
|
for (size_t i = 0; i < callsigns.size(); i++)
|
||||||
|
{
|
||||||
|
auto planeIt = m_planesByCallsign.find(callsigns.at(i));
|
||||||
if (planeIt == m_planesByCallsign.end()) { return; }
|
if (planeIt == m_planesByCallsign.end()) { return; }
|
||||||
|
|
||||||
Plane *plane = planeIt->second;
|
Plane *plane = planeIt->second;
|
||||||
if (!plane) { return; }
|
if (!plane) { return; }
|
||||||
|
|
||||||
plane->hasXpdr = true;
|
plane->hasXpdr = true;
|
||||||
plane->xpdr.code = code;
|
plane->xpdr.code = codes.at(i);
|
||||||
if (ident) { plane->xpdr.mode = xpmpTransponderMode_ModeC_Ident; }
|
if (idents.at(i)) { plane->xpdr.mode = xpmpTransponderMode_ModeC_Ident; }
|
||||||
else if (modeC) { plane->xpdr.mode = xpmpTransponderMode_ModeC; }
|
else if (modeCs.at(i)) { plane->xpdr.mode = xpmpTransponderMode_ModeC; }
|
||||||
else { plane->xpdr.mode = xpmpTransponderMode_Standby; }
|
else { plane->xpdr.mode = xpmpTransponderMode_Standby; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CTraffic::getRemoteAircraftData(std::vector<std::string> &callsigns, std::vector<double> &latitudesDeg, std::vector<double> &longitudesDeg,
|
void CTraffic::getRemoteAircraftData(std::vector<std::string> &callsigns, std::vector<double> &latitudesDeg, std::vector<double> &longitudesDeg,
|
||||||
std::vector<double> &elevationsM, std::vector<double> &verticalOffsets) const
|
std::vector<double> &elevationsM, std::vector<double> &verticalOffsets) const
|
||||||
@@ -642,21 +646,21 @@ namespace XSwiftBus
|
|||||||
rudders, ailerons, landLights, beaconLights, strobeLights, navLights, lightPatterns);
|
rudders, ailerons, landLights, beaconLights, strobeLights, navLights, lightPatterns);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (message.getMethodName() == "setPlaneTransponder")
|
else if (message.getMethodName() == "setPlanesTransponders")
|
||||||
{
|
{
|
||||||
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
||||||
std::string callsign;
|
std::vector<std::string> callsigns;
|
||||||
int code = 0;
|
std::vector<int> codes;
|
||||||
bool modeC = false;
|
std::vector<bool> modeCs;
|
||||||
bool ident = false;
|
std::vector<bool> idents;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(callsign);
|
message.getArgument(callsigns);
|
||||||
message.getArgument(code);
|
message.getArgument(codes);
|
||||||
message.getArgument(modeC);
|
message.getArgument(modeCs);
|
||||||
message.getArgument(ident);
|
message.getArgument(idents);
|
||||||
queueDBusCall([ = ]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setPlaneTransponder(callsign, code, modeC, ident);
|
setPlanesTransponders(callsigns, codes, modeCs, idents);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (message.getMethodName() == "getRemoteAircraftData")
|
else if (message.getMethodName() == "getRemoteAircraftData")
|
||||||
|
|||||||
@@ -105,8 +105,8 @@ namespace XSwiftBus
|
|||||||
const std::vector<double> &elevators, const std::vector<double> &rudders, const std::vector<double> &ailerons, const std::vector<bool> &landLights,
|
const std::vector<double> &elevators, const std::vector<double> &rudders, const std::vector<double> &ailerons, const std::vector<bool> &landLights,
|
||||||
const std::vector<bool> &beaconLights, const std::vector<bool> &strobeLights, const std::vector<bool> &navLights, const std::vector<int> &lightPatterns);
|
const std::vector<bool> &beaconLights, const std::vector<bool> &strobeLights, const std::vector<bool> &navLights, const std::vector<int> &lightPatterns);
|
||||||
|
|
||||||
//! Set the transponder of a traffic aircraft
|
//! Set the transponder of multiple traffic aircraft
|
||||||
void setPlaneTransponder(const std::string &callsign, int code, bool modeC, bool ident);
|
void setPlanesTransponders(const std::vector<std::string> &callsigns, const std::vector<int> &codes, const std::vector<bool> &modeCs, const std::vector<bool> &idents);
|
||||||
|
|
||||||
//! Get remote aircrafts data (lat, lon, elevation and CG)
|
//! Get remote aircrafts data (lat, lon, elevation and CG)
|
||||||
void getRemoteAircraftData(std::vector<std::string> &callsigns, std::vector<double> &latitudesDeg, std::vector<double> &longitudesDeg,
|
void getRemoteAircraftData(std::vector<std::string> &callsigns, std::vector<double> &latitudesDeg, std::vector<double> &longitudesDeg,
|
||||||
|
|||||||
Reference in New Issue
Block a user