JS8Call-Improved master
Loading...
Searching...
No Matches
DecodedText.h
Go to the documentation of this file.
1
12
13#ifndef DECODEDTEXT_H
14#define DECODEDTEXT_H
15
16#include "JS8.h"
17
18#include <QString>
19#include <QStringList>
20
31 public:
35 explicit DecodedText(JS8::Event::Decoded const &);
36
43 explicit DecodedText(QString const &frame, int bits, int submode);
44
45 // Inline accessors
46
48 int bits() const { return bits_; }
49
51 QString compoundCall() const { return compound_; }
52
54 QStringList directedMessage() const { return directed_; }
55
57 float dt() const { return dt_; }
58
60 QString extra() const { return extra_; }
61
63 QString frame() const { return frame_; }
64
66 quint8 frameType() const { return frameType_; }
67
69 int frequencyOffset() const { return frequencyOffset_; }
70
72 bool isAlt() const { return isAlt_; }
73
75 bool isCompound() const { return !compound_.isEmpty(); }
76
78 bool isDirectedMessage() const { return directed_.length() > 2; }
79
81 bool isHeartbeat() const { return isHeartbeat_; }
82
84 bool isLowConfidence() const { return isLowConfidence_; }
85
87 QString message() const { return message_; }
88
90 int snr() const { return snr_; }
91
93 int submode() const { return submode_; }
94
98 int time() const { return time_; }
99
100 // Accessors
101
106 QStringList messageWords() const;
107
111 QString string() const;
112
113 private:
114 // Unpacking strategies, attempted in order until one succeeds.
115
116 bool tryUnpackFastData(QString const &);
117 bool tryUnpackData(QString const &);
118 bool tryUnpackHeartbeat(QString const &);
119 bool tryUnpackCompound(QString const &);
120 bool tryUnpackDirected(QString const &);
121
122 static constexpr std::array unpackStrategies = {
123 &DecodedText::tryUnpackFastData, &DecodedText::tryUnpackData,
124 &DecodedText::tryUnpackHeartbeat, &DecodedText::tryUnpackCompound,
125 &DecodedText::tryUnpackDirected};
126
127 // Core constructor called by public constructors.
128 DecodedText(QString const &frame, int bits, int submode,
129 bool isLowConfidence,
130 int time, // As generated by code_time() in commons.h.
131 int frequencyOffset, float snr, float dt);
132
133 // Data members ** ORDER DEPENDENCY **
134
135 quint8 frameType_;
136 QString frame_;
137 bool isAlt_;
138 bool isHeartbeat_;
139 bool isLowConfidence_;
140 QString compound_;
141 QStringList directed_;
142 QString extra_;
143 QString message_;
144 int bits_;
145 int submode_;
146 int time_;
147 int frequencyOffset_;
148 int snr_;
149 float dt_;
150};
151
152#endif // DECODEDTEXT_H
Core JS8 namespace types, Costas arrays and decoder event payloads.
bool isDirectedMessage() const
Definition DecodedText.h:78
DecodedText(JS8::Event::Decoded const &)
Construct from a decoder event record.
Definition DecodedText.cpp:276
bool isHeartbeat() const
Definition DecodedText.h:81
int bits() const
Definition DecodedText.h:48
QStringList directedMessage() const
Definition DecodedText.h:54
int submode() const
Definition DecodedText.h:93
bool isLowConfidence() const
Definition DecodedText.h:84
int snr() const
Definition DecodedText.h:90
float dt() const
Definition DecodedText.h:57
QString message() const
Definition DecodedText.h:87
QString string() const
Return a human-readable representation of the decoded frame.
Definition DecodedText.cpp:323
QStringList messageWords() const
Tokenize message into words.
Definition DecodedText.cpp:305
int frequencyOffset() const
Definition DecodedText.h:69
QString compoundCall() const
Definition DecodedText.h:51
bool isCompound() const
Definition DecodedText.h:75
quint8 frameType() const
Definition DecodedText.h:66
bool isAlt() const
Definition DecodedText.h:72
int time() const
Timestamp as produced by the decoder (use decode_time() to split).
Definition DecodedText.h:98
QString frame() const
Definition DecodedText.h:63
QString extra() const
Definition DecodedText.h:60
Decoded frame payload emitted when a frame is successfully decoded.
Definition JS8.h:102