diff --git a/src/audio_receiver/mod.rs b/src/audio_receiver/mod.rs index 1deaf8a..f76c9d2 100644 --- a/src/audio_receiver/mod.rs +++ b/src/audio_receiver/mod.rs @@ -7,7 +7,7 @@ use log::{error, info, trace, warn}; use tokio::sync::mpsc::Sender; -use crate::msg::PcmFrameMessage; +use crate::task_msg::PcmFrameMessage; pub fn audio_receiver_main( tx_for_demod: Sender, @@ -91,7 +91,7 @@ pub fn audio_receiver_main( None, )?, sample_format => { - Err(anyhow::Error::msg( + Err(anyhow::Error::task_msg( format!( "unsupported sample format '{}'", sample_format) ))? diff --git a/src/dsp_inb/mod.rs b/src/dsp_inb/mod.rs index 6df8450..9d93302 100644 --- a/src/dsp_inb/mod.rs +++ b/src/dsp_inb/mod.rs @@ -4,7 +4,7 @@ use log::{error, info, trace, warn}; use tokio::sync::mpsc::{Receiver, UnboundedSender}; -use crate::msg::{RawIpDataMessage, PcmFrameMessage}; +use crate::task_msg::{RawIpDataMessage, PcmFrameMessage}; pub async fn dsp_inb_main( tx_for_ip_inb: UnboundedSender, diff --git a/src/main.rs b/src/main.rs index 93409a0..9f0711b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,8 +14,8 @@ use tokio::sync::mpsc::{channel, unbounded_channel}; //use ringbuf:: -mod msg; -use crate::msg::{PcmFrameMessage, RawIpDataMessage}; +mod task_msg; +use crate::task_msg::{PcmFrameMessage, RawIpDataMessage}; mod audio_receiver; use crate::audio_receiver::audio_receiver_main; diff --git a/src/wire-fmt/cap.rs b/src/wire-fmt/cap.rs new file mode 100644 index 0000000..ca98b08 --- /dev/null +++ b/src/wire-fmt/cap.rs @@ -0,0 +1,12 @@ +pub enum Service { + pub Telephone = 1, + pub Typewriter = 2, + pub IpDce = 3, + pub EthernetDce = 4, +} + +pub struct ChannelCapabilities { + pub sample_rate: u64, +} + + diff --git a/src/wire-fmt/mod.rs b/src/wire-fmt/mod.rs index 1c45c55..a96e936 100644 --- a/src/wire-fmt/mod.rs +++ b/src/wire-fmt/mod.rs @@ -1,11 +1,5 @@ -pub enum SpecialCapability { - pub Telephone = 1, - pub Typewriter = 2, - pub IpDce = 3, - pub EthernetDce = 4, -} +mod cap; +pub use cap::*; -pub struct ChannelCapabilities { - pub channels: usize - pub sample_rate: (u64, Option), -} +mod msg; +pub use msg::*; diff --git a/src/wire-fmt/wire_msg.rs b/src/wire-fmt/wire_msg.rs new file mode 100644 index 0000000..ce4cb18 --- /dev/null +++ b/src/wire-fmt/wire_msg.rs @@ -0,0 +1,22 @@ +pub struct WireDataBytes { + data: Vec, +} + +pub enum WireDataFrame { + pub Hello { + sender: + }, + pub Complaint, + pub Data, + pub ModeChange, +} + +impl From for WireDataBytes { + fn from(value: WireDataFrame) -> Self { + let mut buf = Vec::new::(); + buf.append(&mut vec![0xAA, 0xAA]); // Alternating high-low prelude + match value { + // TODO + } + } +}