File indexing completed on 2024-04-28 03:50:12
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2010 Wes Hardaker <hardaker@users.sourceforge.net> 0004 // 0005 0006 #ifndef APRSGATHERER_H 0007 #define APRSGATHERER_H 0008 0009 #include <QThread> 0010 #include <QMap> 0011 #include <QString> 0012 0013 #include "AprsSource.h" 0014 #include "AprsObject.h" 0015 0016 class QIODevice; 0017 class QMutex; 0018 0019 namespace Marble { 0020 0021 class AprsGatherer : public QThread 0022 { 0023 Q_OBJECT 0024 0025 public: 0026 AprsGatherer( AprsSource *from, 0027 QMap<QString, AprsObject *> *objects, 0028 QMutex *mutex, 0029 QString *filter 0030 ); 0031 AprsGatherer( QIODevice *from, 0032 QMap<QString, AprsObject *> *objects, 0033 QMutex *mutex, 0034 QString *filter 0035 ); 0036 void run() override; 0037 0038 void addObject( const QString &callSign, 0039 qreal latitude, qreal longitude, bool canDoDirect, 0040 const QString &routePath, 0041 const QChar &symbolTable, 0042 const QChar &symbolCode ); 0043 0044 void setDumpOutput( bool to ); 0045 bool dumpOutput() const; 0046 0047 void setSeenFrom ( GeoAprsCoordinates::SeenFrom seenFrom ); 0048 GeoAprsCoordinates::SeenFrom seenFrom(); 0049 0050 void shutDown(); 0051 static void sleepFor(int seconds); 0052 0053 private: 0054 void initMicETables(); 0055 static qreal calculateLongitude( const QString &threeBytes, 0056 int offset, bool isEast ); 0057 0058 AprsSource *m_source; 0059 QIODevice *m_socket; 0060 QString *m_filter; 0061 bool m_running; 0062 bool m_dumpOutput; 0063 GeoAprsCoordinates::SeenFrom m_seenFrom; 0064 QString m_sourceName; 0065 0066 // Shared with the parent thread 0067 QMutex *m_mutex; 0068 QMap<QString, AprsObject *> *m_objects; 0069 0070 QMap<QPair<QChar, QChar>, QString> m_pixmaps; 0071 0072 // Mic-E decoding tables 0073 QMap<QChar, int> m_dstCallDigits; 0074 QMap<QChar, bool> m_dstCallSouthEast; 0075 QMap<QChar, int> m_dstCallLongitudeOffset; 0076 QMap<QChar, int> m_dstCallMessageBit; 0077 0078 QMap<int, QString> m_standardMessageText; 0079 QMap<int, QString> m_customMessageText; 0080 QMap<QChar, int> m_infoFieldByte1; 0081 }; 0082 } 0083 0084 #endif /* APRSGATHERER_H */