feat(decodes): an FT decodes tab fed by the inbound UDP link
Every FTx decode WSJT-X, JTDX or MSHV puts on the wire, grouped by T/R
period. Optional and closable, from Tools -> FT decodes; its open state is
remembered, because an operator running digital modes leaves it open for
the session rather than consulting and closing it.
The period is the point, and what separates this from the cluster list.
FT8 is a sequence of fifteen-second slots and a band is read by watching
them go by: who called CQ this slot, who answered, what I was sending while
they did. A flat list sorted by time loses exactly that, so the list is
grouped one section per period, newest first, with the operator's own
transmission shown inside the slot it went out in.
Three fields had to be carried up from the wire to make it possible:
- the decode's OWN timestamp, which the parser read and threw away. It is
what assigns a slot: a period's decodes arrive in one burst a second or
two after it closes, so arrival time piles a whole period into the next
one. Rebuilt to UTC from milliseconds-since-midnight, with the
day-boundary case handled - a decode stamped 23:59:58 arriving at
00:00:01 would otherwise be dated a day ahead and sit at the top of the
list for the rest of the session.
- the decoded line itself. The exchange is what says where a station is in
a QSO, and no set of extracted fields reads like "R-09" does.
- tx_message and transmitting from Status, which nothing parsed before.
Recorded once per message rather than on every Status, which repeats it
about once a second for the whole over.
Also picked up on the way: is_new, low_confidence, off_air, the operator's
own call and grid, and the T/R period itself - better authority on slot
length than the mode name, which says nothing about a custom period. The
Status tail is read defensively: those fields were appended over successive
schema versions and JTDX and MSHV each stop at their own point, so a short
packet is normal and keeps whatever parsed.
Status flags come from ClusterSpotStatuses, the resolver the cluster list
and band map already use, filling the same cache. One verdict per call:
"new band" in this panel and plain worked in the cluster two seconds later
would be worse than no flag at all. Clicking a call goes through the same
handler as a cluster spot, so answering a station is one gesture whether it
came off telnet or off the receiver.
Filters: CQ only, new-anything only, band, mode, continent, an SNR floor
and a free search. The band, mode and continent choices are built from what
is actually on the feed - offering 160 m to a station whose receivers are
all on 6 m is noise.
Decodes are held in the frontend and pruned to a rolling half hour: they
are a live view, not data, nothing outside the panel reads them, and a
night of FT8 on 20 m would otherwise grow a list no filter can rescue.
Arrivals are staged on a 300 ms timer so a period landing as fifty packets
costs one status lookup and one render.
This commit is contained in:
@@ -77,6 +77,26 @@ func reusingListenConfig() net.ListenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
// decodeTime turns WSJT-X's milliseconds-since-midnight into a UTC instant.
|
||||
//
|
||||
// The sender gives a time of DAY with no date, so the date comes from our own
|
||||
// clock — and the two can straddle midnight: a decode stamped 23:59:58 that
|
||||
// reaches us at 00:00:01 would otherwise be dated a day late and sort to the top
|
||||
// of the list for the rest of the session. More than half a day apart is read as
|
||||
// the wrong side of midnight and moved.
|
||||
func decodeTime(msSinceMidnight uint32) time.Time {
|
||||
now := time.Now().UTC()
|
||||
midnight := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC)
|
||||
at := midnight.Add(time.Duration(msSinceMidnight) * time.Millisecond)
|
||||
switch {
|
||||
case at.Sub(now) > 12*time.Hour:
|
||||
at = at.AddDate(0, 0, -1) // stamped late yesterday, arrived after midnight
|
||||
case now.Sub(at) > 12*time.Hour:
|
||||
at = at.AddDate(0, 0, 1) // stamped just after midnight, our clock still on the old day
|
||||
}
|
||||
return at
|
||||
}
|
||||
|
||||
// Event is what a Server emits to its consumer for every parsed packet.
|
||||
// At most one of the fields is populated per event.
|
||||
type Event struct {
|
||||
@@ -96,6 +116,23 @@ type Event struct {
|
||||
DecodeFreqHz int64 // RF frequency (dial + audio offset)
|
||||
DecodeSNR int // reported SNR (dB)
|
||||
DecodeCQ bool // the decode was a CQ
|
||||
DecodeMsg string // the decoded line as printed ("CQ K1ABC FN42")
|
||||
// DecodeAt is the decode's own UTC timestamp, rebuilt from the sender's
|
||||
// milliseconds-since-midnight. It is what groups decodes into T/R periods:
|
||||
// a period's worth arrives in one burst, so arrival time would put them all
|
||||
// in whichever slot the burst happened to land in.
|
||||
DecodeAt time.Time
|
||||
// DecodeTRPeriod is the transmit/receive period in seconds, from the last
|
||||
// Status of the same program (15 = FT8). 0 when the sender never said.
|
||||
DecodeTRPeriod int
|
||||
DecodeDial int64 // dial frequency the decode was heard on, for the band
|
||||
DecodeOffAir bool // decoded from a file rather than off the air
|
||||
|
||||
// TxMessage is what the operator's digital app is sending, with Transmitting
|
||||
// true while the carrier is actually up. From Status, so ~1 Hz.
|
||||
TxMessage string
|
||||
Transmitting bool
|
||||
DECall string // the operator's own call, as the digital app knows it
|
||||
|
||||
// ClearCall is set when a WSJT/JTDX/MSHV Status message reports an EMPTY DX
|
||||
// Call after previously reporting one — i.e. the operator cleared the call in
|
||||
@@ -127,7 +164,10 @@ type Server struct {
|
||||
// 50.400 panadapter. WSJT-X requires --rig-name for a second instance, so the
|
||||
// id is distinct whenever there is more than one.
|
||||
dialHz map[string]int64
|
||||
lastDX string // WSJT: last non-empty DX Call seen, to detect a clear
|
||||
// trPeriod is the T/R period (seconds) from each program's last Status —
|
||||
// what tells a decode which slot it belongs to.
|
||||
trPeriod map[string]int
|
||||
lastDX string // WSJT: last non-empty DX Call seen, to detect a clear
|
||||
|
||||
// badPkts counts datagrams this listener could not parse, so the diagnostic
|
||||
// dump below stays bounded. A misconfigured port is not a one-off: the
|
||||
@@ -359,11 +399,28 @@ func (s *Server) handle(pkt []byte, remote *net.UDPAddr) {
|
||||
s.dialHz = map[string]int64{}
|
||||
}
|
||||
s.dialHz[w.ProgramID] = w.FreqHz
|
||||
// The T/R period travels with Status, and a decode has to be told
|
||||
// which slot it belongs to — so it is remembered per program the
|
||||
// same way the dial is.
|
||||
if w.TRPeriod > 0 {
|
||||
if s.trPeriod == nil {
|
||||
s.trPeriod = map[string]int{}
|
||||
}
|
||||
s.trPeriod[w.ProgramID] = w.TRPeriod
|
||||
}
|
||||
s.mu.Unlock()
|
||||
}
|
||||
if !w.IsDecode && (w.TxMessage != "" || w.DECall != "") {
|
||||
// What the operator is sending. Carried on every Status, so the
|
||||
// consumer sees it change as the QSO progresses.
|
||||
ev.TxMessage = w.TxMessage
|
||||
ev.Transmitting = w.Transmitting
|
||||
ev.DECall = w.DECall
|
||||
}
|
||||
if w.IsDecode {
|
||||
s.mu.Lock()
|
||||
dial := s.dialHz[w.ProgramID]
|
||||
tr := s.trPeriod[w.ProgramID]
|
||||
s.mu.Unlock()
|
||||
if dial <= 0 {
|
||||
// No Status from THIS instance yet. Guessing with another
|
||||
@@ -377,6 +434,11 @@ func (s *Server) handle(pkt []byte, remote *net.UDPAddr) {
|
||||
ev.DecodeSNR = w.SNR
|
||||
ev.DecodeCQ = w.IsCQ
|
||||
ev.Mode = w.Mode
|
||||
ev.DecodeMsg = w.DecodeMsg
|
||||
ev.DecodeAt = decodeTime(w.DecodeMsSinceMidnight)
|
||||
ev.DecodeTRPeriod = tr
|
||||
ev.DecodeDial = dial
|
||||
ev.DecodeOffAir = w.OffAir
|
||||
break
|
||||
}
|
||||
// Only a logged QSO is worth a line — WSJT-X/MSHV send a Status packet
|
||||
@@ -501,7 +563,10 @@ func (s *Server) handle(pkt []byte, remote *net.UDPAddr) {
|
||||
// Empty events are useless; skip — EXCEPT a clear signal, which is meant to be
|
||||
// empty (the DX Call was cleared in the digital app), and a tune-only
|
||||
// request (freq with no callsign).
|
||||
if ev.DXCall == "" && ev.LoggedADIF == "" && ev.DecodeCall == "" && !ev.ClearCall && ev.TuneFreqHz == 0 {
|
||||
// TxMessage rides on Status, which also carries the DX call — but a Status
|
||||
// with an empty DX call and a live transmit message (calling CQ) used to be
|
||||
// dropped here, and that is exactly the message the decodes panel needs.
|
||||
if ev.DXCall == "" && ev.LoggedADIF == "" && ev.DecodeCall == "" && ev.TxMessage == "" && !ev.ClearCall && ev.TuneFreqHz == 0 {
|
||||
return
|
||||
}
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user