1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-03 13:47:50 -04:00
sdrangel/plugins/channelrx/demodadsb/adsbdemodsinkworker.h
srcejon 1975c1748c Add additional demod stats.
Add analysis of Mode S frames in order to help filter out false positives.
Remove Boost. Use Profiler instead.
Fix crash if interrrupted before run.
Decode full preamble for Mode S frames.
Add support for additional Mode S downlink formats.
Allow demod stats to be reset.
Add timestamps for buffers, to ensure ordering of frames.
Add additional data columns (Aircraft Type, Sideview, Track,  Interrogator Code, TCAS, ACAS, RA, Max speed, Version, Length, Width, ADS-B/Mode S frame counts, radius, NACp, NACv, GVA, NIC, SIL, Stops).
Add PCE (Preamble Chip Errors) settings for Mode S demod.
Remove correlate full preamable setting.
Send aircraft state to Map feature for display on PFD.
Add support for airline route database.
Use combined aircraft database from sdrangel.org rather than OSN database.
Add stats table, with demod stats and breakdown of frame types received..
Add button to delete all aircraft from table.
Add display of interrogator code coverage.
Remove airport elevation setting as now calculated dynamically.
Add QNH setting.
Add coverage map.
Add chart of frame rate and aircraft count.
Add table/map orientation setting.
Add display of aircraft position uncertainty.
Add coloured flight paths with several palettes.
Add setting to favour airline livery over aircraft type in 3D model matching.
Only use 4 engine map icon for aircraft with 4 engines.
Add specialised aircraft map icons (Eurofighter, Spitfire, F35, A400M, Apache, Chinook, Glider)
Display aircraft route in labels.
Better validate local/global aircraft positions.
Add support for tc==31, aircraft operational status frames.
Add decoding of Mode S df 0, 11, 16 frames.
Add decoding of BDS 0,5 0,8, 0,9.
2025-06-04 18:05:10 +01:00

107 lines
4.2 KiB
C++

///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2020 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_ADSBDEMODSINKWORKER_H
#define INCLUDE_ADSBDEMODSINKWORKER_H
#include <QObject>
#include <QThread>
#include "dsp/dsptypes.h"
#include "util/crc.h"
#include "util/message.h"
#include "util/messagequeue.h"
#include "adsbdemodstats.h"
#include "adsbdemodsettings.h"
class ADSBDemodSink;
class ADSBDemodSinkWorker : public QThread {
Q_OBJECT
public:
class MsgConfigureADSBDemodSinkWorker : public Message {
MESSAGE_CLASS_DECLARATION
public:
const ADSBDemodSettings& getSettings() const { return m_settings; }
const QStringList& getSettingsKeys() const { return m_settingsKeys; }
bool getForce() const { return m_force; }
static MsgConfigureADSBDemodSinkWorker* create(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force)
{
return new MsgConfigureADSBDemodSinkWorker(settings, settingsKeys, force);
}
private:
ADSBDemodSettings m_settings;
QStringList m_settingsKeys;
bool m_force;
MsgConfigureADSBDemodSinkWorker(const ADSBDemodSettings& settings, const QStringList& settingsKeys, bool force) :
Message(),
m_settings(settings),
m_settingsKeys(settingsKeys),
m_force(force)
{ }
};
ADSBDemodSinkWorker(ADSBDemodSink *sink) :
m_sink(sink),
m_demodStats(),
m_correlationThresholdLinear(0.02f),
m_crc()
{
}
void run() override;
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
private:
void handleInputMessages();
MessageQueue m_inputMessageQueue;
ADSBDemodSettings m_settings;
ADSBDemodSink *m_sink;
ADSBDemodStats m_demodStats;
Real m_correlationThresholdLinear;
static const Real m_correlationScale;
crcadsb m_crc; //!< Have as member to avoid recomputing LUT
QHash<unsigned, qint64> m_icaos; //!< ICAO addresses that have been received and msecsSinceEpoch last heard
QDateTime m_lastClear;
struct RXRecord {
QByteArray m_data;
int m_firstIndex;
unsigned short m_preamble;
Real m_preambleCorrelation;
Real m_correlationOnes;
QDateTime m_dateTime;
unsigned m_crc;
};
QHash<int, QList<RXRecord>> m_modeSOnlyIcaos;
QDateTime rxDateTime(int firstIdx, int readBuffer) const;
void handleModeS(unsigned char *data, int bytes, unsigned icao, int df, int firstIndex, unsigned short preamble, Real preambleCorrelation, Real correlationOnes, const QDateTime& dateTime, unsigned crc);
void forwardFrame(const unsigned char *data, int size, float preambleCorrelation, float correlationOnes, const QDateTime& dateTime, unsigned crc);
bool icaoHeardRecently(unsigned icao, const QDateTime &dateTime);
static bool icaoValid(unsigned icao);
static bool modeSValid(unsigned char *data, unsigned df);
};
#endif // INCLUDE_ADSBDEMODSINKWORKER_H