-
Notifications
You must be signed in to change notification settings - Fork 3
/
messages.go
365 lines (298 loc) · 11.3 KB
/
messages.go
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
package wsjtx
import (
"time"
)
/*
The heartbeat message shall be sent on a periodic basis every
15 seconds. This
message is intended to be used by servers to detect the presence
of a client and also the unexpected disappearance of a client
and by clients to learn the schema negotiated by the server
after it receives the initial heartbeat message from a client.
Out/In.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l110
*/
type HeartbeatMessage struct {
Id string `json:"id"`
MaxSchema uint32 `json:"maxSchemaVersion"`
Version string `json:"version"`
Revision string `json:"revision"`
}
const heartbeatNum = 0
/*
WSJT-X sends this status message when various internal state
changes to allow the server to track the relevant state of each
client without the need for polling commands.
Out only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l141
*/
type StatusMessage struct {
Id string `json:"id"`
DialFrequency uint64 `json:"dialFrequency"`
Mode string `json:"mode"`
DxCall string `json:"dxCall"`
Report string `json:"report"`
TxMode string `json:"txMode"`
TxEnabled bool `json:"txEnabled"`
Transmitting bool `json:"transmitting"`
Decoding bool `json:"decoding"`
RxDF uint32 `json:"rxDeltaFreq"`
TxDF uint32 `json:"txDeltaFreq"`
DeCall string `json:"deCall"`
DeGrid string `json:"deGrid"`
DxGrid string `json:"dxGrid"`
TxWatchdog bool `json:"txWatchdog"`
SubMode string `json:"submode"`
FastMode bool `json:"fastMode"`
SpecialOperationMode uint8 `json:"specialMode"`
FrequencyTolerance uint32 `json:"frequencyTolerance"`
TRPeriod uint32 `json:"txRxPeriod"`
ConfigurationName string `json:"configName"`
TxMessage string `json:"txMessage"`
}
const statusNum = 1
/*
The decode message is sent when a new decode is completed, in
this case the 'New' field is true. It is also used in response
to a "Replay" message where each old decode in the "Band
activity" window, that has not been erased, is sent in order
as a one of these messages with the 'New' field set to false.
Out only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l208
*/
type DecodeMessage struct {
Id string `json:"id"`
New bool `json:"new"`
Time uint32 `json:"time"`
Snr int32 `json:"snr"`
DeltaTimeSec float64 `json:"deltaTime"`
DeltaFrequencyHz uint32 `json:"deltaFrequency"`
Mode string `json:"mode"`
Message string `json:"message"`
LowConfidence bool `json:"lowConfidence"`
OffAir bool `json:"offAir"`
}
const decodeNum = 2
/*
This message is send when all prior "Decode" messages in the
"Band Activity" window have been discarded and therefore are
no long available for actioning with a "Reply" message.
The Window argument can be one of the following values:
0 - clear the "Band Activity" window (default)
1 - clear the "Rx Frequency" window
2 - clear both "Band Activity" and "Rx Frequency" windows
Out/In.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l234
*/
type ClearMessage struct {
Id string `json:"id"`
Window uint8 `json:"window"` // In only
}
const clearNum = 3
/*
In order for a server to provide a useful cooperative service
to WSJT-X it is possible for it to initiate a QSO by sending
this message to a client. WSJT-X filters this message and only
acts upon it if the message exactly describes a prior decode
and that decode is a CQ or QRZ message. The action taken is
exactly equivalent to the user double clicking the message in
the "Band activity" window.
In only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l255
*/
type ReplyMessage struct {
Id string `json:"id"`
Time uint32 `json:"time"`
Snr int32 `json:"snr"`
DeltaTimeSec float64 `json:"deltaTime"`
DeltaFrequencyHz uint32 `json:"deltaFrequency"`
Mode string `json:"mode"`
Message string `json:"message"`
LowConfidence bool `json:"lowConfidence"`
Modifiers uint8 `json:"modifiers"`
}
const replyNum = 4
/*
The QSO logged message is sent when the WSJT-X user accepts the "Log QSO" dialog by clicking
the "OK" button.
Out only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l295
*/
type QsoLoggedMessage struct {
Id string `json:"id"`
DateTimeOff time.Time `json:"dateTimeOff"`
DxCall string `json:"dxCall"`
DxGrid string `json:"dxGrid"`
TxFrequency uint64 `json:"txFrequency"`
Mode string `json:"mode"`
ReportSent string `json:"reportSent"`
ReportReceived string `json:"reportReceived"`
TxPower string `json:"txPower"`
Comments string `json:"comments"`
Name string `json:"name"`
DateTimeOn time.Time `json:"dateTimeOn"`
OperatorCall string `json:"operatorCall"`
MyCall string `json:"myCall"`
MyGrid string `json:"myGrid"`
ExchangeSent string `json:"exchangeSent"`
ExchangeReceived string `json:"exchangeReceived"`
ADIFPropagationMode string `json:"propagationMode"`
}
const qsoLoggedNum = 5
/*
Close is sent by a client immediately prior to it shutting
down gracefully.
Out/In.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l320
*/
type CloseMessage struct {
Id string `json:"id"`
}
const closeNum = 6
/*
When a server starts it may be useful for it to determine the
state of preexisting clients. Sending this message to each
client as it is discovered will cause that client (WSJT-X) to
send a "Decode" message for each decode currently in its "Band
activity" window.
In only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l328
*/
type ReplayMessage struct {
Id string `json:"id"`
}
const replayNum = 7
/*
The server may stop a client from transmitting messages either
immediately or at the end of the current transmission period
using this message.
In only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l343
*/
type HaltTxMessage struct {
Id string `json:"id"`
AutoTxOnly bool `json:"autoTxOnly"`
}
const haltTxNum = 8
/*
This message allows the server to set the current free text
message content. Sending this message with a non-empty "Text"
field is equivalent to typing a new message (old contents are
discarded) in to the WSJT-X free text message field or "Tx5"
field (both are updated) and if the "Send" flag is set then
clicking the "Now" radio button for the "Tx5" field if tab one
is current or clicking the "Free msg" radio button if tab two
is current.
In only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l352
*/
type FreeTextMessage struct {
Id string `json:"id"`
Text string `json:"text"`
Send bool `json:"send"`
}
const freeTextNum = 9
/*
The decode message is sent when a new decode is completed, in
this case the 'New' field is true.
Out only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l383
*/
type WSPRDecodeMessage struct {
Id string `json:"id"`
New bool `json:"new"`
Time uint32 `json:"time"`
Snr int32 `json:"snr"`
DeltaTime float64 `json:"deltaTime"`
Frequency uint64 `json:"frequency"`
Drift int32 `json:"drift"`
Callsign string `json:"callsign"`
Grid string `json:"grid"`
Power int32 `json:"power"`
OffAir bool `json:"offAir"`
}
const wsprDecodeNum = 10
/*
This message allows the server to set the current current
geographical location of operation. The supplied location is
not persistent but is used as a session lifetime replacement
loction that overrides the Maidenhead grid locater set in the
application settings.
In only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l406
*/
type LocationMessage struct {
Id string `json:"id"`
Location string `json:"location"`
}
const locationNum = 11
/*
The logged ADIF message is sent to the server(s) when the
WSJT-X user accepts the "Log QSO" dialog by clicking the "OK"
button.
Out only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l423
*/
type LoggedAdifMessage struct {
Id string `json:"id"`
Adif string `json:"adif"`
}
const loggedAdifNum = 12
/*
The server may send this message at any time. The message
specifies the background and foreground color that will be
used to highlight the specified callsign in the decoded
messages printed in the Band Activity panel. To clear
and cancel highlighting send an invalid QColor value for
either or both of the background and foreground fields.
In only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l444
*/
type HighlightCallsignMessage struct {
Id string `json:"id"`
Callsign string `json:"callsign"`
BackgroundColor string `json:"backgroundColor"`
ForegroundColor string `json:"foregroundColor"`
HighlightLast bool `json:"highlightLast"`
// This field is not part of the WSJT-X message and is specific to the golang library. It is a
// necessary addition to be able to reset the highlighting. QT's color has a sentinel value in
// QColor to signal an "invalid" color; golang image/color doesn't have that, so we add this
// field. If this is true, BackgroundColor and ForegroundColor become "invalid" colors.
Reset bool `json:"reset"`
}
const highlightCallsignNum = 13
/*
The server may send this message at any time. The message
specifies the name of the configuration to switch to. The new
configuration must exist.
In only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l445
*/
type SwitchConfigurationMessage struct {
Id string `json:"id"`
ConfigurationName string `json:"configurationName"`
}
const switchConfigurationNum = 14
/*
The server may send this message at any time. The message
specifies various configuration options. For utf8 string
fields an empty value implies no change, for the quint32 Rx DF
and Frequency Tolerance fields the maximum quint32 value
implies no change. Invalid or unrecognized values will be
silently ignored.
In only.
https://sourceforge.net/p/wsjt/wsjtx/ci/wsjtx-2.5.2/tree/Network/NetworkMessage.hpp#l479
*/
type ConfigureMessage struct {
Id string `json:"id"`
Mode string `json:"mode"`
FrequencyTolerance uint32 `json:"frequencyTolerance"`
Submode string `json:"submode"`
FastMode bool `json:"fastMode"`
TRPeriod uint32 `json:"trPeriod"`
RxDF uint32 `json:"rxDF"`
DXCall string `json:"dxCall"`
DXGrid string `json:"dxGrid"`
GenerateMessages bool `json:"generateMessages"`
}
const configureNum = 15