[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:
@@ -437,6 +437,11 @@ mod tests {
|
||||
rit: false,
|
||||
rpt: false,
|
||||
split: false,
|
||||
tx: true,
|
||||
tx_limit: true,
|
||||
vfo_switch: true,
|
||||
filter_controls: false,
|
||||
signal_meter: true,
|
||||
},
|
||||
access: RigAccessMethod::Tcp {
|
||||
addr: "127.0.0.1:1234".to_string(),
|
||||
|
||||
@@ -142,6 +142,7 @@ pub async fn run_rig_task(
|
||||
// Initial setup: get rig info
|
||||
let rig_info = rig.info().clone();
|
||||
state.rig_info = Some(rig_info);
|
||||
state.filter = rig.filter_state();
|
||||
if let Some(info) = state.rig_info.as_ref() {
|
||||
info!(
|
||||
"Rig info: {} {} {}",
|
||||
@@ -425,6 +426,26 @@ async fn process_command(
|
||||
let _ = ctx.state_tx.send(ctx.state.clone());
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user