+ CHANGED and ENHANCED #86
communication to
LTAPI,
which is now an efficient bulk data transfer and includes
@@ -1409,432 +1718,432 @@ v1.16.190507 ADSBEx with RapidAPI
-
- -
- ADDED #138
- ability to connect to ADS-B Exhcange via
- RapidAPI.
- Note: This is a paid service. See
- documentation
- for more info.
-
- -
- FIXED #135
- ADSBEx channel no longer fails and disables when no aircraft are returned.
-
- -
- FIXED #137
- LiveTraffic no longer fails to start up if X-Plane commands (like
-
sim/general/hat_switch_left
) are not found. This might allow
- using LiveTraffic even on outdated vesions like XP10.45 (untested).
-
-
+
+ -
+ ADDED #138
+ ability to connect to ADS-B Exhcange via
+ RapidAPI.
+ Note: This is a paid service. See
+ documentation
+ for more info.
+
+ -
+ FIXED #135
+ ADSBEx channel no longer fails and disables when no aircraft are returned.
+
+ -
+ FIXED #137
+ LiveTraffic no longer fails to start up if X-Plane commands (like
+
sim/general/hat_switch_left
) are not found. This might allow
+ using LiveTraffic even on outdated vesions like XP10.45 (untested).
+
+
- v1.15.190428 ADSBEx with API Key
+ v1.15.190428 ADSBEx with API Key
-
- -
- CHANGED #132
- channel ADS-B Exchange to
- new API
- after public API closed down.
- Note: API key required, to get one you need to be feeding
- ADS-B data to ADS-B Exchange. Then, you can
- request a key there
- and enter it into LiveTraffic's
- Basic Settings
- to re-enable the ADSBEx channel.
-
- -
- FIXED #131
- errorneous warning
valid OBJ8 part types are LIGHTS or SOLID. Got LIGHTS.
.
-
-
+
+ -
+ CHANGED #132
+ channel ADS-B Exchange to
+ new API
+ after public API closed down.
+ Note: API key required, to get one you need to be feeding
+ ADS-B data to ADS-B Exchange. Then, you can
+ request a key there
+ and enter it into LiveTraffic's
+ Basic Settings
+ to re-enable the ADSBEx channel.
+
+ -
+ FIXED #131
+ errorneous warning
valid OBJ8 part types are LIGHTS or SOLID. Got LIGHTS.
.
+
+
- v1.10.190406 RealTraffic, ForeFlight
+ v1.10.190406 RealTraffic, ForeFlight
-
- -
- ADDED #65
- RealTraffic as a new channel. See
- configuration instructions.
-
- -
- ADDED #47
- ForeFlight as an output channel. See
- configuration info.
-
- -
- FIXED checking for updates so that it happens every 48h only
- if no update was found during last check.
-
- -
- REMOVED #125
- historic options from config file to prevent users from being trapped
- with "No enabled active channel...".
-
-
+
+ -
+ ADDED #65
+ RealTraffic as a new channel. See
+ configuration instructions.
+
+ -
+ ADDED #47
+ ForeFlight as an output channel. See
+ configuration info.
+
+ -
+ FIXED checking for updates so that it happens every 48h only
+ if no update was found during last check.
+
+ -
+ REMOVED #125
+ historic options from config file to prevent users from being trapped
+ with "No enabled active channel...".
+
+
- v1.00 Public Release
+ v1.00 Public Release
- v1.00.190309
+ v1.00.190309
-
- -
- RELEASE BUILD, i.e. no time limit.
-
- -
- UPDATED #117
- handling of AI/TCAS planes so that third-party plugins
- have a better chance of seeing LiveTraffic's AI planes with their correct heading.
- X-Plane's internal map and Little NavMap now show LiveTraffic's planes.
-
- -
- CHANGED #118
- reporting of warnings/infos while parsing CSL packages. Repeated
- messages per package/
xsb_aircrafts.txt
file
- are now suppressed and only a counter reported. Previosuly, packages with additional
- parameters could cause thousands of lines of repeating Log.txt
output.
-
- -
- FIXED #112
- ASSERT FAILED for
bWrapAround
, a bug in handling
- roll.
-
-
+
+ -
+ RELEASE BUILD, i.e. no time limit.
+
+ -
+ UPDATED #117
+ handling of AI/TCAS planes so that third-party plugins
+ have a better chance of seeing LiveTraffic's AI planes with their correct heading.
+ X-Plane's internal map and Little NavMap now show LiveTraffic's planes.
+
+ -
+ CHANGED #118
+ reporting of warnings/infos while parsing CSL packages. Repeated
+ messages per package/
xsb_aircrafts.txt
file
+ are now suppressed and only a counter reported. Previosuly, packages with additional
+ parameters could cause thousands of lines of repeating Log.txt
output.
+
+ -
+ FIXED #112
+ ASSERT FAILED for
bWrapAround
, a bug in handling
+ roll.
+
+
- v0.90 Public Beta
+ v0.90 Public Beta
- v0.94.190303 Public Beta - Release Candidate 2
+ v0.94.190303 Public Beta - Release Candidate 2
-
- -
- ADDED #107
- checking for new version on X-Plane.org every 48h; if so message shows up and
- additional menu item
LiveTraffic/New Version...
becomes available.
-
- -
- ADDED #30
- menu items
-
- - Aircraft Info shown, which hides/shows all A/C Info wnds
- - Close All Windows, which closes all A/C Info wnds
- - Labels shown, which toggles if labels are shown in the current view (internal/external/VR)
-
-
- -
- ADDED #30
- commands for most menu items, so that you can assign keys or
- joystick buttons to them in X-Plane's Keyboard and Joystick settings.
- In XP11, assigned keyboard shortcuts show up next to the menu items.
-
- -
- ADDED #110
- option to only control AI aircraft for TCAS blibs on request, i.e.
- not automatically. That helps integration with other multiplayer
- clients, who could then control TCAS.
-
- -
- ADDED #114
- button to A/C info window for switching between AUTO and
- locked-to-selected-a/c mode.
-
- -
- ADDED #103
- manipulation of external camera position using standard commands
- as in X-Plane's Free Camera view. Hat switch mapped to
- left/right/forward/aft movement. Zoom supported.
-
- -
- VR only:
-
- -
- A/C Info Window follows into external camera view,
- so that "Camera" checkbox stays available for getting out of Camera view.
-
- -
- CHANGED #115
- A/C Info Window cannot be closed when in external camera view,
- so that the button to return from camery view remains available.
-
-
-
- -
- Linux only: Open help URLs using
xdg-open
instead of
- open
.
-
- -
- Further CHANGED initial window positioning, especially for Settings UI.
-
- -
- CHANGED #108
- version number of
FlightModels.prf
and enhanced validation to make sure everybody updates.
-
- -
- ADDED #109
- Embraer E-Jet and ERJ families to
related.txt
.
-
- -
- FIXED #116
- banking on approach, which had happened especially often in
- auto-land situations.
-
-
+
+ -
+ ADDED #107
+ checking for new version on X-Plane.org every 48h; if so message shows up and
+ additional menu item
LiveTraffic/New Version...
becomes available.
+
+ -
+ ADDED #30
+ menu items
+
+ - Aircraft Info shown, which hides/shows all A/C Info wnds
+ - Close All Windows, which closes all A/C Info wnds
+ - Labels shown, which toggles if labels are shown in the current view (internal/external/VR)
+
+
+ -
+ ADDED #30
+ commands for most menu items, so that you can assign keys or
+ joystick buttons to them in X-Plane's Keyboard and Joystick settings.
+ In XP11, assigned keyboard shortcuts show up next to the menu items.
+
+ -
+ ADDED #110
+ option to only control AI aircraft for TCAS blibs on request, i.e.
+ not automatically. That helps integration with other multiplayer
+ clients, who could then control TCAS.
+
+ -
+ ADDED #114
+ button to A/C info window for switching between AUTO and
+ locked-to-selected-a/c mode.
+
+ -
+ ADDED #103
+ manipulation of external camera position using standard commands
+ as in X-Plane's Free Camera view. Hat switch mapped to
+ left/right/forward/aft movement. Zoom supported.
+
+ -
+ VR only:
+
+ -
+ A/C Info Window follows into external camera view,
+ so that "Camera" checkbox stays available for getting out of Camera view.
+
+ -
+ CHANGED #115
+ A/C Info Window cannot be closed when in external camera view,
+ so that the button to return from camery view remains available.
+
+
+
+ -
+ Linux only: Open help URLs using
xdg-open
instead of
+ open
.
+
+ -
+ Further CHANGED initial window positioning, especially for Settings UI.
+
+ -
+ CHANGED #108
+ version number of
FlightModels.prf
and enhanced validation to make sure everybody updates.
+
+ -
+ ADDED #109
+ Embraer E-Jet and ERJ families to
related.txt
.
+
+ -
+ FIXED #116
+ banking on approach, which had happened especially often in
+ auto-land situations.
+
+
- v0.93.190224 Public Beta - Release Candidate 1
+ v0.93.190224 Public Beta - Release Candidate 1
-
- -
- ADDED #98
-
- step-by-step instruction for Bluebell CSL package installation
-
- to documentation especially targeting new users.
-
- -
- ADDED #105
- a
Help
submenu to Plugins > LiveTraffic
as well as
- help buttons labeled [?]
to the A/C Info and Settings
- window for direct access to relevant online documentation.
-
- -
- CHANGED #106
- handling of A/C Info windows in XP11 to make use of XP11 features:
-
- - Created as floating windows, ie. can be moved across monitors.
- - Created as VR windows when in VR mode.
- -
- Floating windows move into VR and vice versa when entering/leaving VR.
- VR functionality untested as I don't have a VR rig. Qualified feedback welcome!
-
- -
- New menu entry
Plugins > LiveTraffic > Aircraft Info... (Popped out)
- creates a popped out window (native OS window).
- Initial position might not be optimal yet, but can then be
- moved anywhere on your desktop.
-
-
-
- -
- ADDED #16
- roll to aircraft movement when flying curves. Still looks a bit shaky,
- will only get better after implementing Bezier curves
- (#17) after v1.0.
-
- -
- ADDED current number of aircraft shown to menu item text of
-
Plugins > LiveTraffic > Aircraft displayed
.
-
- -
- ADDED #102
- option to Advanced Settings to select which level of messages to
- show in message area.
-
- -
- FIXED #104
- positioning of all windows in X-Plane 11.
- Message are will show up on right-most monitor in top right corner.
- Settings and A/C info windows will initially be placed in the
- center of the main screen.
-
- -
- FIXED #99
- Last Data info in A/C information window, especially obvious
- in ADSBEx streams, in which the last timestamp never became negative.
-
- -
- CHANGED #97
- aircraft's ICAO type selection: Decision is pushed out to a moment before
- actual plane creation when infos from various channels are
- collected and combined. Reduces warnings about missing ICAO type
- in
Log.txt
significantly. Better identifies
- ground vehicles especially in ADS-B streams.
-
- -
- Also, the CSL model for a plane can now change in-flight if
- new info arrives that affects model-matching, e.g. a proper
- ICAO type for a plane previously shown with defaults.
- After manually loading CSL models in Settings > CSL all planes
- are re-matched, immediately making use of newly loaded models.
-
- -
- REMOVED settings for reading historic ADS-B Exchange data, see
- here
- for reasoning.
-
- -
- CHANGED #101
- and enhanced technical exception handling. LT disables itself in case it can't
- recover from exception (instead of re-throwing the exception, which causes CTD).
-
-
+
+ -
+ ADDED #98
+
+ step-by-step instruction for Bluebell CSL package installation
+
+ to documentation especially targeting new users.
+
+ -
+ ADDED #105
+ a
Help
submenu to Plugins > LiveTraffic
as well as
+ help buttons labeled [?]
to the A/C Info and Settings
+ window for direct access to relevant online documentation.
+
+ -
+ CHANGED #106
+ handling of A/C Info windows in XP11 to make use of XP11 features:
+
+ - Created as floating windows, ie. can be moved across monitors.
+ - Created as VR windows when in VR mode.
+ -
+ Floating windows move into VR and vice versa when entering/leaving VR.
+ VR functionality untested as I don't have a VR rig. Qualified feedback welcome!
+
+ -
+ New menu entry
Plugins > LiveTraffic > Aircraft Info... (Popped out)
+ creates a popped out window (native OS window).
+ Initial position might not be optimal yet, but can then be
+ moved anywhere on your desktop.
+
+
+
+ -
+ ADDED #16
+ roll to aircraft movement when flying curves. Still looks a bit shaky,
+ will only get better after implementing Bezier curves
+ (#17) after v1.0.
+
+ -
+ ADDED current number of aircraft shown to menu item text of
+
Plugins > LiveTraffic > Aircraft displayed
.
+
+ -
+ ADDED #102
+ option to Advanced Settings to select which level of messages to
+ show in message area.
+
+ -
+ FIXED #104
+ positioning of all windows in X-Plane 11.
+ Message are will show up on right-most monitor in top right corner.
+ Settings and A/C info windows will initially be placed in the
+ center of the main screen.
+
+ -
+ FIXED #99
+ Last Data info in A/C information window, especially obvious
+ in ADSBEx streams, in which the last timestamp never became negative.
+
+ -
+ CHANGED #97
+ aircraft's ICAO type selection: Decision is pushed out to a moment before
+ actual plane creation when infos from various channels are
+ collected and combined. Reduces warnings about missing ICAO type
+ in
Log.txt
significantly. Better identifies
+ ground vehicles especially in ADS-B streams.
+
+ -
+ Also, the CSL model for a plane can now change in-flight if
+ new info arrives that affects model-matching, e.g. a proper
+ ICAO type for a plane previously shown with defaults.
+ After manually loading CSL models in Settings > CSL all planes
+ are re-matched, immediately making use of newly loaded models.
+
+ -
+ REMOVED settings for reading historic ADS-B Exchange data, see
+ here
+ for reasoning.
+
+ -
+ CHANGED #101
+ and enhanced technical exception handling. LT disables itself in case it can't
+ recover from exception (instead of re-throwing the exception, which causes CTD).
+
+
- v0.92.190211 Public Beta
+ v0.92.190211 Public Beta
-
- -
- ADDED compatibility with X-Plane 10 again for the moment.
- This will not last forever, but with the goal to have at least
- one release version still supporting X-Plane 10.
-
- -
- ADDED #96 an error message if there are
- no active channels serving tracking data.
-
-
+
+ -
+ ADDED compatibility with X-Plane 10 again for the moment.
+ This will not last forever, but with the goal to have at least
+ one release version still supporting X-Plane 10.
+
+ -
+ ADDED #96 an error message if there are
+ no active channels serving tracking data.
+
+
- v0.92.190209 Public Beta
+ v0.92.190209 Public Beta
-
- -
- Setup
-
- -
- REMOVED compatibility with X-Plane 10 in preparation of using pure X-Plane 11 features.
-
- -
- CHANGED #70
- Reality time is now taken from the network channels; removes the dependency on local PC time being correct.
-
- -
- CHANGED #71
- creation of network connection, working around an issue when certificate revocation check is unable (Windows only)
-
- -
- CHANGED #85
- the way text files are read, now independed of line endings. This allows to use the same installation
- in a dual boot config Windows/Linux and not fail on Linux when reading a CR/LF encoded
LiveTraffic.prf
file.
-
-
-
- -
- New/Changed Functionality
-
- -
- ADDED #80
- ability to hide and hence impersonate planes, see documentation.
-
- -
- ADDED #93
- external camera view sitting on any plane's tail, see documentation.
-
- -
- ADDED #88
- Advanced Setting to hide traffic below a certain height AGL or while taxiing,
- to allow better parallel operation with airport traffic plugins.
-
- -
- ADDED #76
- Advanced Setting to allow landing lights on during taxiing to see planes at night.
-
- -
- ADDED #69
- A/C Label Setting to control if labels shall appear in internal / external / VR views.
-
- -
- CHANGED #74
- distances in Advanced Settings from km to nm. Existing settings from previous versions will be converted on first startup. Rounding applies.
-
- -
- ADDED #92
- menu item to try to get access to AI planes for TCAS control. Reorganized menu.
- See new documentation on menu items.
-
- -
- ADDED ability to search for squawk code in A/C key field of A/C Information Windows.
-
- -
- ADDED #75
- options in Debug Settings to fix model matching parameters for CSL model makers.
- See documentation.
-
- -
- CHANGED model matching: Now passing registration (tail number) as the match string
- for LIVERY. CSL model makers are now able to configure liveries per individual airframe.
-
- -
- REMOVED menu item for reloading plugins. No longer needed with new handling of access to AI planes / TCAS.
-
-
-
- -
- CHANGED #81 multiplayer lib to base on latest upstream code, which in tun
-
- -
- ADDED #45
- ability to work without access to AI planes (then no TCAS) to enhance parallel operations with other multiplayer plugins.
- See documentation for usage instructions.
-
- -
- CHANGED #63
- label drawing back to 3D phase, no longer drawing over cockpit.
- However, in VR labels still appear in one eye only (#69).
-
- -
- ADDED ability to control taxi lights in CSL models. I have not yet found a model, which supports taxi lights, though.
-
- -
- ADDED clamping, i.e. the ability to detect from the OBJ8 models the necessary vertical offset for fairly good
- placement on the ground. Still, a well maintained
VERT_OFFSET
setting in xsb_aircrafts.txt
is more accurate.
-
-
-
+
+ -
+ Setup
+
+ -
+ REMOVED compatibility with X-Plane 10 in preparation of using pure X-Plane 11 features.
+
+ -
+ CHANGED #70
+ Reality time is now taken from the network channels; removes the dependency on local PC time being correct.
+
+ -
+ CHANGED #71
+ creation of network connection, working around an issue when certificate revocation check is unable (Windows only)
+
+ -
+ CHANGED #85
+ the way text files are read, now independed of line endings. This allows to use the same installation
+ in a dual boot config Windows/Linux and not fail on Linux when reading a CR/LF encoded
LiveTraffic.prf
file.
+
+
+
+ -
+ New/Changed Functionality
+
+ -
+ ADDED #80
+ ability to hide and hence impersonate planes, see documentation.
+
+ -
+ ADDED #93
+ external camera view sitting on any plane's tail, see documentation.
+
+ -
+ ADDED #88
+ Advanced Setting to hide traffic below a certain height AGL or while taxiing,
+ to allow better parallel operation with airport traffic plugins.
+
+ -
+ ADDED #76
+ Advanced Setting to allow landing lights on during taxiing to see planes at night.
+
+ -
+ ADDED #69
+ A/C Label Setting to control if labels shall appear in internal / external / VR views.
+
+ -
+ CHANGED #74
+ distances in Advanced Settings from km to nm. Existing settings from previous versions will be converted on first startup. Rounding applies.
+
+ -
+ ADDED #92
+ menu item to try to get access to AI planes for TCAS control. Reorganized menu.
+ See new documentation on menu items.
+
+ -
+ ADDED ability to search for squawk code in A/C key field of A/C Information Windows.
+
+ -
+ ADDED #75
+ options in Debug Settings to fix model matching parameters for CSL model makers.
+ See documentation.
+
+ -
+ CHANGED model matching: Now passing registration (tail number) as the match string
+ for LIVERY. CSL model makers are now able to configure liveries per individual airframe.
+
+ -
+ REMOVED menu item for reloading plugins. No longer needed with new handling of access to AI planes / TCAS.
+
+
+
+ -
+ CHANGED #81 multiplayer lib to base on latest upstream code, which in tun
+
+ -
+ ADDED #45
+ ability to work without access to AI planes (then no TCAS) to enhance parallel operations with other multiplayer plugins.
+ See documentation for usage instructions.
+
+ -
+ CHANGED #63
+ label drawing back to 3D phase, no longer drawing over cockpit.
+ However, in VR labels still appear in one eye only (#69).
+
+ -
+ ADDED ability to control taxi lights in CSL models. I have not yet found a model, which supports taxi lights, though.
+
+ -
+ ADDED clamping, i.e. the ability to detect from the OBJ8 models the necessary vertical offset for fairly good
+ placement on the ground. Still, a well maintained
VERT_OFFSET
setting in xsb_aircrafts.txt
is more accurate.
+
+
+
- -
- Pure Bug Fixes
-
- -
- FIXED #73
- model-selection based on
related.txt
for some Diamond models, which appeared as gliders.
-
- -
- FIXED #84
- Message area moving too high on Linux
-
- -
- FIXED rounding of altitudes to full feet in internal calculations, which removes step climbs/descends by 1ft,
- especially visible on the ground.
-
- -
- FIXED #50
- a crash of X-Plane after failed initialization of LiveTraffic.
-
- -
- FIXED Stop requesting master data when shutting down, speeding up shut down of X-Plane when LiveTraffic
- is in the loop of fetching master data from OpenSky.
-
-
-
-
+ -
+ Pure Bug Fixes
+
+ -
+ FIXED #73
+ model-selection based on
related.txt
for some Diamond models, which appeared as gliders.
+
+ -
+ FIXED #84
+ Message area moving too high on Linux
+
+ -
+ FIXED rounding of altitudes to full feet in internal calculations, which removes step climbs/descends by 1ft,
+ especially visible on the ground.
+
+ -
+ FIXED #50
+ a crash of X-Plane after failed initialization of LiveTraffic.
+
+ -
+ FIXED Stop requesting master data when shutting down, speeding up shut down of X-Plane when LiveTraffic
+ is in the loop of fetching master data from OpenSky.
+
+
+
+
- v0.91.190120 Public Beta
+ v0.91.190120 Public Beta
- To update coming from 0.90 or ealier:
+ To update coming from 0.90 or ealier:
-
- -
- The v0.91 package now ships with a directory
LiveTraffic/Resources/ShippedCSL
,
- which contains the X-CSL FollowMe Car courtesy of X-CSL.
- Move ShippedCSL
- under the existing LiveTraffic/Resources
directory,
- in parallel to the existing CSL
directory with the
- Bluebell installation.
- -
- If you had installed the X-CSL FollowMe car manually, then remove
- it now by deleting the
CARS
directory from
- your LiveTraffic/Resources/CSL
directory.
-
- -
- If you ever had trouble with "ghost planes" (seeing yellow labels
- without aircraft) then likely your Bluebell CSL installation has been
- damaged, possibly by the X-CSL installation. Recommendation is
- to start over: Clear the
LiveTraffic/Resources/CSL
- directory and download the Bluebell package once again,
- following the
- installation documentation.
-
-
+
+ -
+ The v0.91 package now ships with a directory
LiveTraffic/Resources/ShippedCSL
,
+ which contains the X-CSL FollowMe Car courtesy of X-CSL.
+ Move ShippedCSL
+ under the existing LiveTraffic/Resources
directory,
+ in parallel to the existing CSL
directory with the
+ Bluebell installation.
+ -
+ If you had installed the X-CSL FollowMe car manually, then remove
+ it now by deleting the
CARS
directory from
+ your LiveTraffic/Resources/CSL
directory.
+
+ -
+ If you ever had trouble with "ghost planes" (seeing yellow labels
+ without aircraft) then likely your Bluebell CSL installation has been
+ damaged, possibly by the X-CSL installation. Recommendation is
+ to start over: Clear the
LiveTraffic/Resources/CSL
+ directory and download the Bluebell package once again,
+ following the
+ installation documentation.
+
+
Resulting folder structure shall be:
From 605a5388c25aad73833595b96617313118e16a69 Mon Sep 17 00:00:00 2001
From: TwinFan
Date: Thu, 5 Jan 2023 23:29:35 +0100
Subject: [PATCH 3/7] Fix/RealTraffic: default is port 49005
---
Include/DataRefs.h | 2 +-
LiveTraffic.xcodeproj/project.pbxproj | 4 ++--
Src/DataRefs.cpp | 29 +++++++++++++++++++++++----
docs/readme.html | 3 ++-
4 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/Include/DataRefs.h b/Include/DataRefs.h
index 21ae0c3..6b20da4 100644
--- a/Include/DataRefs.h
+++ b/Include/DataRefs.h
@@ -685,7 +685,7 @@ class DataRefs
int fscEnv = 0; ///< FSCharter: Which environment to connect to?
int ognUseRequRepl = 0; ///< OGN: Use Request/Reply instead of TCP receiver
int rtListenPort = 10747; // port opened for RT to connect
- int rtTrafficPort = 49003; // UDP Port receiving traffic
+ int rtTrafficPort = 49005; // UDP Port receiving traffic
int rtWeatherPort = 49004; // UDP Port receiving weather info
int ffSendPort = 49002; // UDP Port to send ForeFlight feeding data
int bffUserPlane = 1; // bool Send User plane data?
diff --git a/LiveTraffic.xcodeproj/project.pbxproj b/LiveTraffic.xcodeproj/project.pbxproj
index 083d14c..9226861 100755
--- a/LiveTraffic.xcodeproj/project.pbxproj
+++ b/LiveTraffic.xcodeproj/project.pbxproj
@@ -786,7 +786,7 @@
LIVETRAFFIC_VERSION_BETA = 0;
LIVETRAFFIC_VER_MAJOR = 3;
LIVETRAFFIC_VER_MINOR = 3;
- LIVETRAFFIC_VER_PATCH = 0;
+ LIVETRAFFIC_VER_PATCH = 1;
LLVM_LTO = NO;
MACH_O_TYPE = mh_dylib;
MACOSX_DEPLOYMENT_TARGET = 11.0;
@@ -894,7 +894,7 @@
LIVETRAFFIC_VERSION_BETA = 0;
LIVETRAFFIC_VER_MAJOR = 3;
LIVETRAFFIC_VER_MINOR = 3;
- LIVETRAFFIC_VER_PATCH = 0;
+ LIVETRAFFIC_VER_PATCH = 1;
LLVM_LTO = YES;
MACH_O_TYPE = mh_dylib;
MACOSX_DEPLOYMENT_TARGET = 11.0;
diff --git a/Src/DataRefs.cpp b/Src/DataRefs.cpp
index b7b9aa8..cdcac35 100644
--- a/Src/DataRefs.cpp
+++ b/Src/DataRefs.cpp
@@ -1898,7 +1898,8 @@ bool DataRefs::LoadConfigFile()
assert (aFlarmToIcaoAcTy.size() == size_t(FAT_UAV)+1);
// which conversion to do with the (older) version of the config file?
- enum cfgFileConvE { CFG_NO_CONV=0, CFG_V3, CFG_V31 } conv = CFG_NO_CONV;
+ unsigned long cfgFileVer = 0;
+ enum cfgFileConvE { CFG_NO_CONV=0, CFG_V3, CFG_V31, CFG_V331 } conv = CFG_NO_CONV;
// open a config file
std::string sFileName (LTCalcFullPath(PATH_CONFIG_FILE));
@@ -1945,8 +1946,24 @@ bool DataRefs::LoadConfigFile()
// Any pre-v3 version?
if (ln[1][0] < '3')
conv = CFG_V3;
- else if (ln[1] < "3.1")
- conv = CFG_V31;
+ else {
+ // we expect a version number with 3 parts...but we'll be careful
+ std::regex reVerNum ("(\\d+)\\.(\\d+)\\.(\\d+)");
+ std::smatch m;
+ std::regex_search(ln[1], m, reVerNum);
+ if (m.size() >= 2)
+ cfgFileVer = std::stoul(m[1]) * 10000;
+ if (m.size() >= 3)
+ cfgFileVer += std::stoul(m[2]) * 100;
+ if (m.size() >= 4)
+ cfgFileVer += std::stoul(m[3]);
+
+ // any conversions required?
+ if (cfgFileVer < 30100) // < 3.1.0
+ conv = CFG_V31;
+ else if (cfgFileVer < 30301) // < 3.3.1
+ conv = CFG_V331;
+ }
}
// *** Delete LiveTraffic_imgui.prf? ***
@@ -1993,8 +2010,12 @@ bool DataRefs::LoadConfigFile()
// conversion of older config file formats
switch (conv) {
case CFG_NO_CONV:
- case CFG_V31: break;
+ break;
+ case CFG_V331:
+ case CFG_V31:
case CFG_V3:
+ // We "forgot" to change the default to 49005 for fresh installations,
+ // so we need to convert the port all the way up to v3.3.1:
if (*i == DATA_REFS_LT[DR_CFG_RT_TRAFFIC_PORT]) {
// With v3 preferred port changes from 49003 to 49005
if (sVal == "49003")
diff --git a/docs/readme.html b/docs/readme.html
index 7d09d95..da5942f 100755
--- a/docs/readme.html
+++ b/docs/readme.html
@@ -145,8 +145,9 @@ v3.3.1
-
Fixed XPMP2 #54
- FMOD Error 36
+ FMOD Error 36.
+ - Fixed default for RealTraffic port (49005) on new installations.
v3.3.0
From 5541652d591984d3fead72b83e772720c6f24392 Mon Sep 17 00:00:00 2001
From: TwinFan
Date: Sat, 7 Jan 2023 23:07:21 +0100
Subject: [PATCH 4/7] Updated XPMP2
---
Lib/XPMP2 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Lib/XPMP2 b/Lib/XPMP2
index 9b6c79d..68a9a38 160000
--- a/Lib/XPMP2
+++ b/Lib/XPMP2
@@ -1 +1 @@
-Subproject commit 9b6c79df9c0311796d68c7307cf8a79c91c39f1b
+Subproject commit 68a9a3845af157bf48fddce1c105c9f26b2645d7
From 5864450c5994e80b5e2ffc42cde5de1ff691a297 Mon Sep 17 00:00:00 2001
From: TwinFan
Date: Sat, 7 Jan 2023 23:26:15 +0100
Subject: [PATCH 5/7] Updated XPMP2
---
Lib/XPMP2 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Lib/XPMP2 b/Lib/XPMP2
index 68a9a38..6f534a6 160000
--- a/Lib/XPMP2
+++ b/Lib/XPMP2
@@ -1 +1 @@
-Subproject commit 68a9a3845af157bf48fddce1c105c9f26b2645d7
+Subproject commit 6f534a636bcf15670bbdd0e7957c9a8e28f86130
From 65892995b4d83fa567675225e2f0194eb3b55fb8 Mon Sep 17 00:00:00 2001
From: TwinFan
Date: Sun, 5 Feb 2023 00:52:08 +0100
Subject: [PATCH 6/7] Feat/RealTraffic: Send sim time
Add X-Plane version/time info to Status/About
---
Include/DataRefs.h | 17 +++++--
Include/LTRealTraffic.h | 11 +++--
Src/DataRefs.cpp | 100 ++++++++++++++++++++++++++++++++++++++++
Src/InfoListWnd.cpp | 20 ++++++++
Src/LTRealTraffic.cpp | 79 +++++++++++++++++++++++--------
docs/readme.html | 7 ++-
6 files changed, 206 insertions(+), 28 deletions(-)
diff --git a/Include/DataRefs.h b/Include/DataRefs.h
index 6b20da4..12cef10 100644
--- a/Include/DataRefs.h
+++ b/Include/DataRefs.h
@@ -726,6 +726,11 @@ class DataRefs
// MARK: Public members
public:
+ /// X-Plane version information
+ int xpVer = 0;
+ int xplmVer = 0;
+ std::string sXpVer;
+
/// once per Flarm a/c type: matching it to one or more ICAO types
std::array, 14> aFlarmToIcaoAcTy;
@@ -770,6 +775,7 @@ class DataRefs
static positionTy lastCamPos; ///< cached read camera position
float lastNetwTime = 0.0f; ///< cached network time
double lastSimTime = NAN; ///< cached simulated time
+ unsigned long lastXPSimTime_ms = 0; ///< X-Plane's simulated time in milliseconds since the Unix epoch
bool lastReplay = true; ///< cached: is replay mode?
bool lastVREnabled = false; ///< cached info: VR enabled?
bool bUsingModernDriver = false; ///< modern driver in use?
@@ -796,9 +802,14 @@ class DataRefs
inline bool UsingModernDriver () const { return bUsingModernDriver; }
inline bool IsVREnabled() const { return lastVREnabled; }
- inline void SetLocalDateDays(int days) { XPLMSetDatai(adrXP[DR_LOCAL_DATE_DAYS], days); }
- inline void SetUseSystemTime(bool bSys) { XPLMSetDatai(adrXP[DR_USE_SYSTEM_TIME], (int)bSys); }
- inline void SetZuluTimeSec(float sec) { XPLMSetDataf(adrXP[DR_ZULU_TIME_SEC], sec); }
+ bool IsUsingSystemTime() const { return XPLMGetDatai(adrXP[DR_USE_SYSTEM_TIME]); }
+ int GetLocalDateDays() const { return XPLMGetDatai(adrXP[DR_LOCAL_DATE_DAYS]); }
+ float GetLocalTimeSec() const { return XPLMGetDataf(adrXP[DR_LOCAL_TIME_SEC]); }
+ float GetZuluTimeSec() const { return XPLMGetDataf(adrXP[DR_ZULU_TIME_SEC]); }
+ unsigned long GetXPSimTime_ms() const { return lastXPSimTime_ms; }
+ void UpdateXPSimTime(); ///< Calculate X-Plane's current simulation time as Unix epoch time in milliseconds (Java timestamp)
+ std::string GetXPSimTimeStr() const; ///< Return a nicely formated time string with XP's simulated time in UTC
+
void SetViewType(XPViewTypes vt);
positionTy GetUsersPlanePos(double& trueAirspeed_m, double& track) const;
diff --git a/Include/LTRealTraffic.h b/Include/LTRealTraffic.h
index 7e9aedc..8bec059 100644
--- a/Include/LTRealTraffic.h
+++ b/Include/LTRealTraffic.h
@@ -47,10 +47,10 @@ constexpr double RT_VSI_AIRBORNE = 80.0; ///< if VSI is more than this then w
#define MSG_RT_STATUS "RealTraffic network status changed to: %s"
#define MSG_RT_LAST_RCVD " | last: %lds ago"
-#define MSG_RT_ADJUST " | historic traffic from %s ago"
+#define MSG_RT_ADJUST " | historic traffic from %s"
#define INFO_RT_REAL_TIME "RealTraffic: Tracking data is real-time again."
-#define INFO_RT_ADJUST_TS "RealTraffic: Detected tracking data from %s in the past, will adjust them to display now."
+#define INFO_RT_ADJUST_TS "RealTraffic: Receive and display past tracking data from %s"
#define ERR_RT_CANTLISTEN "RealTraffic: Cannot listen to network, can't tell RealTraffic our position"
#define ERR_RT_WEATHER_QNH "RealTraffic reports unreasonable QNH %ld - ignored"
#define ERR_RT_DISCARDED_MSG "RealTraffic: Discarded invalid message: %s"
@@ -247,8 +247,11 @@ class RealTrafficConnection : public LTOnlineChannel, LTFlightDataChannel
static void tcpConnectionS (RealTrafficConnection* me) { me->tcpConnection();}
bool StopTcpConnection ();
- void SendPos (const positionTy& pos, double speed_m);
- void SendUsersPlanePos();
+ void SendMsg (const char* msg); ///< Send and log a message to RealTraffic
+ void SendTime (unsigned long ts); ///< Send a timestamp to RealTraffic
+ void SendXPSimTime(); ///< Send XP's current simulated time to RealTraffic, adapted to "today or earlier"
+ void SendPos (const positionTy& pos, double speed_m); ///< Send position/speed info for own ship to RealTraffic
+ void SendUsersPlanePos(); ///< Send user's plane's position/speed to RealTraffic
// MARK: UDP
// UDP Listen: the main function for receiving UDP broadcasts
diff --git a/Src/DataRefs.cpp b/Src/DataRefs.cpp
index cdcac35..e3911f7 100644
--- a/Src/DataRefs.cpp
+++ b/Src/DataRefs.cpp
@@ -779,6 +779,13 @@ bool DataRefs::Init ()
XPLMGetSystemPath ( aszPath );
XPSystemPath = aszPath;
+ // XP Version
+ XPLMGetVersions(&xpVer, &xplmVer, nullptr);
+ snprintf(aszPath, sizeof(aszPath), "X-Plane %d.%02d",
+ xpVer / 1000,
+ ((xpVer) / 10) % 100);
+ sXpVer = aszPath;
+
// Directory Separator provided by XP
DirSeparator = XPLMGetDirectorySeparator();
@@ -999,6 +1006,98 @@ float DataRefs::GetMiscNetwTime() const
return lastNetwTime;
}
+
+// Calculates X-Plane's current simulation time as Unix epoch time in milliseconds (Java timestamp)
+/// @details Complication:
+/// X-Plane provides _local_ data and time,
+/// but only zulu time, no date, but zulu date can easily differ
+/// from local date. So from user position's longitude we need to guess
+/// if zulu data is before, on, or after local date.
+void DataRefs::UpdateXPSimTime()
+{
+ // convert all numbers right away to milliseconds as we need that in the end anyway
+ // and that way we preserve the meaning of the fractional seconds coming from X-Plane
+ constexpr long DAY_MS = 24L * 60L * 60L * 1000L;
+ long t = (long)(GetLocalDateDays()) * DAY_MS;
+ const long localTime = long(GetLocalTimeSec() * 1000.0f);
+ const long zuluTime = long(GetZuluTimeSec() * 1000.0f);
+ // if local and zulu time are different at all (testing for more than one minute difference)
+ if (std::labs(localTime - zuluTime) > 60000L) {
+ // Eastern hemisphere? -> Zulu is _behind_ local time
+ if (lastUsersPlanePos.lon() > 0.0) {
+ // but if the local Zulu time component is actually _ahead of_ local time, then need to decrement zulu date
+ if (zuluTime > localTime)
+ t -= DAY_MS;
+ } else {
+ // Western hemisphere -> Zulu is _ahead of_ local time
+ // but if the zulu time component is actually _behind_ local time, then need to increment zulu date
+ if (zuluTime < localTime)
+ t += DAY_MS;
+ }
+ }
+ // Now t is date in zulu days, just add time component
+ t += zuluTime;
+
+ // Last thing to do: Add the beginning of the right year to it
+ // Complications: X-Plane has no notion of a "year", it just returns days since start of the year
+ // X-Plane offers only 28 days for February, so it runs on a 365d year
+ // If the day of the year is past current real life day of year, then assume "last year"
+ // But: What do we do with leap years in reality???
+
+ // Find this year's beginning
+ time_t now;
+ std::tm tm;
+ time(&now); // today, actually 'now'
+ gmtime_s(&tm, &now);
+ tm.tm_yday = 0; // set to 01-JAN of 'this year'
+ tm.tm_mday = 1;
+ tm.tm_mon = 0;
+ tm.tm_hour = 0;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ tm.tm_isdst = 0;
+ time_t jan01 = mktime_utc(tm); // convert 01-JAN back to Unix epoch
+
+ // Convert to milliseconds, then add to our result
+ t += long(jan01) * 1000L;
+
+ // if t is now (more than 1s) in the future, then we reduce t by an entire year,
+ // supposingly pointing to the same day last year
+ if (t > long(now+1) * 1000L) {
+ // Save a date representation of what we computed so far in the future
+ time_t unix_t = time_t(t / 1000L);
+ std::tm tm_future;
+ gmtime_s(&tm_future, &unix_t);
+
+ // reduce by 365 days
+ t -= 365 * DAY_MS;
+
+ // Would we need to skip over a leap year's 29th Feb?
+ // Goal is: We need to end up on the same day of the month,
+ // so convert back to calendar days and let's check
+ unix_t = time_t(t / 1000L);
+ gmtime_s(&tm, &unix_t);
+ // If day of month don't agree then reduce by another day to cover leap day
+ if (tm.tm_mday != tm_future.tm_mday)
+ t -= DAY_MS;
+ }
+
+ // Done: store as our last calculate value
+ lastXPSimTime_ms = (unsigned long)t;
+}
+
+
+// Return a nicely formated time string with XP's simulated time in UTC
+std::string DataRefs::GetXPSimTimeStr() const
+{
+ char s[100];
+ time_t xp_t = time_t(lastXPSimTime_ms / 1000L);
+ struct tm xp_tm;
+ gmtime_s(&xp_tm, &xp_t);
+ std::strftime(s, sizeof(s), "%Y-%m-%d %H:%M:%S UTC", &xp_tm);
+ return s;
+}
+
/// Set the view type, translating from XPViewTypes to command ref needed
void DataRefs::SetViewType(XPViewTypes vt)
{
@@ -2375,6 +2474,7 @@ void DataRefs::UpdateCachedValues ()
UpdateViewPos();
UpdateUsersPlanePos();
UpdateSimWind();
+ UpdateXPSimTime();
ExportUserAcData();
}
diff --git a/Src/InfoListWnd.cpp b/Src/InfoListWnd.cpp
index 836da42..4b9cf30 100644
--- a/Src/InfoListWnd.cpp
+++ b/Src/InfoListWnd.cpp
@@ -476,6 +476,26 @@ void InfoListWnd::buildInterface()
ImGui::TreePop();
}
+
+ // X-Plane Version info
+ if (ImGui::TreeNode(dataRefs.sXpVer.c_str())) {
+ if (ImGui::BeginTable("X-Plane Version Info", 2, ImGuiTableFlags_SizingPolicyFixedX)) {
+ ImGui::TableNextRow();
+ if (ImGui::TableSetColumnIndex(0)) ImGui::TextUnformatted("X-Plane Version");
+ if (ImGui::TableSetColumnIndex(1)) ImGui::Text("%d", dataRefs.xpVer);
+ ImGui::TableNextRow();
+ if (ImGui::TableSetColumnIndex(0)) ImGui::TextUnformatted("XPLM Version");
+ if (ImGui::TableSetColumnIndex(1)) ImGui::Text("%d", dataRefs.xplmVer);
+ ImGui::TableNextRow();
+ if (ImGui::TableSetColumnIndex(0)) ImGui::TextUnformatted("Sim Time");
+ if (ImGui::TableSetColumnIndex(1))
+ ImGui::Text("%s (%s)",
+ dataRefs.GetXPSimTimeStr().c_str(),
+ dataRefs.IsUsingSystemTime() ? "live" : "user setting");
+ ImGui::EndTable();
+ }
+ ImGui::TreePop();
+ }
// Credits
if (ImGui::TreeNode("Credits")) {
diff --git a/Src/LTRealTraffic.cpp b/Src/LTRealTraffic.cpp
index 602bbb7..755bcde 100644
--- a/Src/LTRealTraffic.cpp
+++ b/Src/LTRealTraffic.cpp
@@ -55,7 +55,7 @@ RealTrafficConnection::~RealTrafficConnection ()
// Does not actually fetch data (the UDP thread does that) but
// 1. Starts the connections
-// 2. updates the RealTraffic local server with out current position
+// 2. updates the RealTraffic local server with out current position and time
// 3. cleans up map of datagrams for duplicate check
bool RealTrafficConnection::FetchAllData(const positionTy& pos)
{
@@ -75,7 +75,8 @@ bool RealTrafficConnection::FetchAllData(const positionTy& pos)
// do anything only in a normal status
if (IsConnected())
{
- // Send current position
+ // Send current position and time
+ SendXPSimTime();
SendUsersPlanePos();
// cleanup map of last datagrams
@@ -264,7 +265,7 @@ std::string RealTrafficConnection::GetStatusTextExt() const
std::string s (GetStatusStr());
if (IsConnected() && lastReceivedTime > 0.0) {
- char sIntvl[50];
+ char sIntvl[100];
// add when the last msg was received
long intvl = std::lround(dataRefs.GetSimTime() - lastReceivedTime);
snprintf(sIntvl,sizeof(sIntvl),MSG_RT_LAST_RCVD,intvl);
@@ -370,7 +371,8 @@ void RealTrafficConnection::tcpConnection ()
if (tcpPosSender.listenAccept()) {
// so we did accept a connection!
SetStatusTcp(true, false);
- // send our first position
+ // send our simulated time and first position
+ SendXPSimTime();
SendUsersPlanePos();
}
else
@@ -419,15 +421,47 @@ bool RealTrafficConnection::StopTcpConnection ()
}
+// Send and log a message to RealTraffic
+void RealTrafficConnection::SendMsg (const char* msg)
+{
+ if (!tcpPosSender.IsConnected())
+ { LOG_MSG(logWARN,ERR_SOCK_NOTCONNECTED,ChName()); return; }
+
+ // send the string
+ if (!tcpPosSender.send(msg)) {
+ LOG_MSG(logERR,ERR_SOCK_SEND_FAILED,ChName());
+ SetStatusTcp(false, true);
+ }
+ DebugLogRaw(msg);
+}
+
+// Send a timestamp to RealTraffic
+/// @details Format is Qs123=1674984782616, where the long number is the UTC epoch milliseconds of the simulator time.
+void RealTrafficConnection::SendTime (unsigned long ts)
+{
+ // format the string to send and send it out
+ char s[50];
+ snprintf(s, sizeof(s), "Qs123=%lu\n", ts);
+ SendMsg(s);
+}
+
+// Send XP's current simulated time to RealTraffic, adapted to "today or earlier"
+void RealTrafficConnection::SendXPSimTime()
+{
+ SendTime(dataRefs.IsUsingSystemTime() ? // if using system time
+ // then send system time directly to RealTraffic, no detour via X-plane
+ (unsigned long)std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count() :
+ // otherwise send manually configured time to RealTraffic
+ dataRefs.GetXPSimTime_ms());
+}
+
+
// send position to RealTraffic so that RT knows which area
// we are interested and to give us local weather
// Example:
// “Qs121=6747;289;5.449771266137578;37988724;501908;0.6564195830703577;-2.1443275933742236”
void RealTrafficConnection::SendPos (const positionTy& pos, double speed_m)
{
- if (!tcpPosSender.IsConnected())
- { LOG_MSG(logWARN,ERR_SOCK_NOTCONNECTED,ChName()); return; }
-
if (!pos.isFullyValid())
{ LOG_MSG(logWARN,ERR_SOCK_INV_POS,ChName()); return; }
@@ -444,12 +478,8 @@ void RealTrafficConnection::SendPos (const positionTy& pos, double speed_m)
deg2rad(pos.lon()) // longitude
);
- // send the string
- if (!tcpPosSender.send(s)) {
- LOG_MSG(logERR,ERR_SOCK_SEND_FAILED,ChName());
- SetStatusTcp(false, true);
- }
- DebugLogRaw(s);
+ // Send the message
+ SendMsg(s);
}
// send the position of the user's plane
@@ -1086,18 +1116,29 @@ void RealTrafficConnection::AdjustTimestamp (double& ts)
// Return a string describing the current timestamp adjustment
std::string RealTrafficConnection::GetAdjustTSText () const
{
- char timeTxt[25];
+ char timeTxt[100];
if (tsAdjust < 300.0) // less than 5 minutes: tell seconds
- snprintf(timeTxt, sizeof(timeTxt), "%.0fs", tsAdjust);
+ snprintf(timeTxt, sizeof(timeTxt), "%.0fs ago", tsAdjust);
else if (tsAdjust < 86400.0) // less than 1 day
- snprintf(timeTxt, sizeof(timeTxt), "%ld:%02ldh",
+ snprintf(timeTxt, sizeof(timeTxt), "%ld:%02ldh ago",
long(tsAdjust/3600.0), // hours
long(tsAdjust/60.0) % 60); // minutes
- else
- snprintf(timeTxt, sizeof(timeTxt), "%ldd %ld:%02ldh",
+ else {
+ // More than a day ago, compute full UTC time the data is from
+ struct tm tm;
+ time_t t;
+ time(&t);
+ t -= time_t(tsAdjust);
+ gmtime_s(&tm, &t);
+
+ snprintf(timeTxt, sizeof(timeTxt), "%ldd %ld:%02ldh ago (%4d-%02d-%02d %02d:%02d UTC)",
long(tsAdjust/86400), // days
long(tsAdjust/3600.0) % 24, // hours
- long(tsAdjust/60.0) % 60); // minutes
+ long(tsAdjust/60.0) % 60, // minutes
+ // UTC timestamp
+ tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min);
+ }
return std::string(timeTxt);
}
diff --git a/docs/readme.html b/docs/readme.html
index da5942f..310f6be 100755
--- a/docs/readme.html
+++ b/docs/readme.html
@@ -143,11 +143,14 @@ v3.3.1
Change log:
+ - RealTraffic: Sending simulator time to RealTraffic app,
+ so that RealTraffic can send matching historic traffic
+ (activate "Simulator controls time offset" in RealTraffic Advanced Settings).
+ - Fixed default for RealTraffic port (49005) on new installations.
-
Fixed XPMP2 #54
- FMOD Error 36.
+ FMOD Error 36 by correctly calculating sound's spacial orientation.
- - Fixed default for RealTraffic port (49005) on new installations.
v3.3.0
From 9918b692744e76918b9dfbc53fce92de782ba11c Mon Sep 17 00:00:00 2001
From: TwinFan
Date: Sun, 5 Feb 2023 13:33:48 +0100
Subject: [PATCH 7/7] Feat/RealTraffic: Setting for which sim time to send
---
Include/DataRefs.h | 15 +++++++++++++--
Include/LTRealTraffic.h | 2 +-
Src/DataRefs.cpp | 25 ++++++++++++++-----------
Src/LTRealTraffic.cpp | 24 +++++++++++++++++-------
Src/SettingsUI.cpp | 9 +++++++++
5 files changed, 54 insertions(+), 21 deletions(-)
diff --git a/Include/DataRefs.h b/Include/DataRefs.h
index 12cef10..63f585d 100644
--- a/Include/DataRefs.h
+++ b/Include/DataRefs.h
@@ -405,6 +405,7 @@ enum dataRefsLT {
DR_CFG_RT_LISTEN_PORT,
DR_CFG_RT_TRAFFIC_PORT,
DR_CFG_RT_WEATHER_PORT,
+ DR_CFG_RT_SIM_TIME_CTRL,
DR_CFG_FF_SEND_PORT,
DR_CFG_FF_SEND_USER_PLANE,
DR_CFG_FF_SEND_TRAFFIC,
@@ -443,6 +444,14 @@ enum exportFDFormat {
EXP_FD_RTTFC, ///< user RTTFC format, introduced with RealTraffic v9
};
+/// Which simulator time to send to RealTraffic?
+enum SimTimeCtrlTy : int {
+ STC_NO_CTRL = 0, ///< Don't send any sim time
+ STC_SIM_TIME, ///< Send current sim time unchanged
+ STC_SIM_TIME_PLUS_BUFFER, ///< Send current sim time plus buffering period, so that the traffic, when it appears, matches up with current sim time
+};
+
+
// first/last channel; number of channels:
constexpr int DR_CHANNEL_FIRST = DR_CHANNEL_FUTUREDATACHN_ONLINE;
constexpr int DR_CHANNEL_LAST = CNT_DATAREFS_LT-1;
@@ -687,6 +696,7 @@ class DataRefs
int rtListenPort = 10747; // port opened for RT to connect
int rtTrafficPort = 49005; // UDP Port receiving traffic
int rtWeatherPort = 49004; // UDP Port receiving weather info
+ SimTimeCtrlTy rtSTC = STC_SIM_TIME_PLUS_BUFFER; ///< Which sim time to send to RealTraffic?
int ffSendPort = 49002; // UDP Port to send ForeFlight feeding data
int bffUserPlane = 1; // bool Send User plane data?
int bffTraffic = 1; // bool Send traffic data?
@@ -775,7 +785,7 @@ class DataRefs
static positionTy lastCamPos; ///< cached read camera position
float lastNetwTime = 0.0f; ///< cached network time
double lastSimTime = NAN; ///< cached simulated time
- unsigned long lastXPSimTime_ms = 0; ///< X-Plane's simulated time in milliseconds since the Unix epoch
+ long long lastXPSimTime_ms = 0; ///< X-Plane's simulated time in milliseconds since the Unix epoch
bool lastReplay = true; ///< cached: is replay mode?
bool lastVREnabled = false; ///< cached info: VR enabled?
bool bUsingModernDriver = false; ///< modern driver in use?
@@ -806,7 +816,7 @@ class DataRefs
int GetLocalDateDays() const { return XPLMGetDatai(adrXP[DR_LOCAL_DATE_DAYS]); }
float GetLocalTimeSec() const { return XPLMGetDataf(adrXP[DR_LOCAL_TIME_SEC]); }
float GetZuluTimeSec() const { return XPLMGetDataf(adrXP[DR_ZULU_TIME_SEC]); }
- unsigned long GetXPSimTime_ms() const { return lastXPSimTime_ms; }
+ long long GetXPSimTime_ms() const { return lastXPSimTime_ms; }
void UpdateXPSimTime(); ///< Calculate X-Plane's current simulation time as Unix epoch time in milliseconds (Java timestamp)
std::string GetXPSimTimeStr() const; ///< Return a nicely formated time string with XP's simulated time in UTC
@@ -945,6 +955,7 @@ class DataRefs
void SetADSBExAPIKey (std::string apiKey) { sADSBExAPIKey = apiKey; }
bool SetRTTrafficPort (int port) { return SetCfgValue(&rtTrafficPort, port); }
+ SimTimeCtrlTy GetRTSTC () const { return rtSTC; } ///< RealTraffic simulator time control setting
size_t GetFSCEnv() const { return (size_t)fscEnv; }
void GetFSCharterCredentials (std::string& user, std::string& pwd)
diff --git a/Include/LTRealTraffic.h b/Include/LTRealTraffic.h
index 8bec059..d4ca553 100644
--- a/Include/LTRealTraffic.h
+++ b/Include/LTRealTraffic.h
@@ -248,7 +248,7 @@ class RealTrafficConnection : public LTOnlineChannel, LTFlightDataChannel
bool StopTcpConnection ();
void SendMsg (const char* msg); ///< Send and log a message to RealTraffic
- void SendTime (unsigned long ts); ///< Send a timestamp to RealTraffic
+ void SendTime (long long ts); ///< Send a timestamp to RealTraffic
void SendXPSimTime(); ///< Send XP's current simulated time to RealTraffic, adapted to "today or earlier"
void SendPos (const positionTy& pos, double speed_m); ///< Send position/speed info for own ship to RealTraffic
void SendUsersPlanePos(); ///< Send user's plane's position/speed to RealTraffic
diff --git a/Src/DataRefs.cpp b/Src/DataRefs.cpp
index e3911f7..ab82773 100644
--- a/Src/DataRefs.cpp
+++ b/Src/DataRefs.cpp
@@ -559,6 +559,7 @@ DataRefs::dataRefDefinitionT DATA_REFS_LT[CNT_DATAREFS_LT] = {
{"livetraffic/channel/real_traffic/listen_port",DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/channel/real_traffic/traffic_port",DataRefs::LTGetInt,DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/channel/real_traffic/weather_port",DataRefs::LTGetInt,DataRefs::LTSetCfgValue, GET_VAR, true },
+ {"livetraffic/channel/real_traffic/sim_time_ctrl",DataRefs::LTGetInt,DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/channel/fore_flight/send_port", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true },
{"livetraffic/channel/fore_flight/user_plane", DataRefs::LTGetInt, DataRefs::LTSetBool, GET_VAR, true },
{"livetraffic/channel/fore_flight/traffic", DataRefs::LTGetInt, DataRefs::LTSetBool, GET_VAR, true },
@@ -643,6 +644,7 @@ void* DataRefs::getVarAddr (dataRefsLT dr)
case DR_CFG_RT_LISTEN_PORT: return &rtListenPort;
case DR_CFG_RT_TRAFFIC_PORT: return &rtTrafficPort;
case DR_CFG_RT_WEATHER_PORT: return &rtWeatherPort;
+ case DR_CFG_RT_SIM_TIME_CTRL: return &rtSTC;
case DR_CFG_FF_SEND_PORT: return &ffSendPort;
case DR_CFG_FF_SEND_USER_PLANE: return &bffUserPlane;
case DR_CFG_FF_SEND_TRAFFIC: return &bffTraffic;
@@ -1017,12 +1019,12 @@ void DataRefs::UpdateXPSimTime()
{
// convert all numbers right away to milliseconds as we need that in the end anyway
// and that way we preserve the meaning of the fractional seconds coming from X-Plane
- constexpr long DAY_MS = 24L * 60L * 60L * 1000L;
- long t = (long)(GetLocalDateDays()) * DAY_MS;
- const long localTime = long(GetLocalTimeSec() * 1000.0f);
- const long zuluTime = long(GetZuluTimeSec() * 1000.0f);
+ constexpr long long DAY_MS = 24LL * 60LL * 60LL * 1000LL;
+ long long t = (long long)(GetLocalDateDays()) * DAY_MS;
+ const long long localTime = (long long)(GetLocalTimeSec() * 1000.0f);
+ const long long zuluTime = (long long)(GetZuluTimeSec() * 1000.0f);
// if local and zulu time are different at all (testing for more than one minute difference)
- if (std::labs(localTime - zuluTime) > 60000L) {
+ if (std::llabs(localTime - zuluTime) > 60000LL) {
// Eastern hemisphere? -> Zulu is _behind_ local time
if (lastUsersPlanePos.lon() > 0.0) {
// but if the local Zulu time component is actually _ahead of_ local time, then need to decrement zulu date
@@ -1059,23 +1061,23 @@ void DataRefs::UpdateXPSimTime()
time_t jan01 = mktime_utc(tm); // convert 01-JAN back to Unix epoch
// Convert to milliseconds, then add to our result
- t += long(jan01) * 1000L;
+ t += (long long)(jan01) * 1000LL;
// if t is now (more than 1s) in the future, then we reduce t by an entire year,
// supposingly pointing to the same day last year
- if (t > long(now+1) * 1000L) {
+ if (t > (long long)(now+1) * 1000LL) {
// Save a date representation of what we computed so far in the future
- time_t unix_t = time_t(t / 1000L);
+ time_t unix_t = time_t(t / 1000LL);
std::tm tm_future;
gmtime_s(&tm_future, &unix_t);
// reduce by 365 days
- t -= 365 * DAY_MS;
+ t -= 365LL * DAY_MS;
// Would we need to skip over a leap year's 29th Feb?
// Goal is: We need to end up on the same day of the month,
// so convert back to calendar days and let's check
- unix_t = time_t(t / 1000L);
+ unix_t = time_t(t / 1000LL);
gmtime_s(&tm, &unix_t);
// If day of month don't agree then reduce by another day to cover leap day
if (tm.tm_mday != tm_future.tm_mday)
@@ -1083,7 +1085,7 @@ void DataRefs::UpdateXPSimTime()
}
// Done: store as our last calculate value
- lastXPSimTime_ms = (unsigned long)t;
+ lastXPSimTime_ms = (long long)t;
}
@@ -1712,6 +1714,7 @@ bool DataRefs::SetCfgValue (void* p, int val)
rtListenPort < 1024 || rtListenPort > 65535 ||
rtTrafficPort < 1024 || rtTrafficPort > 65535 ||
rtWeatherPort < 1024 || rtWeatherPort > 65535 ||
+ rtSTC < STC_NO_CTRL || rtSTC > STC_SIM_TIME_PLUS_BUFFER ||
contrailAltMin_ft < 0 || contrailAltMin_ft> 90000 ||
contrailAltMax_ft < 0 || contrailAltMax_ft> 90000 ||
contrailLifeTime < 5 || contrailLifeTime > 300 ||
diff --git a/Src/LTRealTraffic.cpp b/Src/LTRealTraffic.cpp
index 755bcde..11c402c 100644
--- a/Src/LTRealTraffic.cpp
+++ b/Src/LTRealTraffic.cpp
@@ -437,22 +437,32 @@ void RealTrafficConnection::SendMsg (const char* msg)
// Send a timestamp to RealTraffic
/// @details Format is Qs123=1674984782616, where the long number is the UTC epoch milliseconds of the simulator time.
-void RealTrafficConnection::SendTime (unsigned long ts)
+void RealTrafficConnection::SendTime (long long ts)
{
// format the string to send and send it out
char s[50];
- snprintf(s, sizeof(s), "Qs123=%lu\n", ts);
+ snprintf(s, sizeof(s), "Qs123=%lld\n", ts);
SendMsg(s);
}
// Send XP's current simulated time to RealTraffic, adapted to "today or earlier"
void RealTrafficConnection::SendXPSimTime()
{
- SendTime(dataRefs.IsUsingSystemTime() ? // if using system time
- // then send system time directly to RealTraffic, no detour via X-plane
- (unsigned long)std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count() :
- // otherwise send manually configured time to RealTraffic
- dataRefs.GetXPSimTime_ms());
+ if (dataRefs.GetRTSTC() == STC_NO_CTRL) // Configured to send nothing?
+ return;
+
+ // Which time stamp to send?
+ long long ts;
+ if (dataRefs.IsUsingSystemTime()) { // Sim is using system time, so send system time
+ ts = (long long)std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count();
+ } else {
+ ts = dataRefs.GetXPSimTime_ms(); // else send simulated time
+ if (dataRefs.GetRTSTC() == STC_SIM_TIME_PLUS_BUFFER)
+ // add buffering period if requested, so planes match up with simulator time exactly instead of being delayed
+ ts += (long long)(dataRefs.GetFdBufPeriod()) * 1000LL;
+ }
+
+ SendTime(ts);
}
diff --git a/Src/SettingsUI.cpp b/Src/SettingsUI.cpp
index 7b19686..3005d23 100644
--- a/Src/SettingsUI.cpp
+++ b/Src/SettingsUI.cpp
@@ -498,6 +498,15 @@ void LTSettingsUI::buildInterface()
ImGui::TableNextCell();
}
+ if (ImGui::FilteredLabel("Simulator Time Control", sFilter)) {
+ const float cbWidth = ImGui::CalcTextSize("Send Sim Time plus Buffering Period (default)_____").x;
+ ImGui::SetNextItemWidth(cbWidth);
+ int n = dataRefs.GetRTSTC();
+ if (ImGui::Combo("##RTSTC", &n, "Don't send Simulator Time\0Send Simulator Time unchanged\0Send Sim Time plus Buffering Period (default)\0", 3))
+ DATA_REFS_LT[DR_CFG_RT_SIM_TIME_CTRL].setData(n);
+ ImGui::TableNextCell();
+ }
+
if (!*sFilter) ImGui::TreePop();
}