JS8Call-Improved master
Loading...
Searching...
No Matches
DecodedText.h
1// -*- Mode: C++ -*-
2/*
3 * Class to handle the formatted string as returned from the decoder
4 *
5 * VK3ACF August 2013
6 */
7
8#ifndef DECODEDTEXT_H
9#define DECODEDTEXT_H
10
11#include "JS8.h"
12
13#include <QString>
14#include <QStringList>
15
17 public:
18 // Constructors
19
20 explicit DecodedText(JS8::Event::Decoded const &);
21 explicit DecodedText(QString const &frame, int bits, int submode);
22
23 // Inline accessors
24
25 int bits() const { return bits_; }
26 QString compoundCall() const { return compound_; }
27 QStringList directedMessage() const { return directed_; }
28 float dt() const { return dt_; }
29 QString extra() const { return extra_; }
30 QString frame() const { return frame_; }
31 quint8 frameType() const { return frameType_; }
32 int frequencyOffset() const { return frequencyOffset_; }
33 bool isAlt() const { return isAlt_; }
34 bool isCompound() const { return !compound_.isEmpty(); }
35 bool isDirectedMessage() const { return directed_.length() > 2; }
36 bool isHeartbeat() const { return isHeartbeat_; }
37 bool isLowConfidence() const { return isLowConfidence_; }
38 QString message() const { return message_; }
39 int snr() const { return snr_; }
40 int submode() const { return submode_; }
41 // You can use decode_time() from commons.h to split up this integer:
42 int time() const { return time_; }
43
44 // Accessors
45
46 QStringList messageWords() const;
47 QString string() const;
48
49 private:
50 // Unpacking strategies, attempted in order until one of them
51 // works or all of them have failed.
52
53 bool tryUnpackFastData(QString const &);
54 bool tryUnpackData(QString const &);
55 bool tryUnpackHeartbeat(QString const &);
56 bool tryUnpackCompound(QString const &);
57 bool tryUnpackDirected(QString const &);
58
59 static constexpr std::array unpackStrategies = {
60 &DecodedText::tryUnpackFastData, &DecodedText::tryUnpackData,
61 &DecodedText::tryUnpackHeartbeat, &DecodedText::tryUnpackCompound,
62 &DecodedText::tryUnpackDirected};
63
64 // Core constructor; delegated to by the public constructors.
65
66 DecodedText(QString const &frame, int bits, int submode,
67 bool isLowConfidence,
68 int time, // As generated by code_time() in commons.h.
69 int frequencyOffset, float snr, float dt);
70
71 // Data members ** ORDER DEPENDENCY **
72
73 quint8 frameType_;
74 QString frame_;
75 bool isAlt_;
76 bool isHeartbeat_;
77 bool isLowConfidence_;
78 QString compound_;
79 QStringList directed_;
80 QString extra_;
81 QString message_;
82 int bits_;
83 int submode_;
84 int time_;
85 int frequencyOffset_;
86 int snr_;
87 float dt_;
88};
89
90#endif // DECODEDTEXT_H
DecodedText(JS8::Event::Decoded const &)
Construct a new Decoded Text:: Decoded Text object.
Definition DecodedText.cpp:276
QString string() const
Get the string representation suitable for ALL.TXT.
Definition DecodedText.cpp:323
QStringList messageWords() const
Get the message words.
Definition DecodedText.cpp:305
Definition JS8.h:63