[XSwiftBus] Give PQ variables a unit

ref T313
This commit is contained in:
Roland Rossgotterer
2018-11-21 16:52:20 +01:00
committed by Klaus Basan
parent 1edef31c0a
commit ec8245ea53
15 changed files with 310 additions and 310 deletions

View File

@@ -57,34 +57,34 @@ R"(<node>
<method name="isUsingRealTime">
<arg type="b" direction="out"/>
</method>
<method name="getLatitude">
<method name="getLatitudeDeg">
<arg type="d" direction="out"/>
</method>
<method name="getLongitude">
<method name="getLongitudeDeg">
<arg type="d" direction="out"/>
</method>
<method name="getAltitudeMSL">
<method name="getAltitudeMslM">
<arg type="d" direction="out"/>
</method>
<method name="getHeightAGL">
<method name="getHeightAglM">
<arg type="d" direction="out"/>
</method>
<method name="getGroundSpeed">
<method name="getGroundSpeedMps">
<arg type="d" direction="out"/>
</method>
<method name="getIndicatedAirspeed">
<method name="getIndicatedAirspeedKias">
<arg type="d" direction="out"/>
</method>
<method name="getTrueAirspeed">
<method name="getTrueAirspeedKias">
<arg type="d" direction="out"/>
</method>
<method name="getPitch">
<method name="getPitchDeg">
<arg type="d" direction="out"/>
</method>
<method name="getRoll">
<method name="getRollDeg">
<arg type="d" direction="out"/>
</method>
<method name="getTrueHeading">
<method name="getTrueHeadingDeg">
<arg type="d" direction="out"/>
</method>
<method name="getAnyWheelOnGround">
@@ -93,16 +93,16 @@ R"(<node>
<method name="getAllWheelsOnGround">
<arg type="b" direction="out"/>
</method>
<method name="getCom1Active">
<method name="getCom1ActiveKhz">
<arg type="i" direction="out"/>
</method>
<method name="getCom1Standby">
<method name="getCom1StandbyKhz">
<arg type="i" direction="out"/>
</method>
<method name="getCom2Active">
<method name="getCom2ActiveKhz">
<arg type="i" direction="out"/>
</method>
<method name="getCom2Standby">
<method name="getCom2StandbyKhz">
<arg type="i" direction="out"/>
</method>
<method name="getTransponderCode">
@@ -129,19 +129,19 @@ R"(<node>
<method name="getTaxiLightsOn">
<arg type="b" direction="out"/>
</method>
<method name="getQNH">
<method name="getQNHInHg">
<arg type="d" direction="out"/>
</method>
<method name="setCom1Active">
<method name="setCom1ActiveKhz">
<arg name="freq" type="i" direction="in"/>
</method>
<method name="setCom1Standby">
<method name="setCom1StandbyKhz">
<arg name="freq" type="i" direction="in"/>
</method>
<method name="setCom2Active">
<method name="setCom2ActiveKhz">
<arg name="freq" type="i" direction="in"/>
</method>
<method name="setCom2Standby">
<method name="setCom2StandbyKhz">
<arg name="freq" type="i" direction="in"/>
</method>
<method name="setTransponderCode">

View File

