[feat](trx-rs): extract trx-reporting crate for uplink tasks
Move aprsfi and pskreporter modules from trx-server into a new standalone trx-reporting library crate. Config types (AprsFiConfig, PskReporterConfig) move to trx-reporting and are re-exported from trx-server::config for backwards compatibility. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# SPDX-FileCopyrightText: 2026 Stanislaw Grams <stanislawgrams@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
[package]
|
||||
name = "trx-reporting"
|
||||
version.workspace = true
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
tracing = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
trx-core = { path = "../trx-core" }
|
||||
@@ -14,7 +14,7 @@ use tracing::{debug, info, warn};
|
||||
|
||||
use trx_core::decode::{AprsPacket, DecodedMessage};
|
||||
|
||||
use crate::config::AprsFiConfig;
|
||||
use crate::AprsFiConfig;
|
||||
|
||||
/// Compute the APRS-IS passcode for a callsign.
|
||||
///
|
||||
@@ -0,0 +1,61 @@
|
||||
// SPDX-FileCopyrightText: 2026 Stanislaw Grams <stanislawgrams@gmail.com>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
//! Reporting uplink tasks: PSK Reporter and APRS-IS IGate.
|
||||
|
||||
pub mod aprsfi;
|
||||
pub mod pskreporter;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// PSK Reporter uplink configuration.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct PskReporterConfig {
|
||||
/// Whether PSK Reporter uplink is enabled
|
||||
pub enabled: bool,
|
||||
/// PSK Reporter host
|
||||
pub host: String,
|
||||
/// PSK Reporter UDP port
|
||||
pub port: u16,
|
||||
/// Receiver locator (Maidenhead, 4 or 6 chars). If omitted, derived from
|
||||
/// [general].latitude/[general].longitude when available.
|
||||
pub receiver_locator: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for PskReporterConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enabled: false,
|
||||
host: "report.pskreporter.info".to_string(),
|
||||
port: 4739,
|
||||
receiver_locator: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// APRS-IS IGate uplink configuration.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct AprsFiConfig {
|
||||
/// Whether APRS-IS IGate uplink is enabled
|
||||
pub enabled: bool,
|
||||
/// APRS-IS server hostname
|
||||
pub host: String,
|
||||
/// APRS-IS server port
|
||||
pub port: u16,
|
||||
/// APRS-IS passcode. -1 = auto-compute from [general].callsign.
|
||||
pub passcode: i32,
|
||||
}
|
||||
|
||||
impl Default for AprsFiConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enabled: false,
|
||||
host: "rotate.aprs.net".to_string(),
|
||||
port: 14580,
|
||||
passcode: -1,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ use tracing::{info, warn};
|
||||
use trx_core::decode::DecodedMessage;
|
||||
use trx_core::rig::state::RigState;
|
||||
|
||||
use crate::config::PskReporterConfig;
|
||||
use crate::PskReporterConfig;
|
||||
|
||||
const PSK_REPORTER_IDENTIFIER: u16 = 0x000A;
|
||||
const RECEIVER_FLOWSET: u16 = 0x9992;
|
||||
@@ -39,4 +39,5 @@ trx-cw = { path = "../decoders/trx-cw" }
|
||||
trx-decode-log = { path = "../decoders/trx-decode-log" }
|
||||
trx-ft8 = { path = "../decoders/trx-ft8" }
|
||||
trx-wspr = { path = "../decoders/trx-wspr" }
|
||||
trx-protocol = { path = "../trx-protocol" }
|
||||
trx-protocol = { path = "../trx-protocol" }
|
||||
trx-reporting = { path = "../trx-reporting" }
|
||||
@@ -276,56 +276,7 @@ impl Default for AudioConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// PSK Reporter uplink configuration.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct PskReporterConfig {
|
||||
/// Whether PSK Reporter uplink is enabled
|
||||
pub enabled: bool,
|
||||
/// PSK Reporter host
|
||||
pub host: String,
|
||||
/// PSK Reporter UDP port
|
||||
pub port: u16,
|
||||
/// Receiver locator (Maidenhead, 4 or 6 chars). If omitted, derived from
|
||||
/// [general].latitude/[general].longitude when available.
|
||||
pub receiver_locator: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for PskReporterConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enabled: false,
|
||||
host: "report.pskreporter.info".to_string(),
|
||||
port: 4739,
|
||||
receiver_locator: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// APRS-IS IGate uplink configuration.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct AprsFiConfig {
|
||||
/// Whether APRS-IS IGate uplink is enabled
|
||||
pub enabled: bool,
|
||||
/// APRS-IS server hostname
|
||||
pub host: String,
|
||||
/// APRS-IS server port
|
||||
pub port: u16,
|
||||
/// APRS-IS passcode. -1 = auto-compute from [general].callsign.
|
||||
pub passcode: i32,
|
||||
}
|
||||
|
||||
impl Default for AprsFiConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enabled: false,
|
||||
host: "rotate.aprs.net".to_string(),
|
||||
port: 14580,
|
||||
passcode: -1,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub use trx_reporting::{AprsFiConfig, PskReporterConfig};
|
||||
|
||||
/// Top-level SDR configuration (only used when [rig.access] type = "sdr").
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
mod aprsfi;
|
||||
mod audio;
|
||||
mod config;
|
||||
mod error;
|
||||
mod history_store;
|
||||
mod listener;
|
||||
mod pskreporter;
|
||||
mod rig_handle;
|
||||
mod rig_task;
|
||||
|
||||
@@ -489,7 +487,7 @@ fn spawn_rig_audio_stack(
|
||||
let pr_shutdown_rx = shutdown_rx.clone();
|
||||
handles.push(tokio::spawn(async move {
|
||||
tokio::select! {
|
||||
_ = pskreporter::run_pskreporter_uplink(
|
||||
_ = trx_reporting::pskreporter::run_pskreporter_uplink(
|
||||
pr_cfg,
|
||||
cs,
|
||||
latitude,
|
||||
@@ -516,7 +514,7 @@ fn spawn_rig_audio_stack(
|
||||
let ai_shutdown_rx = shutdown_rx.clone();
|
||||
handles.push(tokio::spawn(async move {
|
||||
tokio::select! {
|
||||
_ = aprsfi::run_aprsfi_uplink(ai_cfg, cs, ai_decode_rx) => {}
|
||||
_ = trx_reporting::aprsfi::run_aprsfi_uplink(ai_cfg, cs, ai_decode_rx) => {}
|
||||
_ = wait_for_shutdown(ai_shutdown_rx) => {}
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user