fix(udp): send the structured QSO Logged too, not only the ADIF one

The ADIF datagram reached Logger32's socket and still nothing appeared in its
log. WSJT-X sends TWO messages for every contact — QSO Logged (type 5), the
structured one, and Logged ADIF (type 12) — and receivers differ on which they
read: MacLoggerDX takes the structured one by default and offers the ADIF as
an option. We were sending only the half Logger32 does not use.

Both now go out on that row, in WSJT-X's own order. Nothing double-logs: any
receiver built for WSJT-X already sees both from the real thing.

Type 5 is read positionally, so the field order is pinned by a test against
NetworkMessage.hpp — one field out of place shifts every one after it and the
receiver files nonsense without complaining. QDateTime is Qt's own encoding:
Julian day, milliseconds since midnight, then the time spec, which is sent as
UTC (1) because a spec of 0 would have the receiver re-read the contact in its
own zone. The Julian arithmetic is checked against known values; a day out
there files every QSO on the wrong date.
This commit is contained in:
2026-08-15 00:55:24 +02:00
parent d95c998081
commit dc14990b44
5 changed files with 252 additions and 11 deletions
+38 -2
View File
@@ -2779,7 +2779,7 @@ func (a *App) AddQSO(q qso.QSO) (id int64, err error) {
if a.udp != nil {
rec := adif.SingleRecordADIF(qc)
a.udp.EmitLoggedADIF(rec)
a.udp.EmitLoggedADIFWSJT(rec)
a.udp.EmitLoggedQSOWSJT(wsjtLoggedQSO(qc), rec)
}
// Nudge the grid again so the award_refs columns appear once materialised.
if a.ctx != nil {
@@ -12207,7 +12207,7 @@ func (a *App) LogUDPLoggedADIF(adifText string) (int64, error) {
if a.udp != nil {
rec := adif.SingleRecordADIF(qc)
a.udp.EmitLoggedADIF(rec)
a.udp.EmitLoggedADIFWSJT(rec)
a.udp.EmitLoggedQSOWSJT(wsjtLoggedQSO(qc), rec)
}
if a.ctx != nil {
wruntime.EventsEmit(a.ctx, "qso:logged", id) // refresh again so award_refs show
@@ -18231,3 +18231,39 @@ func (a *App) ampTargets(id string, linked []string) []string {
}
return out
}
// wsjtLoggedQSO maps a logged contact onto the fields a WSJT-X "QSO Logged"
// message carries, for the outbound UDP row that speaks that protocol.
//
// TIME_OFF falls back to TIME_ON: the message has both, and a receiver that
// files the contact by the end time would put a QSO with no recorded end at the
// zero date — 1 January year 1, which is what a Julian day of zero means.
func wsjtLoggedQSO(q qso.QSO) udp.LoggedQSO {
out := udp.LoggedQSO{
DXCall: q.Callsign,
DXGrid: q.Grid,
Mode: q.Mode,
ReportSent: q.RSTSent,
ReportRcvd: q.RSTRcvd,
Comments: q.Comment,
Name: q.Name,
TimeOn: q.QSODate.UTC(),
TimeOff: q.QSODate.UTC(),
OperatorCall: q.Operator,
MyCall: q.StationCallsign,
MyGrid: q.MyGrid,
ExchangeSent: q.STXString,
ExchangeRcvd: q.SRXString,
PropMode: q.PropMode,
}
if !q.QSODateOff.IsZero() {
out.TimeOff = q.QSODateOff.UTC()
}
if q.FreqHz != nil && *q.FreqHz > 0 {
out.TxFreqHz = uint64(*q.FreqHz)
}
if q.TXPower != nil && *q.TXPower > 0 {
out.TxPower = strconv.FormatFloat(*q.TXPower, 'f', -1, 64)
}
return out
}