Skip to main content

Cspcl

Struct Cspcl 

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

Safe wrapper for CSPCL instance

Implementations§

Source§

impl Cspcl

Source

pub fn send_bundle(&mut self, bundle: &[u8], dest_addr: u8) -> Result<()>

Send a bundle to a remote CSP address

This will automatically fragment the bundle if it exceeds CSP MTU and handle reassembly on the receiving end.

§Arguments
  • bundle - The serialized bundle data to send
  • dest_addr - Destination CSP address
§Returns

Ok(()) on success, or Err(Error) if the operation failed

Source

pub fn recv_bundle(&mut self, timeout_ms: u32) -> Result<(Vec<u8>, u8)>

Receive a bundle with optional timeout

This function blocks until a complete bundle is received or timeout occurs. Incomplete bundles are automatically reassembled.

§Arguments
  • timeout_ms - Timeout in milliseconds (0 = no timeout)
§Returns

Ok((bundle_data, source_address)) on success Err(Error) if the operation timed out or failed

Source§

impl Cspcl

Source

pub fn new(local_addr: u8) -> Result<Self>

Initialize a new CSPCL instance with local CSP address

Source

pub fn open_rx_socket(&mut self) -> Result<()>

Open receive socket for listening to incoming bundles

Source

pub fn close_rx_socket(&mut self)

Close the receive socket

Source

pub fn local_addr(&self) -> u8

Get local CSP address

Source

pub fn is_initialized(&self) -> bool

Check if initialized

Source

pub fn inner_mut(&mut self) -> &mut cspcl_t

Get mutable reference to inner CSPCL instance (for advanced usage)

Source

pub fn inner(&self) -> &cspcl_t

Get immutable reference to inner CSPCL instance (for advanced usage)

Trait Implementations§

Source§

impl Drop for Cspcl

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Cspcl

Source§

impl Sync for Cspcl

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.