# HG changeset patch # User Josef 'Jeff' Sipek # Date 1725992065 14400 # Tue Sep 10 14:14:25 2024 -0400 # Node ID 77e5c92691c5c45b6a0e2af1230d6033fb0aa84b # Parent ecce4a0268fac077025eaaa71073b1be733753a6 wsjtx: base logged contacts on the contest template This is the same thing as what the UI does. In general, the value from the template is used but wsjtx packet values override whatever may be in the template. It is therefore important for wsjxt to *not* include values that are not meant to override the template. For example, wsjtx should *not* provide an operator callsign as that will override the callsign from the template. Signed-off-by: Josef 'Jeff' Sipek diff --git a/hlog/contest.c b/hlog/contest.c --- a/hlog/contest.c +++ b/hlog/contest.c @@ -388,7 +388,7 @@ * 1. ncurses ui * 2. wsjtx udp listener */ - ret = wsjtx_start(lua); + ret = wsjtx_start(lua, &contest_params); if (ret) goto err_script; diff --git a/hlog/contest/wsjtx.c b/hlog/contest/wsjtx.c --- a/hlog/contest/wsjtx.c +++ b/hlog/contest/wsjtx.c @@ -34,6 +34,7 @@ #include "wsjtx.h" static struct udpsvc *svc; +static const struct contest_params *contest_params; #define WSJTX_HOST NULL #define WSJTX_PORT 2237 @@ -233,6 +234,12 @@ if (IS_ERR(qso)) return PTR_ERR(qso); + qso_copy(qso, contest_params->template); + + /* generate a new uuid - it's ugly that we have to reach in like this */ + xuuid_generate(&qso->uuid); + xuuid_unparse(&qso->uuid, qso->uuid_str); + /* QSO */ qso->start = msg->t5.timeon; qso->end = msg->t5.timeoff; @@ -410,10 +417,12 @@ } } -int wsjtx_start(struct xlua_state *lua) +int wsjtx_start(struct xlua_state *lua, const struct contest_params *params) { struct udpsvc *svc; + contest_params = params; + svc = udpsvc(WSJTX_HOST, WSJTX_PORT, false, "wsjtx", wsjtx_process, lua); if (IS_ERR(svc)) { diff --git a/hlog/contest/wsjtx.h b/hlog/contest/wsjtx.h --- a/hlog/contest/wsjtx.h +++ b/hlog/contest/wsjtx.h @@ -25,7 +25,8 @@ #include -extern int wsjtx_start(struct xlua_state *lua); +extern int wsjtx_start(struct xlua_state *lua, + const struct contest_params *parms); extern void wsjtx_stop(void); #endif