@@ -171,7 +171,7 @@ namespace XSwiftBus
}
std::vector<std::string> icaos, names;
std::vector<double> lats, lons, alts;
std::vector<CNavDataReference> closestAirports = findClosestAirports(20, getLatitude(), getLongitude());
std::vector<CNavDataReference> closestAirports = findClosestAirports(20, getLatitudeDeg(), getLongitudeDeg());
for (const auto &navref : closestAirports)
{
float lat, lon, alt;
@@ -349,74 +349,74 @@ namespace XSwiftBus
sendDBusReply(sender, serial, isUsingRealTime());
});
}
else if (message.getMethodName() == "getLatitude")
else if (message.getMethodName() == "getLatitudeDeg")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getLatitude());
sendDBusReply(sender, serial, getLatitudeDeg());
});
}
else if (message.getMethodName() == "getLongitude")
else if (message.getMethodName() == "getLongitudeDeg")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getLongitude());
sendDBusReply(sender, serial, getLongitudeDeg());
});
}
else if (message.getMethodName() == "getAltitudeMSL")
else if (message.getMethodName() == "getAltitudeMslM")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getAltitudeMSL());
sendDBusReply(sender, serial, getAltitudeMslM());
});
}
else if (message.getMethodName() == "getHeightAGL")
else if (message.getMethodName() == "getHeightAglM")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getHeightAGL());
sendDBusReply(sender, serial, getHeightAglM());
});
}
else if (message.getMethodName() == "getGroundSpeed")
else if (message.getMethodName() == "getGroundSpeedMps")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getGroundSpeed());
sendDBusReply(sender, serial, getGroundSpeedMps());
});
}
else if (message.getMethodName() == "getIndicatedAirspeed")
else if (message.getMethodName() == "getIndicatedAirspeedKias")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getIndicatedAirspeed());
sendDBusReply(sender, serial, getIndicatedAirspeedKias());
});
}
else if (message.getMethodName() == "getTrueAirspeed")
else if (message.getMethodName() == "getTrueAirspeedKias")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getTrueAirspeed());
sendDBusReply(sender, serial, getTrueAirspeedKias());
});
}
else if (message.getMethodName() == "getPitch")
else if (message.getMethodName() == "getPitchDeg")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getPitch());
sendDBusReply(sender, serial, getPitchDeg());
});
}
else if (message.getMethodName() == "getRoll")
else if (message.getMethodName() == "getRollDeg")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getRoll());
sendDBusReply(sender, serial, getRollDeg());
});
}
else if (message.getMethodName() == "getTrueHeading")
else if (message.getMethodName() == "getTrueHeadingDeg")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getTrueHeading());
sendDBusReply(sender, serial, getTrueHeadingDeg());
});
}
else if (message.getMethodName() == "getAnyWheelOnGround")
@@ -433,32 +433,32 @@ namespace XSwiftBus
sendDBusReply(sender, serial, getAllWheelsOnGround());
});
}
else if (message.getMethodName() == "getCom1Active")
else if (message.getMethodName() == "getCom1ActiveKhz")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getCom1Active());
sendDBusReply(sender, serial, getCom1ActiveKhz());
});
}
else if (message.getMethodName() == "getCom1Standby")
else if (message.getMethodName() == "getCom1StandbyKhz")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getCom1Standby());
sendDBusReply(sender, serial, getCom1StandbyKhz());
});
}
else if (message.getMethodName() == "getCom2Active")
else if (message.getMethodName() == "getCom2ActiveKhz")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getCom2Active());
sendDBusReply(sender, serial, getCom2ActiveKhz());
});
}
else if (message.getMethodName() == "getCom2Standby")
else if (message.getMethodName() == "getCom2StandbyKhz")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getCom2Standby());
sendDBusReply(sender, serial, getCom2StandbyKhz());
});
}
else if (message.getMethodName() == "getTransponderCode")
@@ -517,14 +517,14 @@ namespace XSwiftBus
sendDBusReply(sender, serial, getTaxiLightsOn());
});
}
else if (message.getMethodName() == "getQNH")
else if (message.getMethodName() == "getQNHInHg")
{
queueDBusCall([ = ]()
{
sendDBusReply(sender, serial, getQNH());
sendDBusReply(sender, serial, getQNHInHg());
});
}
else if (message.getMethodName() == "setCom1Active")
else if (message.getMethodName() == "setCom1ActiveKhz")
{
maybeSendEmptyDBusReply(wantsReply, sender, serial);
int frequency = 0;
@@ -532,10 +532,10 @@ namespace XSwiftBus
message.getArgument(frequency);
queueDBusCall([ = ]()
{
setCom1Active(frequency);
setCom1ActiveKhz(frequency);
});
}
else if (message.getMethodName() == "setCom1Standby")
else if (message.getMethodName() == "setCom1StandbyKhz")
{
maybeSendEmptyDBusReply(wantsReply, sender, serial);
int frequency = 0;
@@ -543,10 +543,10 @@ namespace XSwiftBus
message.getArgument(frequency);
queueDBusCall([ = ]()
{
setCom1Standby(frequency);
setCom1StandbyKhz(frequency);
});
}
else if (message.getMethodName() == "setCom2Active")
else if (message.getMethodName() == "setCom2ActiveKhz")
{
maybeSendEmptyDBusReply(wantsReply, sender, serial);
int frequency = 0;
@@ -554,10 +554,10 @@ namespace XSwiftBus
message.getArgument(frequency);
queueDBusCall([ = ]()
{
setCom2Active(frequency);
setCom2ActiveKhz(frequency);
});
}
else if (message.getMethodName() == "setCom2Standby")
else if (message.getMethodName() == "setCom2StandbyKhz")
{
maybeSendEmptyDBusReply(wantsReply, sender, serial);
int frequency = 0;
@@ -565,7 +565,7 @@ namespace XSwiftBus
message.getArgument(frequency);
queueDBusCall([ = ]()
{
setCom2Standby(frequency);
setCom2StandbyKhz(frequency);
});
}
else if (message.getMethodName() == "setTransponderCode")

