Radio Control

class kv4p.Kv4pRadio(transport)[source]

Bases: object

KV4P-HT radio side of the bridge.

Parameters:

transport (Kv4pTransport)

__init__(transport)[source]
Parameters:

transport (Kv4pTransport)

Return type:

None

connect(hello_timeout=5.0)[source]

Open the transport, reset the radio, and wait for HELLO.

Parameters:

hello_timeout (float)

Return type:

None

disconnect()[source]

Close radio transport.

Return type:

None

reset(hello_timeout=5.0)[source]

Hardware-reset the radio and wait for it to re-announce itself via HELLO.

Public so callers can recover a radio that has hung, not just at connect().

Parameters:

hello_timeout (float)

Return type:

None

set_frequency(freq, txfreq=None)[source]

Update the radio’s frequency, validated against the range reported in HELLO.

freq sets both RX and TX (simplex). Pass txfreq too for split/repeater operation, where TX differs from RX.

Parameters:
  • freq (float)

  • txfreq (float | None)

Return type:

None

set_bandwidth(bandwidth)[source]

Update bandwidth (“12.5k” or “25k”).

Parameters:

bandwidth (str)

Return type:

None

set_squelch(squelch)[source]

Update squelch level.

Parameters:

squelch (int)

Return type:

None

set_ctcss(*, rx=None, tx=None)[source]

Update RX/TX CTCSS tone.

Parameters:
  • rx (int | None)

  • tx (int | None)

Return type:

None

set_high_power(enabled)[source]

Enable/disable high power output.

Parameters:

enabled (bool)

Return type:

None

set_tx_allowed(enabled)[source]

Enable/disable TX capability.

Parameters:

enabled (bool)

Return type:

None

set_rssi(enabled)[source]

Enable/disable RSSI reporting.

Parameters:

enabled (bool)

Return type:

None

set_rx_audio_open(enabled)[source]

Enable/disable receiving RX audio from the firmware.

Parameters:

enabled (bool)

Return type:

None

set_status_reports(enabled)[source]

Enable/disable periodic DEVICE_STATE reports from the firmware.

Parameters:

enabled (bool)

Return type:

None

set_filters(*, pre=None, high=None, low=None)[source]

Enable/disable the pre-emphasis/high-pass/low-pass audio filters.

Parameters:
  • pre (bool | None)

  • high (bool | None)

  • low (bool | None)

Return type:

None

set_ptt(enabled)[source]

Set PTT requested state.

Parameters:

enabled (bool)

Return type:

None

send_tx_audio(payload)[source]

Send KV4P-native TX audio payload.

Parameters:

payload (bytes)

Return type:

None

send_ax25_frame(payload)[source]

Send a raw AX.25 frame over the KISS data port.

Parameters:

payload (bytes)

Return type:

None

flush()[source]

Flush pending serial writes.

Return type:

None

on_rx_audio(callback)[source]

Register callback for incoming audio frames.

Parameters:

callback (Callable[[bytes], None] | None)

Return type:

None

on_sql(callback)[source]

Register callback for squelch open/close events.

Parameters:

callback (Callable[[bool], None] | None)

Return type:

None

on_phy_ptt(callback)[source]

Register callback for physical PTT down/up events.

Parameters:

callback (Callable[[bool], None] | None)

Return type:

None

on_tx_active(callback)[source]

Register callback for TX active start/stop events.

Parameters:

callback (Callable[[bool], None] | None)

Return type:

None

on_ax25_frame(callback)[source]

Register callback for incoming AX.25 frames.

Parameters:

callback (Callable[[bytes], None] | None)

Return type:

None

on_device_state(callback)[source]

Register callback for device state updates.

Parameters:

callback (Callable[[DeviceState], None] | None)

Return type:

None

property hello: Hello | None
property is_ready: bool
property phy_ptt: bool
property tx_active: bool
property sql_open: bool
property mode: RadioMode | None
property codec: int

COMMAND_AUDIO_OPUS or COMMAND_AUDIO_ADPCM.

Type:

Audio codec command in use

property freq_rx: float
property freq_tx: float
property bandwidth: str
property squelch: int
property ctcss_rx: int
property ctcss_tx: int
property high_power: bool
property tx_allowed: bool
property rssi: bool
property rx_audio_open: bool
property status_reports: bool
property filter_pre: bool
property filter_high: bool
property filter_low: bool