pub struct Cspcl { /* private fields */ }Expand description
Safe wrapper for CSPCL instance
Implementations§
Source§impl Cspcl
impl Cspcl
Sourcepub fn send_bundle(&mut self, bundle: &[u8], dest_addr: u8) -> Result<()>
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 senddest_addr- Destination CSP address
§Returns
Ok(()) on success, or Err(Error) if the operation failed
Sourcepub fn recv_bundle(&mut self, timeout_ms: u32) -> Result<(Vec<u8>, u8)>
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
impl Cspcl
Sourcepub fn new(local_addr: u8) -> Result<Self>
pub fn new(local_addr: u8) -> Result<Self>
Initialize a new CSPCL instance with local CSP address
Sourcepub fn open_rx_socket(&mut self) -> Result<()>
pub fn open_rx_socket(&mut self) -> Result<()>
Open receive socket for listening to incoming bundles
Sourcepub fn close_rx_socket(&mut self)
pub fn close_rx_socket(&mut self)
Close the receive socket
Sourcepub fn local_addr(&self) -> u8
pub fn local_addr(&self) -> u8
Get local CSP address
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if initialized
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cspcl
impl RefUnwindSafe for Cspcl
impl Unpin for Cspcl
impl UnsafeUnpin for Cspcl
impl UnwindSafe for Cspcl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more