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:
Roland Winklmeier
2015-04-12 15:30:30 +02:00
parent 78bc9e8769
commit c77c0e484f
6 changed files with 67 additions and 23 deletions

View File

@@ -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