Skip to main content

Protocol1Client

Struct Protocol1Client 

Source
pub struct Protocol1Client { /* private fields */ }
Expand description

Protocol 1 client for connecting to HPSDR hardware.

Implementations§

Source§

impl Protocol1Client

Source

pub async fn discover(timeout: Duration) -> Result<Vec<DiscoveredDevice>>

Discover all HPSDR devices on the network using Protocol 1.

Source

pub async fn discover_at( addr: Ipv4Addr, timeout: Duration, ) -> Result<Vec<DiscoveredDevice>>

Send a discovery request to a specific address (unicast).

Source

pub async fn connect(device: &DiscoveredDevice) -> Result<Self>

Connect to a discovered Protocol 1 device.

Source

pub async fn start(&mut self) -> Result<()>

Start streaming IQ data from the radio.

Source

pub async fn stop(&mut self) -> Result<()>

Stop streaming.

Source

pub fn set_rx_frequency(&mut self, ddc: usize, freq_hz: u32)

Source

pub fn set_tx_frequency(&mut self, freq_hz: u32)

Source

pub fn set_sample_rate(&mut self, rate: u32)

Source

pub fn set_nddc(&mut self, count: u8)

Source

pub fn tx_drive(&self) -> u8

Source

pub fn set_tx_drive(&mut self, drive: u8)

Source

pub fn set_ptt(&mut self, on: bool)

Source

pub fn set_rx_attenuation(&mut self, db: u8)

Source

pub fn command_sender(&self) -> Sender<P1Command>

Get a sender for runtime commands. The run() loop polls this channel.

Source

pub fn rx_iq_stream(&mut self, ddc: usize) -> Receiver<Vec<Complex<f64>>>

Get a receiver for IQ data from a specific DDC.

Source

pub fn tx_iq_sink(&mut self) -> HeapProd<Complex<f64>>

Get a producer for TX IQ data (lock-free ring buffer, zero-copy).

Source

pub fn status_stream(&mut self) -> Option<Receiver<RadioStatus>>

Get a receiver for radio status updates.

Returns None if already taken (can only be called once).

Source

pub async fn run(&mut self) -> Result<()>

Run the main receive/transmit loop. This blocks until stop() is called or the connection is lost.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.