feat: implemented HRDLog upload

This commit is contained in:
2026-06-18 14:27:33 +02:00
parent e8eedcc1dc
commit cdd71b17c8
11 changed files with 333 additions and 8 deletions
+24 -1
View File
@@ -115,6 +115,7 @@ func (m *Manager) SetConfig(cfg ExternalServices) {
cfg.QRZ = cfg.QRZ.normalised()
cfg.Clublog = cfg.Clublog.normalised()
cfg.LoTW = cfg.LoTW.normalised()
cfg.HRDLog = cfg.HRDLog.normalised()
m.cfg = cfg
}
@@ -151,6 +152,10 @@ func (m *Manager) OnQSOLogged(id int64) {
if lt := cfg.LoTW; lt.AutoUpload && lt.TQSLPath != "" && lt.StationLocation != "" {
m.route(ServiceLoTW, id, lt)
}
// HRDLog — needs the station callsign + the account upload code.
if h := cfg.HRDLog; h.AutoUpload && h.Callsign != "" && h.Code != "" {
m.route(ServiceHRDLog, id, h)
}
}
// route sends a logged QSO down the configured timing path: queue it for the
@@ -190,6 +195,9 @@ func (m *Manager) onCloseServices() []Service {
if l := cfg.LoTW; l.AutoUpload && l.UploadMode == ModeOnClose && l.TQSLPath != "" && l.StationLocation != "" {
out = append(out, ServiceLoTW)
}
if h := cfg.HRDLog; h.AutoUpload && h.UploadMode == ModeOnClose && h.Callsign != "" && h.Code != "" {
out = append(out, ServiceHRDLog)
}
return out
}
@@ -237,6 +245,12 @@ func (m *Manager) FlushOnClose() int {
uploaded++
}
}
case ServiceHRDLog:
for _, id := range ids {
if m.upload(svc, id, cfg.HRDLog) {
uploaded++
}
}
}
}
return uploaded
@@ -303,7 +317,7 @@ func (m *Manager) upload(svc Service, id int64, cfg ServiceConfig) bool {
switch svc {
case ServiceQRZ, ServiceLoTW:
owner = cfg.ForceStationCallsign
case ServiceClublog:
case ServiceClublog, ServiceHRDLog:
owner = cfg.Callsign
}
if owner != "" && m.deps.StationCallOf != nil {
@@ -351,6 +365,15 @@ func (m *Manager) upload(svc Service, id int64, cfg ServiceConfig) bool {
return false
}
res, err = UploadLoTW(ctx, cfg, "", record)
case ServiceHRDLog:
// HRDLog takes the station callsign as a separate param, so the ADIF
// keeps the QSO's own station call (no override), like Club Log.
record, ok := m.deps.BuildADIF(id, "")
if !ok {
m.logf("extsvc: %s upload of QSO %d skipped (no record)", svc, id)
return false
}
res, err = UploadHRDLog(ctx, m.deps.Client, cfg.Callsign, cfg.Code, record)
default:
return false
}