[refactor](trx-server): use state data constructors for pub(crate) fields
Migrate ready_data_from_state and transmitting_data_from_state to use the new ReadyStateData::new() and TransmittingStateData::new() constructors instead of direct struct field initialization. https://claude.ai/code/session_01XzurkeuUmamBuhQwxVy7T4 Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1033,29 +1033,29 @@ fn desired_machine_state(state: &RigState) -> RigMachineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn ready_data_from_state(state: &RigState, rig_info: trx_core::rig::RigInfo) -> ReadyStateData {
|
fn ready_data_from_state(state: &RigState, rig_info: trx_core::rig::RigInfo) -> ReadyStateData {
|
||||||
ReadyStateData {
|
ReadyStateData::new(
|
||||||
rig_info,
|
rig_info,
|
||||||
freq: state.status.freq,
|
state.status.freq,
|
||||||
mode: state.status.mode.clone(),
|
state.status.mode.clone(),
|
||||||
vfo: state.status.vfo.clone(),
|
state.status.vfo.clone(),
|
||||||
rx: state.status.rx.clone(),
|
state.status.rx.clone(),
|
||||||
tx_limit: state.status.tx.as_ref().and_then(|tx| tx.limit),
|
state.status.tx.as_ref().and_then(|tx| tx.limit),
|
||||||
locked: lock_state_from(state),
|
lock_state_from(state),
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transmitting_data_from_state(
|
fn transmitting_data_from_state(
|
||||||
state: &RigState,
|
state: &RigState,
|
||||||
rig_info: trx_core::rig::RigInfo,
|
rig_info: trx_core::rig::RigInfo,
|
||||||
) -> TransmittingStateData {
|
) -> TransmittingStateData {
|
||||||
TransmittingStateData {
|
TransmittingStateData::new(
|
||||||
rig_info,
|
rig_info,
|
||||||
freq: state.status.freq,
|
state.status.freq,
|
||||||
mode: state.status.mode.clone(),
|
state.status.mode.clone(),
|
||||||
vfo: state.status.vfo.clone(),
|
state.status.vfo.clone(),
|
||||||
tx: state.status.tx.clone(),
|
state.status.tx.clone(),
|
||||||
locked: lock_state_from(state),
|
lock_state_from(state),
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lock_state_from(state: &RigState) -> bool {
|
fn lock_state_from(state: &RigState) -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user