rpc: add qso announcement source to qso announcements

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
M hlog/contest/save.c +3 -1
@@ 76,7 76,9 @@ int save_qso_and_update_index(struct qso
 			   qso_get_mode(rx),
 			   qso_get_grid(rx));
 
-	announce_publish_qso(ANNOUNCE_QSO_NEW, &qso->uuid);
+	/* for now, fake the source */
+	announce_publish_qso(ANNOUNCE_QSO_NEW, ANNOUNCE_QSO_SRC_ANNOUNCE,
+			     &qso->uuid);
 
 	/*
 	 * Now, update the index

          
M rpc/announce-qso.c +3 -1
@@ 1,5 1,5 @@ 
 /*
- * Copyright (c) 2021 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2021,2024 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

          
@@ 26,9 26,11 @@ 
 
 void announce_pack_qso_msg(struct announce_msg *msg,
 			   enum announce_qso_msg_type type,
+			   enum announce_qso_msg_src src,
 			   const struct xuuid *uuid)
 {
 	msg->major = cpu8_to_be(ANNOUNCE_QSO);
 	msg->minor = cpu8_to_be(type);
 	memcpy(msg->u.qso.uuid, uuid->raw, sizeof(uuid->raw));
+	msg->u.qso.src = cpu8_to_be(src);
 }

          
M rpc/include/hlog-rpc/announce-pub.h +2 -1
@@ 41,11 41,12 @@ static inline void announce_publish_loc(
 }
 
 static inline void announce_publish_qso(enum announce_qso_msg_type type,
+					enum announce_qso_msg_src src,
 					const struct xuuid *uuid)
 {
 	struct announce_msg msg;
 
-	announce_pack_qso_msg(&msg, type, uuid);
+	announce_pack_qso_msg(&msg, type, src, uuid);
 	announce_publish(&msg);
 }
 

          
M rpc/include/hlog-rpc/announce.h +9 -1
@@ 52,6 52,12 @@ enum announce_qso_msg_type {
 	ANNOUNCE_QSO_UPDATED,
 };
 
+enum announce_qso_msg_src {
+	ANNOUNCE_QSO_SRC_ANNOUNCE = 0x0, /* from an announcement */
+	ANNOUNCE_QSO_SRC_UI, /* from ncurses ui */
+	ANNOUNCE_QSO_SRC_WSJTX, /* from wsjt-x UDP packet */
+};
+
 enum announce_loc_msg_type {
 	ANNOUNCE_LOC_CURRENT = 0x0,
 	ANNOUNCE_LOC_ACQ,

          
@@ 78,7 84,8 @@ struct announce_msg {
 	union {
 		struct {
 			uint8_t uuid[16];
-			uint8_t _pad2[112];
+			uint8_t src;
+			uint8_t _pad2[111];
 		} qso; /* ANNOUNCE_QSO */
 		struct {
 			uint8_t mode; /* 0 = no fix, 2 = 2D, 3 = 3D */

          
@@ 104,6 111,7 @@ extern void announce_pack_loc_msg(struct
 				  const char *grid);
 extern void announce_pack_qso_msg(struct announce_msg *msg,
 				  enum announce_qso_msg_type type,
+				  enum announce_qso_msg_src src,
 				  const struct xuuid *uuid);
 extern void announce_pack_rig_msg(struct announce_msg *msg,
 				  enum announce_rig_msg_type type,