forked from 7h0ma5/QLog
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathWsjtx.h
175 lines (155 loc) · 5.9 KB
/
Wsjtx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#ifndef QLOG_CORE_WSJTX_H
#define QLOG_CORE_WSJTX_H
#include <QObject>
#include <QDateTime>
#include <QHostAddress>
#include <QSqlRecord>
#include <QNetworkDatagram>
#include "core/UpdatableSQLRecord.h"
class Data;
class QUdpSocket;
class WsjtxStatus {
public:
QString id, mode, tx_mode, sub_mode;
QString dx_call, dx_grid, de_call, de_grid;
QString report;
quint64 dial_freq;
qint32 rx_df, tx_df;
bool tx_enabled, transmitting, decoding;
bool tx_watchdog, fast_mode;
quint8 special_op_mode;
quint32 freq_tolerance, tr_period;
QString conf_name, tx_message;
operator QString() const {
return QString("WsjtxStatus: ")
+ "("
+ "ID: " + id + "; "
+ "Dial: " + QString::number(dial_freq) + "; "
+ "Mode: " + mode + "; "
+ "DXCall: " + dx_call + "; "
+ "Report: " + report + "; "
+ "TXMode: " + tx_mode + "; "
+ "TXEnabled: " + QString::number(tx_enabled) + "; "
+ "Transmitting: " + QString::number(transmitting) + "; "
+ "Decoding: " + QString::number(decoding) + "; "
+ "RxDF: " + QString::number(rx_df) + "; "
+ "TxDF: " + QString::number(tx_df) + "; "
+ "DECall: " + de_call + "; "
+ "DEGrid: " + de_grid + "; "
+ "DXGrid: " + dx_grid + "; "
+ "TXWatchdog: " + QString::number(tx_watchdog) + "; "
+ "SubMode: " + sub_mode + "; "
+ "FastMode: " + QString::number(fast_mode) + "; "
+ "SpecOpMode: " + QString::number(special_op_mode) + "; "
+ "FreqTolerance: "+ QString::number(freq_tolerance) + "; "
+ "TRPeriod: " + QString::number(tr_period) + "; "
+ "ConfName: " + conf_name + "; "
+ "TXMessage: " + tx_message + "; "
+ ")";}
};
class WsjtxDecode {
public:
QString id, mode, message;
bool is_new, low_confidence, off_air;
QTime time;
qint32 snr;
quint32 df;
double dt;
operator QString() const {
return QString("WsjtxDecode: ")
+ "("
+ "ID: " + id + "; "
+ "IsNew: " + QString::number(is_new) + "; "
+ "Time: " + time.toString() + "; "
+ "SNR: " + QString::number(snr) + "; "
+ "DeltaTime: " + QString::number(dt) + "; "
+ "DeltaFreq: " + QString::number(df) + "; "
+ "Mode: " + mode + "; "
+ "Message: " + message + "; "
+ "LowConfidence: " + QString::number(low_confidence) + "; "
+ "OffAir: " + QString::number(off_air) + "; "
+ ")";}
};
class WsjtxLog {
public:
QString id, dx_call, dx_grid, mode, rprt_sent, rprt_rcvd;
QString tx_pwr, comments, name, op_call, my_call, my_grid, prop_mode;
QString exch_sent, exch_rcvd;
QDateTime time_on, time_off;
quint64 tx_freq;
operator QString() const {
return QString("WsjtxLog: ")
+ "("
+ "ID: " + id + "; "
+ "DateTimeOff: " + time_off.toString() + "; "
+ "DXCall: " + dx_call + "; "
+ "DXGrid: " + dx_grid + "; "
+ "TXFreq: " + QString::number(tx_freq) + "; "
+ "Mode: " + mode + "; "
+ "RrpSent: " + rprt_sent + "; "
+ "RrpRcvd: " + rprt_rcvd + "; "
+ "TxPower: " + tx_pwr + "; "
+ "Comments: " + comments + "; "
+ "Name: " + name + "; "
+ "DateTimeOn: " + time_on.toString() + "; "
+ "OpCall: " + op_call + "; "
+ "MyCall: " + my_call + "; "
+ "MyGrid: " + my_grid + "; "
+ "ExchSent: " + exch_sent + "; "
+ "ExchRcvd: " + exch_rcvd + "; "
+ "ADIFPropMode: " + prop_mode + "; "
+ ")";}
};
class WsjtxLogADIF {
public:
QString id, log_adif;
operator QString() const {
return QString("WsjtxLogADIF")
+ "("
+ "ID: " + id + ";"
+ "ADIF: " + log_adif + ";"
+ ")";}
};
class Wsjtx : public QObject
{
Q_OBJECT
public:
explicit Wsjtx(QObject *parent = nullptr);
static float modePeriodLenght(const QString &);
static quint16 getConfigPort();
static void saveConfigPort(quint16);
static QString getConfigForwardAddresses();
static void saveConfigForwardAddresses(const QString &);
static void saveConfigMulticastJoin(bool);
static bool getConfigMulticastJoin();
static void saveConfigMulticastAddress(QString);
static QString getConfigMulticastAddress();
static void saveConfigMulticastTTL(int);
static int getConfigMulticastTTL();
signals:
void statusReceived(WsjtxStatus);
void decodeReceived(WsjtxDecode);
void addContact(QSqlRecord);
public slots:
void startReply(WsjtxDecode);
void reloadSetting();
private slots:
void readPendingDatagrams();
void insertContact(WsjtxLog log);
void contactReady(QSqlRecord record);
void insertContact(WsjtxLogADIF log);
private:
QUdpSocket* socket;
QHostAddress wsjtxAddress;
quint16 wsjtxPort;
UpdatableSQLRecord wsjtSQLRecord;
static QString CONFIG_PORT;
static int DEFAULT_PORT;
static QString CONFIG_FORWARD_ADDRESSES;
static QString CONFIG_MULTICAST_JOIN;
static QString CONFIG_MULTICAST_ADDRESS;
static QString CONFIG_MULTICAST_TTL;
void openPort();
void forwardDatagram(const QNetworkDatagram &);
};
#endif // QLOG_CORE_WSJTX_H