summaryrefslogtreecommitdiff
path: root/include/hybbx/broadcast.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hybbx/broadcast.h')
-rw-r--r--include/hybbx/broadcast.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/include/hybbx/broadcast.h b/include/hybbx/broadcast.h
new file mode 100644
index 0000000..a4002b7
--- /dev/null
+++ b/include/hybbx/broadcast.h
@@ -0,0 +1,110 @@
+#ifndef HYBBX_BROADCAST_H
+#define HYBBX_BROADCAST_H
+
+/**
+ * HyBBX broadcast — Main instance only.
+ *
+ * User command `/broadcast` (alias `/announce`): instant `+++` message to every
+ * online local user session on this Main (telnet/SSH/WebSocket).
+ * Format: `+++ <from>: <message>` (manual Sysop/grant announce).
+ * Automatic system notices use `***` instead.
+ *
+ * `/broadcast ax25`: manual instant RF beacon — ax25_auto_message to each
+ * qualifying packet-radio link sequentially (no custom RF text).
+ *
+ * INI `[broadcast]` ax25_auto: periodic AX.25 QST UI beacon over HBX to
+ * Secondary extenders (low-bandwidth + half-duplex links). Separate from
+ * `/broadcast`; not a user command. One sequential cycle per interval (min
+ * 900 s); 180 s own-channel idle before each link TX; 180 s between links;
+ * per-link min 900 s. Busy channel defers until idle.
+ */
+
+#include "hybbx/ax25.h"
+#include "hybbx/config.h"
+#include "hybbx/limits.h"
+#include "hybbx/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define HYBBX_AX25_FREQUENCY_MAX 40u
+/** Local Main announce message cap. */
+#define HYBBX_BROADCAST_MESSAGE_MAX 240u
+
+#define HYBBX_BROADCAST_AUTO_MESSAGE_DEFAULT "Broadcast: @service@ online"
+
+typedef struct hybbx_ax25_frequency_table {
+ unsigned count;
+ double mhz[HYBBX_AX25_FREQUENCY_MAX];
+ char labels[HYBBX_AX25_FREQUENCY_MAX][32];
+} hybbx_ax25_frequency_table_t;
+
+typedef struct hybbx_broadcast_config {
+ int enabled;
+ int ax25_enabled;
+ int ax25_auto;
+ unsigned ax25_auto_interval_sec;
+ /** Ignored (legacy INI); links always send sequentially with link gap. */
+ unsigned ax25_auto_stagger_sec;
+ char ax25_mycall[HYBBX_AX25_CALL_MAX + 1];
+ char ax25_dest[HYBBX_AX25_CALL_MAX + 1];
+ char ax25_auto_message[HYBBX_BROADCAST_AX25_MESSAGE_MAX + 1];
+ hybbx_ax25_frequency_table_t frequencies;
+} hybbx_broadcast_config_t;
+
+struct hybbx_service;
+struct hybbx_session;
+
+void hybbx_ax25_frequency_table_clear(hybbx_ax25_frequency_table_t *table);
+
+/** Load `[ax25]` frequency1 … frequencyN (MHz) and optional labels. */
+void hybbx_ax25_frequency_apply(hybbx_ax25_frequency_table_t *table,
+ const hybbx_config_t *config);
+
+/** Compare two MHz values (tolerance for INI rounding). */
+int hybbx_ax25_frequency_match(double a_mhz, double b_mhz);
+
+void hybbx_broadcast_config_defaults(hybbx_broadcast_config_t *cfg);
+
+/** Load `[broadcast]` + `[ax25]` from INI. */
+void hybbx_broadcast_config_apply(hybbx_broadcast_config_t *cfg,
+ const hybbx_config_t *config);
+
+const hybbx_broadcast_config_t *hybbx_service_get_broadcast(
+ const struct hybbx_service *service);
+
+/**
+ * Send @p message to every online local user on this Main (Sysop `/broadcast`).
+ */
+hybbx_result_t hybbx_broadcast_announce(struct hybbx_service *service,
+ struct hybbx_session *from,
+ const char *message);
+
+/**
+ * Manual AX.25 beacon (Sysop `/broadcast ax25`): INI ax25_auto_message to each
+ * qualifying link immediately, one after another. No custom RF text.
+ */
+hybbx_result_t hybbx_broadcast_ax25_manual(struct hybbx_service *service);
+
+/**
+ * AX.25 auto-beacon over HBX (INI ax25_auto only).
+ * Link must be low-bandwidth and half-duplex (QoS).
+ */
+hybbx_result_t hybbx_broadcast_ax25(struct hybbx_service *service,
+ double frequency_mhz,
+ const char *message);
+
+/**
+ * Periodic AX.25 auto-beacon (call once per second from Main service loop).
+ */
+void hybbx_broadcast_ax25_tick(struct hybbx_service *service);
+
+/** Abort an in-flight sequential AX.25 cycle (hub stop / shutdown). */
+void hybbx_broadcast_ax25_seq_cancel(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HYBBX_BROADCAST_H */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com