View File

@@ -107,34 +107,34 @@ namespace XSwiftBus
bool isUsingRealTime() const { return m_useSystemTime.get(); }
//! Get aircraft latitude in degrees
double getLatitude() const { return m_latitude.get(); }
double getLatitudeDeg() const { return m_latitude.get(); }
//! Get aircraft longitude in degrees
double getLongitude() const { return m_longitude.get(); }
double getLongitudeDeg() const { return m_longitude.get(); }
//! Get aircraft altitude in meters
double getAltitudeMSL() const { return m_elevation.get(); }
double getAltitudeMslM() const { return m_elevation.get(); }
//! Get aircraft height in meters
double getHeightAGL() const { return m_agl.get(); }
double getHeightAglM() const { return m_agl.get(); }
//! Get aircraft groundspeed in meters per second
double getGroundSpeed() const { return m_groundSpeed.get(); }
double getGroundSpeedMps() const { return m_groundSpeed.get(); }
//! Get aircraft IAS in knots
double getIndicatedAirspeed() const { return m_indicatedAirspeed.get(); }
double getIndicatedAirspeedKias() const { return m_indicatedAirspeed.get(); }
//! Get aircraft TAS in meters per second
double getTrueAirspeed() const { return m_trueAirspeed.get(); }
double getTrueAirspeedKias() const { return m_trueAirspeed.get(); }
//! Get aircraft pitch in degrees above horizon
double getPitch() const { return m_pitch.get(); }
double getPitchDeg() const { return m_pitch.get(); }
//! Get aircraft roll in degrees
double getRoll() const { return m_roll.get(); }
double getRollDeg() const { return m_roll.get(); }
//! Get aircraft true heading in degrees
double getTrueHeading() const { return m_heading.get(); }
double getTrueHeadingDeg() const { return m_heading.get(); }
//! Get whether any wheel is on the ground
bool getAnyWheelOnGround() const { return m_onGroundAny.get(); }
@@ -143,16 +143,16 @@ namespace XSwiftBus
bool getAllWheelsOnGround() const { return m_onGroundAll.get(); }
//! Get the current COM1 active frequency in kHz
int getCom1Active() const { return m_com1Active.get() * 10; }
int getCom1ActiveKhz() const { return m_com1Active.get() * 10; }
//! Get the current COM1 standby frequency in kHz
int getCom1Standby() const { return m_com1Standby.get() * 10; }
int getCom1StandbyKhz() const { return m_com1Standby.get() * 10; }
//! Get the current COM2 active frequency in kHz
int getCom2Active() const { return m_com2Active.get() * 10; }
int getCom2ActiveKhz() const { return m_com2Active.get() * 10; }
//! Get the current COM2 standby frequency in kHz
int getCom2Standby() const { return m_com2Standby.get() * 10; }
int getCom2StandbyKhz() const { return m_com2Standby.get() * 10; }
//! Get the current transponder code in decimal
int getTransponderCode() const { return m_xpdrCode.get(); }
@@ -179,19 +179,19 @@ namespace XSwiftBus
bool getTaxiLightsOn() const { return m_taxiLightsOn.get(); }
//! Get barometric pressure at sea level in inches of mercury.
double getQNH() const { return m_qnhInhg.get(); }
double getQNHInHg() const { return m_qnhInhg.get(); }
//! Set the current COM1 active frequency in kHz
void setCom1Active(int freq) { m_com1Active.set(freq / 10); }
void setCom1ActiveKhz(int freq) { m_com1Active.set(freq / 10); }
//! Set the current COM1 standby frequency in kHz
void setCom1Standby(int freq) { m_com1Standby.set(freq / 10); }
void setCom1StandbyKhz(int freq) { m_com1Standby.set(freq / 10); }
//! Set the current COM2 active frequency in kHz
void setCom2Active(int freq) { m_com2Active.set(freq / 10); }
void setCom2ActiveKhz(int freq) { m_com2Active.set(freq / 10); }
//! Set the current COM2 standby frequency in kHz
void setCom2Standby(int freq) { m_com2Standby.set(freq / 10); }
void setCom2StandbyKhz(int freq) { m_com2Standby.set(freq / 10); }
//! Set the current transponder code in decimal
void setTransponderCode(int code) { m_xpdrCode.set(code); }

