[feat](trx-server): dispatch SetBandwidth and SetFirTaps in rig_task

Handle SetBandwidth(hz) and SetFirTaps(taps) in process_command:
call the RigCat methods, update filter state in-place, broadcast
the updated state, and return the new snapshot.

Fix missing capability fields in listener.rs test helper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-02-25 20:25:00 +01:00
parent dc33d1e841
commit 3b98c8b7b5
2 changed files with 26 additions and 0 deletions
+5
View File
@@ -437,6 +437,11 @@ mod tests {
rit: false, rit: false,
rpt: false, rpt: false,
split: false, split: false,
tx: true,
tx_limit: true,
vfo_switch: true,
filter_controls: false,
signal_meter: true,
}, },
access: RigAccessMethod::Tcp { access: RigAccessMethod::Tcp {
addr: "127.0.0.1:1234".to_string(), addr: "127.0.0.1:1234".to_string(),
+21
View File
@@ -142,6 +142,7 @@ pub async fn run_rig_task(
// Initial setup: get rig info // Initial setup: get rig info
let rig_info = rig.info().clone(); let rig_info = rig.info().clone();
state.rig_info = Some(rig_info); state.rig_info = Some(rig_info);
state.filter = rig.filter_state();
if let Some(info) = state.rig_info.as_ref() { if let Some(info) = state.rig_info.as_ref() {
info!( info!(
"Rig info: {} {} {}", "Rig info: {} {} {}",
@@ -425,6 +426,26 @@ async fn process_command(
let _ = ctx.state_tx.send(ctx.state.clone()); let _ = ctx.state_tx.send(ctx.state.clone());
return snapshot_from(ctx.state); return snapshot_from(ctx.state);
} }
RigCommand::SetBandwidth(hz) => {
if let Err(e) = ctx.rig.set_bandwidth(hz).await {
return Err(RigError::communication(format!("set_bandwidth: {e}")));
}
if let Some(f) = ctx.state.filter.as_mut() {
f.bandwidth_hz = hz;
}
let _ = ctx.state_tx.send(ctx.state.clone());
return snapshot_from(ctx.state);
}
RigCommand::SetFirTaps(taps) => {
if let Err(e) = ctx.rig.set_fir_taps(taps).await {
return Err(RigError::communication(format!("set_fir_taps: {e}")));
}
if let Some(f) = ctx.state.filter.as_mut() {
f.fir_taps = taps;
}
let _ = ctx.state_tx.send(ctx.state.clone());
return snapshot_from(ctx.state);
}
_ => {} // fall through to normal rig handler _ => {} // fall through to normal rig handler
} }