mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
refs #375 finish sending of interim positions
Airspace monitor knows all remote aircrafts and which have interim positions enabled. It passes the list of receivers to INetwork and INetwork sends it to FSD.
This commit is contained in:
@@ -417,6 +417,28 @@ namespace BlackCore
|
||||
Vat_SendClientQuery(m_net.data(), vatClientQueryInfo, toFSD(callsign));
|
||||
}
|
||||
|
||||
void CNetworkVatlib::sendInterimPosition(const CCallsignSet &receivers)
|
||||
{
|
||||
Q_ASSERT_X(isConnected(), "CNetworkVatlib", "Can't send to server when disconnected");
|
||||
|
||||
if (this->m_loginMode == LoginNormal)
|
||||
{
|
||||
VatInterimPilotPosition pos;
|
||||
// TODO: we need to distinguish true and pressure altitude
|
||||
pos.altitudeTrue = ownAircraft().getAltitude().value(CLengthUnit::ft());
|
||||
pos.heading = ownAircraft().getHeading().value(CAngleUnit::deg());
|
||||
pos.pitch = ownAircraft().getPitch().value(CAngleUnit::deg());
|
||||
pos.bank = ownAircraft().getBank().value(CAngleUnit::deg());
|
||||
pos.latitude = ownAircraft().latitude().value(CAngleUnit::deg());
|
||||
pos.longitude = ownAircraft().longitude().value(CAngleUnit::deg());
|
||||
|
||||
for (const auto &receiver : receivers)
|
||||
{
|
||||
Vat_SendInterimPilotUpdate(m_net.data(), toFSD(receiver), &pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CNetworkVatlib::sendServerQuery(const BlackMisc::Aviation::CCallsign &callsign)
|
||||
{
|
||||
Q_ASSERT_X(isConnected(), "CNetworkVatlib", "Can't send to server when disconnected");
|
||||
@@ -604,16 +626,6 @@ namespace BlackCore
|
||||
sendCustomPacket(callsign, "FSIPI", data);
|
||||
}
|
||||
|
||||
void CNetworkVatlib::enableFastPositionSending(bool enable)
|
||||
{
|
||||
m_sendInterimPositions = enable;
|
||||
}
|
||||
|
||||
bool CNetworkVatlib::isFastPositionSendingEnabled() const
|
||||
{
|
||||
return m_sendInterimPositions;
|
||||
}
|
||||
|
||||
void CNetworkVatlib::broadcastAircraftConfig(const QJsonObject &config)
|
||||
{
|
||||
// Fixme: Use QJsonObject with std::initializer_list once 5.4 is baseline
|
||||
|
||||
Reference in New Issue
Block a user