diff --git a/src/transport/serial.rs b/src/transport/serial.rs index 733e52f..e007667 100644 --- a/src/transport/serial.rs +++ b/src/transport/serial.rs @@ -45,7 +45,7 @@ impl PacketTransportSerialCobs { /// Send a packet. /// /// It encodes the packet using COBS encoding before sending it over the serial port. - fn send(&mut self, packet: &[u8]) -> Result<(), super::SendError> { + pub fn send(&mut self, packet: &[u8]) -> Result<(), super::SendError> { let encoded = cobs::encode_vec_including_sentinels(packet); log::debug!("sending COBS encoded packet: {:?}", encoded); self.serial.write_all(&encoded)?; @@ -57,7 +57,7 @@ impl PacketTransportSerialCobs { /// This function pulls bytes from the serial port and feeds them into the COBS decoder. /// For each received packet, the closure will be called with the decoded packet as an argument. /// The function will return the number of received packets. - fn receive(&mut self, mut f: F) -> Result { + pub fn receive(&mut self, mut f: F) -> Result { let mut decoded_packets = 0; loop { let read_bytes = self.serial.read(&mut self.reception_buffer)?;