-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcast2pubsub.py
690 lines (597 loc) · 28.1 KB
/
mcast2pubsub.py
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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
# 1. receive multicast messages from WSJT-X (and anything that looks like it on the same group)
# 2. decode messages from QTDatastream and map the fields
# 3. ignore everything that isn't emitted by WSJT-X (although debug will show that
# it has been seen on the wire)
# 4. emit to pubsub topic node/component/wsjtx_message_type
#
# format description:
# https://sourceforge.net/p/wsjt/wsjtx/ci/master/tree/Network/NetworkMessage.hpp
# based on QDatastream from the Qt framework.
#
# dependencies:
# if using PySide6, pip install pyside6
# if using PyQt5, sudo apt install qtbase5-dev; pip install pyqt5
# install hexdump with pip install simple-hexdump
# install juliandate with pip install juliandate
import socket
import struct
import sys
from PySide6.QtCore import QByteArray, QDataStream, QIODevice
#from PyQt5.QtCore import QByteArray, QDataStream, QIODevice
from hexdump import hexdump
import datetime
import juliandate as jd
import json
import redis
# constants
debug = True
debug_only_wsjtx_message_type = -1 # ignore specific message, all messages
#debug_only_wsjtx_message_type = 0 # specific message only, cut down on the noise
mcast_group = '224.0.0.1'
mcast_port = 2237
# decode the UTF-8 strings embedded in the QDatastream of WSJT-X UDP messages
def decode_utf8_str(stream):
len = stream.readUInt32()
if len == 0xffffffff: # null string is mashed into an empty string
return ""
else:
bytes = stream.readRawData(len)
return bytes.decode("utf-8)")
# decode qtime (milliseconds since midnight UTC) into an ISO 8601 timestamp string
def decode_qtime_iso8601str(stream):
utcnow = datetime.datetime.now(datetime.UTC)
utcmidnight = datetime.datetime(utcnow.year, utcnow.month, utcnow.day, 0, 0)
msecs_since_midnight = stream.readUInt32()
timestamp = utcmidnight + datetime.timedelta(milliseconds=msecs_since_midnight)
iso8601_timestamp = timestamp.isoformat() + 'Z'
if (debug and debug_only_wsjtx_message_type == -1):
print("iso8601_timestamp:", iso8601_timestamp)
return iso8601_timestamp
# decode qdatetime into an ISO 8601 timestamp string
def decode_qdatetime_iso8601str(stream):
julian_days = stream.readInt64() # QDate
msecs_since_midnight = stream.readUInt32()
timespec = stream.readUInt8()
if timespec == 3:
raise("non-spec qso logged message received with timespec 3 (timezones).")
if timespec == 2:
offset = stream.readInt32()
if debug:
print("offset:", offset)
raise("unable to deal with QDateTime objects with timespec=2 (offset={}).".format(offset))
gregorian_datetime = datetime.datetime(*jd.to_gregorian(julian_days))
# Apparently this is always noon. since the QTime is milliseconds since midnight, if we add it to the
# gregorgian_date the resulting timestamp will be off by 12 hours every time.
# Instead, we recreate the date with starting point at midnight and add milliseconds to it. This is safe
# because julian_days will always be an integer and never fractions of a day.
combined_datetime = datetime.datetime(gregorian_datetime.year, gregorian_datetime.month, gregorian_datetime.day,0,0) + datetime.timedelta(milliseconds=msecs_since_midnight)
iso8601_datetime = combined_datetime.isoformat() + 'Z'
if (debug and debug_only_wsjtx_message_type == -1):
print("julian_days:", julian_days)
print("msecs_since_midnight:", msecs_since_midnight)
print("timespec:", timespec)
print("gregorian_datetime:", gregorian_datetime)
print("combined_datetime:", combined_datetime)
print("combined_datetime.isoformat()Z:", iso8601_datetime)
print("iso8601_datetime", iso8601_datetime)
return iso8601_datetime
# create Redis client
try:
redis_client = redis.Redis(host="docker", port=6379)
except Exception as e:
print("Redis init problem:", str(e))
# open multicast socket and join group 224.0.0.1:2237 where we expect WSJT-X UDP multicasts in QTDatastream format
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind((mcast_group, mcast_port))
mreq = socket.inet_aton(mcast_group) + socket.inet_aton("0.0.0.0")
sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
while True:
# pubsub_message is the object that is published to AMQP
# it is reset to undefined here, and every message type that does publish a producer
# message will provide its own message. If undefined type is published, we know we hit
# an area of the code that should be evaluated for more work.
pubsub_message = { 'type': 'undefined' }
data, addr = sock.recvfrom(10240)
buffer = QByteArray(data)
stream = QDataStream(buffer)
stream.setByteOrder(QDataStream.BigEndian)
try:
# check magic number match
magic = stream.readUInt32()
if magic != 0xadbccbda:
if debug:
print(hexdump(data))
print("source:",format(addr))
raise Exception("bad magic number (" + str(magic) + ")")
# check schema number match
schema = stream.readUInt32()
if schema != 2:
if debug:
print(hexdump(data))
print("source:",format(addr))
raise Exception("unsupported schema (" + str(schema) + ")")
# if we got here, we know we have something that looks like the message we're expecting from WSJT-X
# or something that's acting like it
wsjtx_message_type = stream.readUInt32()
if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
print(hexdump(data))
# print("source:",format(addr))
# FIXME
# https://github.com/ckuhtz/ham/issues/3
wsjtx_id = decode_utf8_str(stream)
# process message types
match wsjtx_message_type:
case 0:
# Heartbeat message from WSJT-X (discovery and schema negotiation)
# It appears schema negotation is optional?
# Out/In
wsjtx_max_schema = stream.readUInt32()
wsjtx_version = decode_utf8_str(stream)
wsjtx_revision = decode_utf8_str(stream)
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(heartbeat)")
# print("wsjtx_max_schema:", wsjtx_max_schema)
# print ("wsjtx_version/revision: {wsjtx_version}/{wsjtx_revision}".format(wsjtx_version=wsjtx_version,wsjtx_revision=wsjtx_revision))
pubsub_message = {
"wsjtx": {
"type": wsjtx_message_type,
"name": "heartbeat",
"id": wsjtx_id,
"version": wsjtx_version,
"revision": wsjtx_revision,
"max_schema": wsjtx_max_schema
},
"ip": {
"source": {
"ip": addr[0],
"port": addr[1]
},
"destination": {
"ip": mcast_group,
"port": mcast_port
}
}
}
case 1:
# Status update from WSJT-X
# Out
dial_freq = stream.readUInt64()
mode = decode_utf8_str(stream)
dx_call = decode_utf8_str(stream)
report = decode_utf8_str(stream)
tx_mode = decode_utf8_str(stream)
tx_enabled = stream.readBool()
transmitting = stream.readBool()
decoding = stream.readBool()
rx_df = stream.readUInt32()
tx_df = stream.readUInt32()
de_call = decode_utf8_str(stream)
de_grid = decode_utf8_str(stream)
dx_grid = decode_utf8_str(stream)
tx_watchdog = stream.readBool()
sub_mode = decode_utf8_str(stream)
fast_mode = stream.readBool()
spec_op_mode = stream.readUInt8()
freq_tolerance = stream.readUInt32()
tr_period = stream.readUInt32()
config_name = decode_utf8_str(stream)
tx_message = decode_utf8_str(stream)
match spec_op_mode:
case 0:
spec_op_mode_name = "none"
case 1:
spec_op_mode_name = "NA VHF"
case 2:
spec_op_mode_name = "EU VHF"
case 3:
spec_op_mode_name = "FIELD DAY"
case 4:
spec_op_mode_name = "RTTY RU"
case 5:
spec_op_mode_name = "WW DIGI"
case 6:
spec_op_mode_name = "FOX"
case 7:
spec_op_mode_name = "HOUND"
case 8:
spec_op_mode_name = "ARRL DIGI"
case _:
spec_op_mode_name = "wtf?"
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(status)")
# print("dial_freq:", dial_freq)
# print("mode:", mode)
# print("dx_call:", dx_call)
# print("report:", report)
# print("tx_mode:", tx_mode)
# print("tx_enabled:", tx_enabled)
# print("transmitting:", transmitting)
# print("decoding:", decoding)
# print("rx_df:", rx_df)
# print("tx_df:", tx_df)
# print("de_call:", de_call)
# print("de_grid:", de_grid)
# print("dx_grid:", dx_grid)
# print("tx_watchdog:", tx_watchdog)
# print("sub_mode:", sub_mode)
# print("fast_mode:", fast_mode)
# print("spec_op_mode: {} ".format(spec_op_mode), end="")
# print("(" + spec_op_mode_name + ")")
# print("freq_tolerance:", freq_tolerance, end="")
# if freq_tolerance == 4294967295:
# print(" (not applicable)")
# else:
# print()
# print("tr_period:", tr_period, end="")
# if tr_period == 4294967295:
# print(" (not applicable)")
# else:
# print()
# print("config_name:", config_name)
# print("tx_message:",tx_message)
pubsub_message = {
"wsjtx": {
"type": wsjtx_message_type,
"name": "status",
"id": wsjtx_id,
"config_name": config_name
},
"ip": {
"source": {
"ip": addr[0],
"port": addr[1]
},
"destination": {
"ip": mcast_group,
"port": mcast_port
}
},
"qso": {
"dial_freq": dial_freq,
"mode": {
"rx": mode,
"tx": tx_mode,
"sub_mode": sub_mode,
"fast_mode": fast_mode,
"spec_op": {
"mode": spec_op_mode,
"name": spec_op_mode_name
},
"freq_tolerance": freq_tolerance,
"tr_period": tr_period
},
"df": {
"rx": rx_df,
"tx": tx_df
},
"de": {
"call": de_call,
"grid": de_grid
},
"dx": {
"call": dx_call,
"grid": dx_grid
},
"report": report
},
"status": {
"tx_enabled": tx_enabled,
"transmitting": transmitting,
"decoding": decoding,
"tx_watchdog": tx_watchdog,
"tx_message": tx_message.rstrip()
}
}
case 2:
# WSJT-X has decoded a message
# Out
new = stream.readBool()
time = decode_qtime_iso8601str(stream)
snr = stream.readInt32()
delta_time = stream.readFloat()
delta_freq = stream.readUInt32()
mode = decode_utf8_str(stream)
rx_message = decode_utf8_str(stream)
low_conf = stream.readBool()
off_air = stream.readBool()
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(decode)")
# print("new:", new)
# print("time:", time)
# print("snr:", snr)
# print("delta_time:", delta_time)
# print("delta_freq:", delta_freq)
# print("mode:", mode)
# print("rx_message:", rx_message)
# print("low_conf:", low_conf)
# print("off_air:", off_air)
pubsub_message = {
"wsjtx": {
"type": wsjtx_message_type,
"name": "decode",
"id": wsjtx_id,
},
"ip": {
"source": {
"ip": addr[0],
"port": addr[1]
},
"destination": {
"ip": mcast_group,
"port": mcast_port
}
},
"decode": {
"iso8601_timestamp": time,
"mode": mode,
"rx_message": rx_message,
"snr": snr,
"low_conf": low_conf,
"delta_time": delta_time,
"delta_freq": delta_freq,
"off_air": off_air
}
}
case 3:
# Either user has discarded prior decodes or the server is being instructed to discard decodes
# Out/In
window = stream.readUInt8()
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(clear)")
# print("window:", window)
pubsub_message = {
"wsjtx": {
"type": wsjtx_message_type,
"name": "clear",
"id": wsjtx_id,
},
"ip": {
"source": {
"ip": addr[0],
"port": addr[1]
},
"destination": {
"ip": mcast_group,
"port": mcast_port
}
},
"window": window
}
# case 4:
# Inbound control message to WSJT-X only
# In
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(reply)")
# ignored
case 5:
# QSO logged
# Out
datetime_off = decode_qdatetime_iso8601str(stream)
dx_call = decode_utf8_str(stream)
dx_grid = decode_utf8_str(stream)
tx_freq = stream.readUInt64()
mode = decode_utf8_str(stream)
report_sent = decode_utf8_str(stream)
report_rcvd = decode_utf8_str(stream)
tx_power = decode_utf8_str(stream)
comments = decode_utf8_str(stream)
name = decode_utf8_str(stream)
datetime_on = decode_qdatetime_iso8601str(stream)
op_call = decode_utf8_str(stream)
de_call = decode_utf8_str(stream)
de_grid = decode_utf8_str(stream)
exch_sent = decode_utf8_str(stream)
exch_rcvd = decode_utf8_str(stream)
adif_prop_mode = decode_utf8_str(stream)
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(qso logged)")
# print("datetime_off:", datetime_off)
# print("dx_call:", dx_call)
# print("dx_grid:", dx_grid)
# print("tx_freq:", tx_freq)
# print("mode:", mode)
# print("report_sent:", report_sent)
# print("report_rcvd:", report_rcvd)
# print("tx_power:", tx_power)
# print("comments:", comments)
# print("name:", name)
# print("datetime_on:", datetime_on)
# print("op_call", op_call)
# print("de_call:", de_call)
# print("de_grid:", de_grid)
# print("exch_sent:", exch_sent)
# print("exch_rcvd:", exch_rcvd)
# print("adif_prop_mode:", adif_prop_mode)
pubsub_message = {
"wsjtx": {
"type": wsjtx_message_type,
"name": "qso logged",
"id": wsjtx_id,
},
"ip": {
"source": {
"ip": addr[0],
"port": addr[1]
},
"destination": {
"ip": mcast_group,
"port": mcast_port
}
},
"qso": {
"tx_freq": tx_freq,
"mode": mode,
"tx_power": tx_power,
"de": {
"call": de_call,
"grid": de_grid,
"op": op_call
},
"dx": {
"call": dx_call,
"grid": dx_grid,
"name": name
},
"report": {
"sent": report_sent,
"received": report_rcvd
},
"exchange": {
"sent": exch_sent,
"received": exch_rcvd
},
"timestamp": {
"on": datetime_on,
"off": datetime_off
},
"comments": comments,
"adif": {
"prop_mode": adif_prop_mode
}
}
}
case 6:
# WSJT-X shutting down
# Out
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(close)")
pubsub_message = {
"wsjtx": {
"type": wsjtx_message_type,
"name": "close",
"id": wsjtx_id,
},
"ip": {
"source": {
"ip": addr[0],
"port": addr[1]
},
"destination": {
"ip": mcast_group,
"port": mcast_port
}
}
}
# case 7:
# Replay previous band decodes from WSJT-X
# In
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(replay)")
# ignored
# case 8:
# Halt transmissions in WSJT-X
# In
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(halt tx)")
# ignored
# case 9:
# Set free text message in WSJT-X
# In
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(freetext)")
# ignored
# case 10:
# WSPR decode receive from WSJT-X
# Out
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(WSPR decode)")
# ignored
# case 11:
# Location update for WSJT-X
# In
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(location update)")
# ignored
case 12:
# Logged ADIF message from WSJT-X
# Out
adif = decode_utf8_str(stream)
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(logged ADIF)")
# print("adif:", adif)
pubsub_message = {
"wsjtx": {
"type": wsjtx_message_type,
"name": "logged adif",
"id": wsjtx_id,
},
"ip": {
"source": {
"ip": addr[0],
"port": addr[1]
},
"destination": {
"ip": mcast_group,
"port": mcast_port
}
},
"adif": {
"message": adif
}
}
# case 13:
# Highlight call sign in WSJT-X
# In
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(callsign highlight)")
# ignored
# case 14:
# Switch WSJT-X configuration
# In
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(switch configuration)")
# ignored
# case 15:
# Configure WSJT-X
# In
# if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
# print("wsjtx_id:", wsjtx_id)
# print("wsjtx_message_type: {wsjtx_message_type} ".format(wsjtx_message_type=wsjtx_message_type), end="")
# print("(configure)")
# ignored
case _:
print()
raise Exception("unknown message type " + str(wsjtx_id) + " received.")
except Exception as e:
print("Error decoding WSJT-X data:", str(e))
# publish message to Redis pubsub
redis_client.publish(
'wsjtx-out',
json.dumps(pubsub_message)
)
if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
print("Redis pubsub <<", pubsub_message)
# if we're debugging, lets make sure we print a blank line to break up the mess. ;-)
if ( debug and ( debug_only_wsjtx_message_type == -1 or debug_only_wsjtx_message_type == wsjtx_message_type )):
print()