mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +08:00
Ref T261, move default offset times to FSD setup
* make it available in "blackmisc" * remove dependency from "VATSIM"
This commit is contained in:
committed by
Roland Winklmeier
parent
4fe09aa618
commit
a1b2e92684
@@ -25,7 +25,7 @@
|
|||||||
#include "blackmisc/geo/coordinategeodetic.h"
|
#include "blackmisc/geo/coordinategeodetic.h"
|
||||||
#include "blackmisc/geo/latitude.h"
|
#include "blackmisc/geo/latitude.h"
|
||||||
#include "blackmisc/geo/longitude.h"
|
#include "blackmisc/geo/longitude.h"
|
||||||
#include "blackmisc/network/network.h"
|
#include "blackmisc/network/fsdsetup.h"
|
||||||
#include "blackmisc/network/textmessage.h"
|
#include "blackmisc/network/textmessage.h"
|
||||||
#include "blackmisc/network/user.h"
|
#include "blackmisc/network/user.h"
|
||||||
#include "blackmisc/pq/angle.h"
|
#include "blackmisc/pq/angle.h"
|
||||||
@@ -977,7 +977,7 @@ namespace BlackCore
|
|||||||
CSpeed::null() // There is no speed information in a interim packet
|
CSpeed::null() // There is no speed information in a interim packet
|
||||||
);
|
);
|
||||||
situation.setCurrentUtcTime();
|
situation.setCurrentUtcTime();
|
||||||
situation.setTimeOffsetMs(c_interimPositionTimeOffsetMsec);
|
situation.setTimeOffsetMs(CFsdSetup::c_interimPositionTimeOffsetMsec);
|
||||||
situation.setInterimFlag(true);
|
situation.setInterimFlag(true);
|
||||||
self->receivedPositionFixTsAndGetOffsetTime(situation.getCallsign(), situation.getMSecsSinceEpoch());
|
self->receivedPositionFixTsAndGetOffsetTime(situation.getCallsign(), situation.getMSecsSinceEpoch());
|
||||||
|
|
||||||
@@ -1192,15 +1192,15 @@ namespace BlackCore
|
|||||||
if (!m_lastPositionUpdate.contains(callsign))
|
if (!m_lastPositionUpdate.contains(callsign))
|
||||||
{
|
{
|
||||||
m_lastPositionUpdate.insert(callsign, markerTs);
|
m_lastPositionUpdate.insert(callsign, markerTs);
|
||||||
return c_positionTimeOffsetMsec;
|
return CFsdSetup::c_positionTimeOffsetMsec;
|
||||||
}
|
}
|
||||||
const qint64 oldTs = m_lastPositionUpdate.value(callsign);
|
const qint64 oldTs = m_lastPositionUpdate.value(callsign);
|
||||||
m_lastPositionUpdate[callsign] = markerTs;
|
m_lastPositionUpdate[callsign] = markerTs;
|
||||||
|
|
||||||
const qint64 diff = oldTs - markerTs;
|
const qint64 diff = oldTs - markerTs;
|
||||||
const qint64 offsetTime = (oldTs > 0 && diff > 0 && diff < c_interimPositionTimeOffsetMsec) ?
|
const qint64 offsetTime = (oldTs > 0 && diff > 0 && diff < CFsdSetup::c_interimPositionTimeOffsetMsec) ?
|
||||||
c_interimPositionTimeOffsetMsec :
|
CFsdSetup::c_interimPositionTimeOffsetMsec :
|
||||||
c_positionTimeOffsetMsec;
|
CFsdSetup::c_positionTimeOffsetMsec;
|
||||||
m_lastOffsetTime[callsign] = offsetTime;
|
m_lastOffsetTime[callsign] = offsetTime;
|
||||||
return offsetTime;
|
return offsetTime;
|
||||||
}
|
}
|
||||||
@@ -1209,7 +1209,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
|
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Need callsign");
|
||||||
|
|
||||||
if (!m_lastOffsetTime.contains(callsign)) { return c_positionTimeOffsetMsec; }
|
if (!m_lastOffsetTime.contains(callsign)) { return CFsdSetup::c_positionTimeOffsetMsec; }
|
||||||
return m_lastOffsetTime.value(callsign);
|
return m_lastOffsetTime.value(callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,12 +132,6 @@ namespace BlackCore
|
|||||||
//! Command line options this library can handle
|
//! Command line options this library can handle
|
||||||
static const QList<QCommandLineOption> &getCmdLineOptions();
|
static const QList<QCommandLineOption> &getCmdLineOptions();
|
||||||
|
|
||||||
//! Offset times basically telling when to expect the next value from network plus some reserve
|
|
||||||
//! @{
|
|
||||||
static qint64 constexpr c_positionTimeOffsetMsec = 6000; //!< offset time for received position updates
|
|
||||||
static qint64 constexpr c_interimPositionTimeOffsetMsec = 2000; //!< offset time for received interim position updates
|
|
||||||
//! @}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int constexpr c_processingIntervalMsec = 100; //!< interval for the processing timer
|
static int constexpr c_processingIntervalMsec = 100; //!< interval for the processing timer
|
||||||
static int constexpr c_updatePostionIntervalMsec = 5000; //!< interval for the position update timer (send our position to network)
|
static int constexpr c_updatePostionIntervalMsec = 5000; //!< interval for the position update timer (send our position to network)
|
||||||
|
|||||||
@@ -56,6 +56,12 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(SendReceiveDetails, SendReceiveDetailsFlag)
|
Q_DECLARE_FLAGS(SendReceiveDetails, SendReceiveDetailsFlag)
|
||||||
|
|
||||||
|
//! Offset times basically telling when to expect the next value from network plus some reserve
|
||||||
|
//! @{
|
||||||
|
static qint64 constexpr c_positionTimeOffsetMsec = 6000; //!< offset time for received position updates
|
||||||
|
static qint64 constexpr c_interimPositionTimeOffsetMsec = 2000; //!< offset time for received interim position updates
|
||||||
|
//! @}
|
||||||
|
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
CFsdSetup() {}
|
CFsdSetup() {}
|
||||||
|
|
||||||
|
|||||||
@@ -15,18 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "testaircraftsituation.h"
|
#include "testaircraftsituation.h"
|
||||||
|
#include "blackmisc/network/fsdsetup.h"
|
||||||
#include "blackmisc/aviation/aircraftsituationchange.h"
|
#include "blackmisc/aviation/aircraftsituationchange.h"
|
||||||
#include "blackmisc/math/mathutils.h"
|
#include "blackmisc/math/mathutils.h"
|
||||||
#include "blackcore/vatsim/networkvatlib.h"
|
|
||||||
|
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
|
using namespace BlackMisc::Network;
|
||||||
using namespace BlackMisc::Geo;
|
using namespace BlackMisc::Geo;
|
||||||
using namespace BlackMisc::Math;
|
using namespace BlackMisc::Math;
|
||||||
using namespace BlackCore::Vatsim;
|
|
||||||
|
|
||||||
namespace BlackMiscTest
|
namespace BlackMiscTest
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user