Synchronous API¶
Blocking wrapper around the async IcomRadio for use without async/await.
icom_lan.sync.IcomRadio
¶
Synchronous (blocking) wrapper for Icom radio LAN control.
Wraps the async :class:~icom_lan.radio.IcomRadio with a dedicated
event loop. All methods block until the operation completes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
Radio IP address or hostname. |
required |
port
|
int
|
Control port (default 50001). |
50001
|
username
|
str
|
Authentication username. |
''
|
password
|
str
|
Authentication password. |
''
|
radio_addr
|
int
|
CI-V address of the radio (default IC-7610 = 0x98). |
152
|
timeout
|
float
|
Operation timeout in seconds. |
5.0
|
audio_codec
|
AudioCodec | int
|
Audio codec (default: stereo PCM 2ch 16-bit on dual-RX
radios, auto-negotiated down to mono on single-RX firmware — see
|
_DEFAULT_AUDIO_CODEC
|
audio_sample_rate
|
int
|
Audio sample rate in Hz. |
48000
|
audio_codec
property
¶
Configured audio codec.
audio_sample_rate
property
¶
Configured audio sample rate.
connected
property
¶
Whether the radio is currently connected.
audio_capabilities()
staticmethod
¶
Return icom-lan audio capabilities and deterministic defaults.
connect()
¶
Connect to the radio (blocking).
disconnect()
¶
Disconnect from the radio (blocking).
enable_scope(*, output=True, policy='verify', timeout=5.0)
¶
Enable scope display and optional wave data output.
get_alc()
¶
Read the ALC meter (0-255).
get_attenuator()
¶
Read attenuator state.
get_attenuator_level()
¶
Read attenuator level in dB.
get_audio_stats()
¶
Return runtime audio stats for the active stream.
get_data1_mod_input()
¶
Read the DATA1 modulation input source.
get_data_mode()
¶
Read whether DATA mode is enabled.
get_data_off_mod_input()
¶
Read the Data Off modulation input source.
get_digisel()
¶
Read DIGI-SEL status.
get_filter()
¶
Get current filter number (1-3) when available.
get_freq()
¶
Get the current operating frequency in Hz.
get_mode()
¶
Get current mode as (name, filter) — Protocol-compatible.
get_mode_info()
¶
Get current mode and filter number (if reported).
get_preamp()
¶
Read preamp level (0=off, 1=PREAMP1, 2=PREAMP2).
get_rf_power()
¶
Get the RF power level (0-255).
get_s_meter()
¶
Read the S-meter value (0-255).
get_swr()
¶
Read the SWR meter (0-255).
get_vox()
¶
Read VOX status.
power_control(on)
¶
Power on/off the radio.
prepare_ic705_data_profile(*, frequency_hz, mode='FM', data_off_mod_input=None, data1_mod_input=None, disable_vox=True, squelch_level=0, enable_scope=False, scope_output=False, scope_policy=ScopeCompletionPolicy.FAST, scope_timeout=5.0, scope_mode=0, scope_span=7)
¶
Prepare the radio for IC-705 data/packet workflows and return a snapshot.
push_audio_tx(opus_data)
¶
Deprecated alias for :meth:push_audio_tx_opus.
push_audio_tx_opus(opus_data)
¶
Send an Opus audio frame to the radio.
restore_ic705_data_profile(snapshot)
¶
Restore a snapshot from :meth:prepare_ic705_data_profile.
restore_state(state)
¶
Best-effort restore of snapshot_state().
send_cw_text(text)
¶
Send CW text.
set_attenuator(on)
¶
Enable or disable the attenuator.
set_attenuator_level(db)
¶
Set attenuator level in dB.
set_data1_mod_input(source)
¶
Set the DATA1 modulation input source.
set_data_mode(on, receiver=0)
¶
Set DATA mode for the selected receiver.
set_data_off_mod_input(source)
¶
Set the Data Off modulation input source.
set_digisel(on)
¶
Set DIGI-SEL status.
set_filter(filter_width)
¶
Set filter number (1-3) while keeping current mode.
set_freq(freq_hz)
¶
Set the operating frequency in Hz.
set_mode(mode, filter_width=None)
¶
Set the operating mode.
set_preamp(level=1)
¶
Set preamp level (0=off, 1=PREAMP1, 2=PREAMP2).
set_ptt(on)
¶
Enable or disable PTT.
set_rf_power(level)
¶
Set the RF power level (0-255).
set_scope_mode(mode)
¶
Set the scope mode.
set_scope_span(span)
¶
Set the scope span preset index.
set_split_mode(on)
¶
Enable or disable split mode.
set_squelch(level, receiver=0)
¶
Set squelch level (0-255, 0=open).
set_vfo(vfo='A')
¶
Select VFO (A, B, MAIN, SUB).
set_vox(on)
¶
Set VOX status.
snapshot_state()
¶
Best-effort snapshot of core rig state.
start_audio_rx(callback)
¶
Deprecated alias for :meth:start_audio_rx_opus.
start_audio_rx_opus(callback, *, jitter_depth=5)
¶
Start receiving Opus audio from the radio (blocking setup).
start_audio_tx()
¶
Deprecated alias for :meth:start_audio_tx_opus.
start_audio_tx_opus()
¶
Start Opus TX audio.
stop_audio_rx()
¶
Deprecated alias for :meth:stop_audio_rx_opus.
stop_audio_rx_opus()
¶
Stop Opus RX audio.
stop_audio_tx()
¶
Deprecated alias for :meth:stop_audio_tx_opus.
stop_audio_tx_opus()
¶
Stop Opus TX audio.
stop_cw_text()
¶
Stop CW sending.
vfo_equalize()
¶
Copy VFO A to VFO B.
vfo_exchange()
¶
Swap VFO A and B.
Usage¶
from icom_lan.sync import IcomRadio
with IcomRadio("192.168.1.100", username="u", password="p") as radio:
freq = radio.get_frequency()
print(f"Frequency: {freq:,} Hz")
radio.set_frequency(14_074_000)
radio.set_mode("USB")
print(f"S-meter: {radio.get_s_meter()}")
print(f"SWR: {radio.get_swr()}")
Common sync helpers¶
mode, filt = radio.get_mode_info()
radio.set_filter(2)
att_db = radio.get_attenuator_level() # dB (0–45)
att_on = radio.get_attenuator() # bool
pre = radio.get_preamp() # 0, 1, or 2
radio.set_attenuator_level(18) # 18 dB
radio.set_preamp(1) # PREAMP 1
state = radio.snapshot_state()
radio.restore_state(state)
When to use sync vs async
Use the sync API for simple scripts, CLI tools, and Jupyter notebooks. Use the async API for applications that need concurrent operations, real-time audio streaming, or integration with async frameworks.