]>
code.octet-stream.net Git - m17rt/blob - m17app/src/soundmodem.rs
83731daa2cc3da73d4f664f4a0064c995a45ebff
1 use std
::io
::{self, ErrorKind
, Read
, Write
};
3 use crate::tnc
::{Tnc
, TncError
};
4 use m17core
::tnc
::SoftTnc
;
6 pub struct Soundmodem
{
8 config
: SoundmodemConfig
,
11 pub struct SoundmodemConfig
{
12 // sound cards, PTT, etc.
15 impl Read
for Soundmodem
{
16 fn read(&mut self, buf
: &mut [u8]) -> io
::Result
<usize> {
19 .map_err(|s
| io
::Error
::new(ErrorKind
::Other
, format
!("{:?}", s
)))
23 impl Write
for Soundmodem
{
24 fn write(&mut self, buf
: &[u8]) -> std
::io
::Result
<usize> {
27 .map_err(|s
| io
::Error
::new(ErrorKind
::Other
, format
!("{:?}", s
)))
30 fn flush(&mut self) -> std
::io
::Result
<()> {
35 impl Tnc
for Soundmodem
{
36 fn try_clone(&mut self) -> Result
<Self, TncError
> {
40 fn start(&mut self) -> Result
<(), TncError
> {
44 fn close(&mut self) -> Result
<(), TncError
> {