View File

@@ -318,8 +318,8 @@ namespace XSwiftBus
m_followPlaneViewSequence.clear();
}
void CTraffic::setPlanesPositions(const std::vector<std::string> &callsigns, std::vector<double> latitudes, std::vector<double> longitudes, std::vector<double> altitudes,
std::vector<double> pitches, std::vector<double> rolles, std::vector<double> headings, const std::vector<bool> &onGrounds)
void CTraffic::setPlanesPositions(const std::vector<std::string> &callsigns, std::vector<double> latitudesDeg, std::vector<double> longitudesDeg, std::vector<double> altitudesFt,
std::vector<double> pitchesDeg, std::vector<double> rollsDeg, std::vector<double> headingsDeg, const std::vector<bool> &onGrounds)
{
(void)onGrounds;
@@ -330,12 +330,12 @@ namespace XSwiftBus
Plane *plane = planeIt->second;
if (!plane) { return; }
plane->position.lat = latitudes.at(i);
plane->position.lon = longitudes.at(i);
plane->position.elevation = altitudes.at(i);
plane->position.pitch = static_cast<float>(pitches.at(i));
plane->position.roll = static_cast<float>(rolles.at(i));
plane->position.heading = static_cast<float>(headings.at(i));
plane->position.lat = latitudesDeg.at(i);
plane->position.lon = longitudesDeg.at(i);
plane->position.elevation = altitudesFt.at(i);
plane->position.pitch = static_cast<float>(pitchesDeg.at(i));
plane->position.roll = static_cast<float>(rollsDeg.at(i));
plane->position.heading = static_cast<float>(headingsDeg.at(i));
}
}

View File

