]> code.octet-stream.net Git - m17rt/blob - m17core/src/tnc.rs
Move transmit_packet method to TxHandle
[m17rt] / m17core / src / tnc.rs
1 use crate::protocol::Frame;
2
3 /// Handles the KISS protocol and frame management for `SoftModulator` and `SoftDemodulator`.
4 ///
5 /// These components work alongside each other. User is responsible for chaining them together
6 /// or doing something else with the data.
7 pub struct SoftTnc {}
8
9 impl SoftTnc {
10 /// Process an individual `Frame` that has been decoded by the modem.
11 pub fn handle_frame(&mut self, _frame: Frame) -> Result<(), SoftTncError> {
12 Ok(())
13 }
14
15 ///
16 pub fn advance_samples(&mut self, _samples: u64) {}
17
18 pub fn set_data_carrier_detect(&mut self, _dcd: bool) {}
19
20 pub fn read_tx_frame(&mut self) -> Result<Option<Frame>, SoftTncError> {
21 // yes we want to deal with Frames here
22 // it's important to establish successful decode that SoftDemodulator is aware of the frame innards
23 Ok(None)
24 }
25
26 pub fn read_kiss(&mut self, _buf: &mut [u8]) -> Result<usize, SoftTncError> {
27 Ok(0)
28 }
29
30 pub fn write_kiss(&mut self, _buf: &[u8]) -> Result<usize, SoftTncError> {
31 Ok(0)
32 }
33 }
34
35 #[derive(Debug)]
36 pub enum SoftTncError {
37 General(&'static str),
38 }