From bc9b6e7b304b6db8cb457c75897bf1c2b8b26cfb Mon Sep 17 00:00:00 2001 From: Audric Date: Tue, 28 Apr 2026 18:05:01 +0200 Subject: [PATCH] feat(proto): add MsgPeerClient{Connected,Disconnected,Rx,Status} (125-128) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wire types for per-client liveness deltas. No call sites yet — emit and dispatch added in subsequent commits. --- src/svxlink/reflector/ReflectorMsg.h | 100 +++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/src/svxlink/reflector/ReflectorMsg.h b/src/svxlink/reflector/ReflectorMsg.h index 460900d..99c9758 100644 --- a/src/svxlink/reflector/ReflectorMsg.h +++ b/src/svxlink/reflector/ReflectorMsg.h @@ -1956,6 +1956,106 @@ class MsgPeerFilter : public ReflectorMsgBase<122> }; /* MsgPeerFilter */ +/** +@brief Per-client liveness delta — connected (geureflector extension, type 125) + +Sent over satellite and twin links when a local client connects, so the +receiving reflector can emit a peer//client//connected +MQTT event for live dashboard updates without waiting for the next +MsgPeerNodeList snapshot. +*/ +class MsgPeerClientConnected : public ReflectorMsgBase<125> +{ + public: + MsgPeerClientConnected(void) : m_tg(0) {} + MsgPeerClientConnected(const std::string& callsign, uint32_t tg, + const std::string& ip) + : m_callsign(callsign), m_tg(tg), m_ip(ip) {} + + const std::string& callsign(void) const { return m_callsign; } + uint32_t tg(void) const { return m_tg; } + const std::string& ip(void) const { return m_ip; } + + ASYNC_MSG_MEMBERS(m_callsign, m_tg, m_ip) + + private: + std::string m_callsign; + uint32_t m_tg; + std::string m_ip; +}; /* MsgPeerClientConnected */ + + +/** +@brief Per-client liveness delta — disconnected (type 126) +*/ +class MsgPeerClientDisconnected : public ReflectorMsgBase<126> +{ + public: + MsgPeerClientDisconnected(void) {} + explicit MsgPeerClientDisconnected(const std::string& callsign) + : m_callsign(callsign) {} + + const std::string& callsign(void) const { return m_callsign; } + + ASYNC_MSG_MEMBERS(m_callsign) + + private: + std::string m_callsign; +}; /* MsgPeerClientDisconnected */ + + +/** +@brief Per-client rx-status update (type 127) + +Carries an opaque rx status JSON blob (string-serialized — same pattern +as MsgPeerNodeList::m_status_blobs, with a 64 KiB receiver-side parse +cap). Sender-side debounced at 500 ms per callsign in +Reflector::fanoutClientRx. +*/ +class MsgPeerClientRx : public ReflectorMsgBase<127> +{ + public: + MsgPeerClientRx(void) {} + MsgPeerClientRx(const std::string& callsign, + const std::string& rx_json) + : m_callsign(callsign), m_rx_json(rx_json) {} + + const std::string& callsign(void) const { return m_callsign; } + const std::string& rxJson(void) const { return m_rx_json; } + + ASYNC_MSG_MEMBERS(m_callsign, m_rx_json) + + private: + std::string m_callsign; + std::string m_rx_json; +}; /* MsgPeerClientRx */ + + +/** +@brief Per-client status update (type 128) + +Carries the rich client status JSON blob (location, QTH, etc.) as a +string-serialized payload. Receiver-side parse cap 64 KiB. +*/ +class MsgPeerClientStatus : public ReflectorMsgBase<128> +{ + public: + MsgPeerClientStatus(void) {} + MsgPeerClientStatus(const std::string& callsign, + const std::string& status_json) + : m_callsign(callsign), m_status_json(status_json) {} + + const std::string& callsign(void) const { return m_callsign; } + const std::string& statusJson(void) const { return m_status_json; } + + ASYNC_MSG_MEMBERS(m_callsign, m_status_json) + + private: + std::string m_callsign; + std::string m_status_json; +}; /* MsgPeerClientStatus */ + + /** * @brief Twin-link message: mirror an external peer's talker-start *