@@ -96,8 +96,9 @@ namespace XSwiftBus
void removeAllPlanes();
//! Set the position of multiple traffic aircrafts
void setPlanesPositions(const std::vector<std::string> &callsigns, std::vector<double> latitudes, std::vector<double> longitudes, std::vector<double> altitudes,
std::vector<double> pitches, std::vector<double> rolls, std::vector<double> headings, const std::vector<bool> &onGrounds);
void setPlanesPositions(const std::vector<std::string> &callsigns,
std::vector<double> latitudesDeg, std::vector<double> longitudesDeg, std::vector<double> altitudesFt,
std::vector<double> pitchesDeg, std::vector<double> rollsDeg, std::vector<double> headingsDeg, const std::vector<bool> &onGrounds);
//! Set the flight control surfaces and lights of multiple traffic aircrafts
void setPlanesSurfaces(const std::vector<std::string> &callsigns, const std::vector<double> &gears, const std::vector<double> &flaps, const std::vector<double> &spoilers,

View File

@@ -28,13 +28,13 @@ namespace XSwiftBus
layer.coverage.setAsInt(coverage);
}
void CWeather::setCloudLayer(int layer, int base, int tops, int type, int coverage)
void CWeather::setCloudLayer(int layer, int baseM, int topsM, int type, int coverage)
{
switch (layer)
{
case 0: setCloudLayerImpl(m_cloudLayer0, base, tops, type, coverage); break;
case 1: setCloudLayerImpl(m_cloudLayer1, base, tops, type, coverage); break;
case 2: setCloudLayerImpl(m_cloudLayer2, base, tops, type, coverage); break;
case 0: setCloudLayerImpl(m_cloudLayer0, baseM, topsM, type, coverage); break;
case 1: setCloudLayerImpl(m_cloudLayer1, baseM, topsM, type, coverage); break;
case 2: setCloudLayerImpl(m_cloudLayer2, baseM, topsM, type, coverage); break;
default: DEBUG_LOG("Invalid cloud layer"); break;
}
}
@@ -51,13 +51,13 @@ namespace XSwiftBus
layer.turbulence.setAsInt(turbulence);
}
void CWeather::setWindLayer(int layer, int altitude, double direction, int speed, int shearDirection, int shearSpeed, int turbulence)
void CWeather::setWindLayer(int layer, int altitudeM, double directionDeg, int speedKt, int shearDirectionDeg, int shearSpeedKt, int turbulence)
{
switch (layer)
{
case 0: setWindLayerImpl(m_windLayer0, altitude, direction, speed, shearDirection, shearSpeed, turbulence); break;
case 1: setWindLayerImpl(m_windLayer1, altitude, direction, speed, shearDirection, shearSpeed, turbulence); break;
case 2: setWindLayerImpl(m_windLayer2, altitude, direction, speed, shearDirection, shearSpeed, turbulence); break;
case 0: setWindLayerImpl(m_windLayer0, altitudeM, directionDeg, speedKt, shearDirectionDeg, shearSpeedKt, turbulence); break;
case 1: setWindLayerImpl(m_windLayer1, altitudeM, directionDeg, speedKt, shearDirectionDeg, shearSpeedKt, turbulence); break;
case 2: setWindLayerImpl(m_windLayer2, altitudeM, directionDeg, speedKt, shearDirectionDeg, shearSpeedKt, turbulence); break;
default: DEBUG_LOG("Invalid wind layer"); break;
}
}
@@ -213,23 +213,23 @@ namespace XSwiftBus
{
maybeSendEmptyDBusReply(wantsReply, sender, serial);
int layer = 0;
int altitude = 0;
double direction = 0;
int speed = 0;
int shearDirection = 0;
int shearSpeed = 0;
int altitudeM = 0;
double directionDeg = 0;
int speedKt = 0;
int shearDirectionDeg = 0;
int shearSpeedKt = 0;
int turbulence = 0;
message.beginArgumentRead();
message.getArgument(layer);
message.getArgument(altitude);
message.getArgument(direction);
message.getArgument(speed);
message.getArgument(shearDirection);
message.getArgument(shearSpeed);
message.getArgument(altitudeM);
message.getArgument(directionDeg);
message.getArgument(speedKt);
message.getArgument(shearDirectionDeg);
message.getArgument(shearSpeedKt);
message.getArgument(turbulence);
queueDBusCall([=]()
{
setWindLayer(layer, altitude, direction, speed, shearDirection, shearSpeed, turbulence);
setWindLayer(layer, altitudeM, directionDeg, speedKt, shearDirectionDeg, shearSpeedKt, turbulence);
});
}
else

View File

@@ -81,21 +81,21 @@ namespace XSwiftBus
//! Set a cloud layer.
//! \param layer Layer 0, 1, or 2.
//! \param base Cloud base in meters above mean sea level.
//! \param tops Cloud tops in meters above mean sea level.
//! \param baseM Cloud base in meters above mean sea level.
//! \param topsM Cloud tops in meters above mean sea level.
//! \param type Type of cloud: 0=clear, 1=cirrus, 2=scattered, 3=broken, 4=overcast, 5=stratus.
//! \param coverage Amount of sky covered [0,6].
void setCloudLayer(int layer, int base, int tops, int type, int coverage);
void setCloudLayer(int layer, int baseM, int topsM, int type, int coverage);
//! Set a wind layer.
//! \param layer Layer 0, 1, or 2.
//! \param altitude Altitude in middle of layer in meters above mean sea level.
//! \param direction Direction from which wind is blowing in degrees true.
//! \param speed Wind speed in knots.
//! \param shearDirection Direction from which wind shears blow in degrees true.
//! \param shearSpeed Wind speed gain in knots (e.g. speed=10 and shearSpeed=5 means speed varies between 10 and 15).
//! \param altitudeM Altitude in middle of layer in meters above mean sea level.
//! \param directionDeg Direction from which wind is blowing in degrees true.
//! \param speedKt Wind speed in knots.
//! \param shearDirectionDeg Direction from which wind shears blow in degrees true.
//! \param shearSpeedKt Wind speed gain in knots (e.g. speed=10 and shearSpeed=5 means speed varies between 10 and 15).
//! \param turbulence Amount of turbulence [0,10].
void setWindLayer(int layer, int altitude, double direction, int speed, int shearDirection, int shearSpeed, int turbulence);
void setWindLayer(int layer, int altitudeM, double directionDeg, int speedKt, int shearDirectionDeg, int shearSpeedKt, int turbulence);
//! Perform generic processing
int process();