Skip to content

Commit

Permalink
Merge pull request #195 from ivmarkov/buffer-access
Browse files Browse the repository at this point in the history
External access to the RX and TX transport buffers
  • Loading branch information
kedars authored Jun 24, 2024
2 parents 1490b96 + 22b007a commit 157152e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions rs-matter/src/transport/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,22 @@ impl<'m> TransportMgr<'m> {
}
}

/// Return a reference to the transport RX buffer.
///
/// Useful when external code (like i.e. a user-provided mDNS implementation)
/// needs an RX buffer.
pub fn rx_buffer(&self) -> impl BufferAccess<[u8]> + '_ {
PacketBufferExternalAccess(&self.rx)
}

/// Return a reference to the transport TX buffer.
///
/// Useful when external code (like i.e. a user-provided mDNS implementation)
/// needs a TX buffer.
pub fn tx_buffer(&self) -> impl BufferAccess<[u8]> + '_ {
PacketBufferExternalAccess(&self.tx)
}

pub(crate) async fn get_if<'a, F, const N: usize>(
&'a self,
packet_mutex: &'a IfMutex<NoopRawMutex, Packet<N>>,
Expand Down

0 comments on commit 157152e

Please sign in to comment.