[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:
Generated
+11
@@ -2650,6 +2650,16 @@ dependencies = [
|
|||||||
"trx-core",
|
"trx-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "trx-reporting"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
"trx-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "trx-server"
|
name = "trx-server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -2678,6 +2688,7 @@ dependencies = [
|
|||||||
"trx-decode-log",
|
"trx-decode-log",
|
||||||
"trx-ft8",
|
"trx-ft8",
|
||||||
"trx-protocol",
|
"trx-protocol",
|
||||||
|
"trx-reporting",
|
||||||
"trx-vdes",
|
"trx-vdes",
|
||||||
"trx-wspr",
|
"trx-wspr",
|
||||||
"uuid",
|
"uuid",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ members = [
|
|||||||
"src/trx-core",
|
"src/trx-core",
|
||||||
"src/trx-protocol",
|
"src/trx-protocol",
|
||||||
"src/trx-app",
|
"src/trx-app",
|
||||||
|
"src/trx-reporting",
|
||||||
"src/trx-server",
|
"src/trx-server",
|
||||||
"src/trx-server/trx-backend",
|
"src/trx-server/trx-backend",
|
||||||
"src/trx-server/trx-backend/trx-backend-ft817",
|
"src/trx-server/trx-backend/trx-backend-ft817",
|
||||||
|
|||||||
@@ -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 trx_core::decode::{AprsPacket, DecodedMessage};
|
||||||
|
|
||||||
use crate::config::AprsFiConfig;
|
use crate::AprsFiConfig;
|
||||||
|
|
||||||
/// Compute the APRS-IS passcode for a callsign.
|
/// 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::decode::DecodedMessage;
|
||||||
use trx_core::rig::state::RigState;
|
use trx_core::rig::state::RigState;
|
||||||
|
|
||||||
use crate::config::PskReporterConfig;
|
use crate::PskReporterConfig;
|
||||||
|
|
||||||
const PSK_REPORTER_IDENTIFIER: u16 = 0x000A;
|
const PSK_REPORTER_IDENTIFIER: u16 = 0x000A;
|
||||||
const RECEIVER_FLOWSET: u16 = 0x9992;
|
const RECEIVER_FLOWSET: u16 = 0x9992;
|
||||||
@@ -39,4 +39,5 @@ trx-cw = { path = "../decoders/trx-cw" }
|
|||||||
trx-decode-log = { path = "../decoders/trx-decode-log" }
|
trx-decode-log = { path = "../decoders/trx-decode-log" }
|
||||||
trx-ft8 = { path = "../decoders/trx-ft8" }
|
trx-ft8 = { path = "../decoders/trx-ft8" }
|
||||||
trx-wspr = { path = "../decoders/trx-wspr" }
|
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.
|
pub use trx_reporting::{AprsFiConfig, PskReporterConfig};
|
||||||
#[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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Top-level SDR configuration (only used when [rig.access] type = "sdr").
|
/// Top-level SDR configuration (only used when [rig.access] type = "sdr").
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|||||||
@@ -2,13 +2,11 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
// SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
|
||||||
mod aprsfi;
|
|
||||||
mod audio;
|
mod audio;
|
||||||
mod config;
|
mod config;
|
||||||
mod error;
|
mod error;
|
||||||
mod history_store;
|
mod history_store;
|
||||||
mod listener;
|
mod listener;
|
||||||
mod pskreporter;
|
|
||||||
mod rig_handle;
|
mod rig_handle;
|
||||||
mod rig_task;
|
mod rig_task;
|
||||||
|
|
||||||
@@ -489,7 +487,7 @@ fn spawn_rig_audio_stack(
|
|||||||
let pr_shutdown_rx = shutdown_rx.clone();
|
let pr_shutdown_rx = shutdown_rx.clone();
|
||||||
handles.push(tokio::spawn(async move {
|
handles.push(tokio::spawn(async move {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = pskreporter::run_pskreporter_uplink(
|
_ = trx_reporting::pskreporter::run_pskreporter_uplink(
|
||||||
pr_cfg,
|
pr_cfg,
|
||||||
cs,
|
cs,
|
||||||
latitude,
|
latitude,
|
||||||
@@ -516,7 +514,7 @@ fn spawn_rig_audio_stack(
|
|||||||
let ai_shutdown_rx = shutdown_rx.clone();
|
let ai_shutdown_rx = shutdown_rx.clone();
|
||||||
handles.push(tokio::spawn(async move {
|
handles.push(tokio::spawn(async move {
|
||||||
tokio::select! {
|
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) => {}
|
_ = wait_for_shutdown(ai_shutdown_rx) => {}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user