Skip to content

Commit

Permalink
Show combined FLARM traffic from all available devices
Browse files Browse the repository at this point in the history
The motivation is to support traffic streams from both FLARM and
OGN (Open Glider Network) devices and display it on a single "FLARM Radar"
screen.

OGN devices can output position of nearby aircraft using FLARM protocol
(i.e. using $PFLAA sentences), so that XCSoar or other FLARM displays
could recognize and display the traffic data. If an aircraft is equipped
with both FLARM and OGN device, and both transmit data to XCSoar, XCSoar
sees both devices as "FLARM", but displays traffic only from the first
device.

This patch fixes the problem by combining traffic lists from both devices.
If aircraft with the same ID appears on more than one device, the data
from only the first one will be used.
  • Loading branch information
kedder committed Aug 22, 2018
1 parent 4cd1373 commit 6ed282c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.txt
Expand Up @@ -13,6 +13,7 @@ Version 7.0 - not yet released
- FLARM/OGN - make it possible to set/download registered device database
- device manager: show flag if device provides data from
environmental sensors (temperature, humidity)
- combine traffic from all FLARM devices (support both FLARM and OGN devices on board)
* weather
- merge all weather data in one dialog
- allow showing both terrain and RASP
Expand Down
8 changes: 6 additions & 2 deletions src/FLARM/List.hpp
Expand Up @@ -65,8 +65,12 @@ struct TrafficList {
* this one.
*/
void Complement(const TrafficList &add) {
if (IsEmpty() && !add.IsEmpty())
*this = add;
// Add unique traffic from 'add' list
for (auto &traffic : add.list) {
if (FindTraffic(traffic.id) == NULL) {
list.append(traffic);
}
}
}

void Expire(double clock) {
Expand Down

0 comments on commit 6ed282c

Please sign in to comment.