mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refs #873, added cabin and recognition light plus anyEngineOn
This commit is contained in:
committed by
Mathew Sutcliffe
parent
e3ab9d08c3
commit
b6ac5cbb45
@@ -41,7 +41,12 @@ namespace BlackMisc
|
||||
|
||||
bool CAircraftEngineList::isEngineOn(int engineNumber) const
|
||||
{
|
||||
return getEngine(engineNumber).isOn();
|
||||
return this->getEngine(engineNumber).isOn();
|
||||
}
|
||||
|
||||
bool CAircraftEngineList::isAnyEngineOn() const
|
||||
{
|
||||
return this->contains(&CAircraftEngine::isOn, true);
|
||||
}
|
||||
|
||||
QJsonObject CAircraftEngineList::toJson() const
|
||||
|
||||
@@ -53,14 +53,15 @@ namespace BlackMisc
|
||||
//! Engine number 1..x on?
|
||||
bool isEngineOn(int engineNumber) const;
|
||||
|
||||
//! Is any engine on?
|
||||
bool isAnyEngineOn() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::JsonByMetaClass::toJson
|
||||
QJsonObject toJson() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::JsonByMetaClass::convertFromJson
|
||||
void convertFromJson(const QJsonObject &json);
|
||||
|
||||
};
|
||||
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -22,24 +22,31 @@ namespace BlackMisc
|
||||
: m_strobeOn(strobeOn), m_landingOn(landingOn), m_taxiOn(taxiOn), m_beaconOn(beaconOn), m_navOn(navOn), m_logoOn(logoOn)
|
||||
{ }
|
||||
|
||||
CAircraftLights::CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn, bool recognition, bool cabin)
|
||||
: m_strobeOn(strobeOn), m_landingOn(landingOn), m_taxiOn(taxiOn), m_beaconOn(beaconOn), m_navOn(navOn), m_logoOn(logoOn), m_recognition(recognition), m_cabin(cabin)
|
||||
{ }
|
||||
|
||||
CAircraftLights CAircraftLights::allLightsOn()
|
||||
{
|
||||
return CAircraftLights {true, true, true, true, true, true};
|
||||
return CAircraftLights {true, true, true, true, true, true, true, true};
|
||||
}
|
||||
|
||||
CAircraftLights CAircraftLights::allLightsOff()
|
||||
{
|
||||
return CAircraftLights {false, false, false, false, false, false};
|
||||
return CAircraftLights {false, false, false, false, false, false, false, false};
|
||||
}
|
||||
|
||||
QString CAircraftLights::convertToQString(bool /** i18n */) const
|
||||
QString CAircraftLights::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
const QString s = QLatin1Literal("strobe: ") % boolToYesNo(m_strobeOn) %
|
||||
QLatin1Literal(" landing: ") % boolToYesNo(m_landingOn) %
|
||||
QLatin1Literal(" taxi: ") % boolToYesNo(m_taxiOn) %
|
||||
QLatin1Literal(" beacon: ") % boolToYesNo(m_beaconOn) %
|
||||
QLatin1Literal(" nav: ") % boolToYesNo(m_navOn) %
|
||||
QLatin1Literal(" logo: ") % boolToYesNo(m_logoOn);
|
||||
QLatin1Literal(" logo: ") % boolToYesNo(m_logoOn) %
|
||||
QLatin1Literal(" recognition: ") % boolToYesNo(m_recognition) %
|
||||
QLatin1Literal(" cabin: ") % boolToYesNo(m_cabin);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -63,6 +70,10 @@ namespace BlackMisc
|
||||
return CVariant::from(m_strobeOn);
|
||||
case IndexTaxi:
|
||||
return CVariant::from(m_taxiOn);
|
||||
case IndexRecognition:
|
||||
return CVariant::from(m_recognition);
|
||||
case IndexCabin:
|
||||
return CVariant::from(m_cabin);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
@@ -94,6 +105,12 @@ namespace BlackMisc
|
||||
case IndexTaxi:
|
||||
this->m_taxiOn = variant.toBool();
|
||||
break;
|
||||
case IndexCabin:
|
||||
this->m_cabin = variant.toBool();
|
||||
break;
|
||||
case IndexRecognition:
|
||||
this->m_recognition = variant.toBool();
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
@@ -108,6 +125,8 @@ namespace BlackMisc
|
||||
m_navOn = true;
|
||||
m_strobeOn = true;
|
||||
m_taxiOn = true;
|
||||
m_cabin = true;
|
||||
m_recognition = true;
|
||||
}
|
||||
|
||||
void CAircraftLights::setAllOff()
|
||||
@@ -118,6 +137,8 @@ namespace BlackMisc
|
||||
m_navOn = false;
|
||||
m_strobeOn = false;
|
||||
m_taxiOn = false;
|
||||
m_recognition = false;
|
||||
m_cabin = false;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -40,7 +40,9 @@ namespace BlackMisc
|
||||
IndexTaxi,
|
||||
IndexBeacon,
|
||||
IndexNav,
|
||||
IndexLogo
|
||||
IndexLogo,
|
||||
IndexRecognition,
|
||||
IndexCabin
|
||||
};
|
||||
|
||||
//! Default constructor
|
||||
@@ -52,6 +54,9 @@ namespace BlackMisc
|
||||
//! Constructor
|
||||
CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn);
|
||||
|
||||
//! Constructor
|
||||
CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn, bool recognition, bool cabin);
|
||||
|
||||
//! Strobes lights on?
|
||||
bool isStrobeOn() const { return m_strobeOn; }
|
||||
|
||||
@@ -88,6 +93,18 @@ namespace BlackMisc
|
||||
//! Set logo lights
|
||||
void setLogoOn(bool on) { m_logoOn = on; }
|
||||
|
||||
//! Recognition lights on?
|
||||
bool isRecognitionOn() const { return m_recognition; }
|
||||
|
||||
//! Set recognition lights
|
||||
void setRecognitionOn(bool on) { m_recognition = on; }
|
||||
|
||||
//! Cabin lights on?
|
||||
bool isCabinOn() const { return m_cabin; }
|
||||
|
||||
//! Set cabin lights
|
||||
void setCabinOn(bool on) { m_cabin = on; }
|
||||
|
||||
//! All on
|
||||
void setAllOn();
|
||||
|
||||
@@ -116,6 +133,8 @@ namespace BlackMisc
|
||||
bool m_beaconOn = false;
|
||||
bool m_navOn = false;
|
||||
bool m_logoOn = false;
|
||||
bool m_recognition = false; //!< not supported by aircraft config (VATSIM)
|
||||
bool m_cabin = false; //!< not supported by aircraft config (VATSIM)
|
||||
|
||||
BLACK_METACLASS(
|
||||
CAircraftLights,
|
||||
@@ -125,7 +144,9 @@ namespace BlackMisc
|
||||
BLACK_METAMEMBER_NAMED(taxiOn, "taxi_on"),
|
||||
BLACK_METAMEMBER_NAMED(beaconOn, "beacon_on"),
|
||||
BLACK_METAMEMBER_NAMED(navOn, "nav_on"),
|
||||
BLACK_METAMEMBER_NAMED(logoOn, "logo_on")
|
||||
BLACK_METAMEMBER_NAMED(logoOn, "logo_on"),
|
||||
BLACK_METAMEMBER(recognition, 0, DisabledForJson), // disable since JSON is used for network
|
||||
BLACK_METAMEMBER(cabin, 0, DisabledForJson) // disable since JSON is used for network
|
||||
);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -134,6 +134,11 @@ namespace BlackMisc
|
||||
return this->m_engines.isEngineOn(number);
|
||||
}
|
||||
|
||||
bool CAircraftParts::isAnyEngineOn() const
|
||||
{
|
||||
return this->m_engines.isAnyEngineOn();
|
||||
}
|
||||
|
||||
double CAircraftParts::isOnGroundInterpolated() const
|
||||
{
|
||||
if (this->m_isOnGroundInterpolated < 0)
|
||||
|
||||
@@ -107,6 +107,9 @@ namespace BlackMisc
|
||||
//! Is engine with number 1..n on?
|
||||
bool isEngineOn(int number) const;
|
||||
|
||||
//! Any engine on?
|
||||
bool isAnyEngineOn() const;
|
||||
|
||||
//! Set engines
|
||||
void setEngines(const CAircraftEngineList &engines) { m_engines = engines; }
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace BlackSimPlugin
|
||||
{
|
||||
namespace Fsx
|
||||
{
|
||||
CSimConnectDefinitions::CSimConnectDefinitions() { }
|
||||
CSimConnectDefinitions::CSimConnectDefinitions() { }
|
||||
|
||||
HRESULT CSimConnectDefinitions::initDataDefinitionsWhenConnected(const HANDLE hSimConnect)
|
||||
{
|
||||
@@ -105,6 +105,9 @@ namespace BlackSimPlugin
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights, "LIGHT BEACON", "Bool");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights, "LIGHT NAV", "Bool");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights, "LIGHT LOGO", "Bool");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights, "LIGHT NAV", "Bool");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights, "LIGHT RECOGNITION", "Bool");
|
||||
hr += SimConnect_AddToDataDefinition(hSimConnect, CSimConnectDefinitions::DataRemoteAircraftLights, "LIGHT CABIN", "Bool");
|
||||
|
||||
if (hr != S_OK)
|
||||
{
|
||||
@@ -214,7 +217,7 @@ namespace BlackSimPlugin
|
||||
|
||||
CAircraftLights DataDefinitionRemoteAircraftLights::toLights() const
|
||||
{
|
||||
return CAircraftLights(lightStrobe, lightLanding, lightTaxi, lightBeacon, lightNav, lightLogo);
|
||||
return CAircraftLights(lightStrobe, lightLanding, lightTaxi, lightBeacon, lightNav, lightLogo, lightRecognition, lightCabin);
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -104,12 +104,14 @@ namespace BlackSimPlugin
|
||||
//! Data for aircraft lighs
|
||||
struct DataDefinitionRemoteAircraftLights
|
||||
{
|
||||
double lightStrobe; //!< Is strobe light on?
|
||||
double lightLanding; //!< Is landing light on?
|
||||
double lightTaxi; //!< Is taxi light on?
|
||||
double lightBeacon; //!< Is beacon light on?
|
||||
double lightNav; //!< Is nav light on?
|
||||
double lightLogo; //!< Is logo light on?
|
||||
double lightStrobe; //!< Is strobe light on?
|
||||
double lightLanding; //!< Is landing light on?
|
||||
double lightTaxi; //!< Is taxi light on?
|
||||
double lightBeacon; //!< Is beacon light on?
|
||||
double lightNav; //!< Is nav light on?
|
||||
double lightLogo; //!< Is logo light on?
|
||||
double lightRecognition; //!< Is recognition light on
|
||||
double lightCabin; //!< Is cabin light on
|
||||
|
||||
//! Convert to lights
|
||||
BlackMisc::Aviation::CAircraftLights toLights() const;
|
||||
|
||||
Reference in New Issue
Block a user