format specs, thinking of format specs, uh other things,

This commit is contained in:
TerraMaster85 2024-12-14 17:42:55 -05:00
parent cf99912ffe
commit e6455ce36f
6 changed files with 43 additions and 15 deletions

View file

@ -7,7 +7,7 @@ use log::{error, info, trace, warn};
use tokio::sync::mpsc::Sender; use tokio::sync::mpsc::Sender;
use crate::msg::PcmFrameMessage; use crate::task_msg::PcmFrameMessage;
pub fn audio_receiver_main( pub fn audio_receiver_main(
tx_for_demod: Sender<PcmFrameMessage>, tx_for_demod: Sender<PcmFrameMessage>,
@ -91,7 +91,7 @@ pub fn audio_receiver_main(
None, None,
)?, )?,
sample_format => { sample_format => {
Err(anyhow::Error::msg( Err(anyhow::Error::task_msg(
format!( format!(
"unsupported sample format '{}'", sample_format) "unsupported sample format '{}'", sample_format)
))? ))?

View file

@ -4,7 +4,7 @@ use log::{error, info, trace, warn};
use tokio::sync::mpsc::{Receiver, UnboundedSender}; use tokio::sync::mpsc::{Receiver, UnboundedSender};
use crate::msg::{RawIpDataMessage, PcmFrameMessage}; use crate::task_msg::{RawIpDataMessage, PcmFrameMessage};
pub async fn dsp_inb_main( pub async fn dsp_inb_main(
tx_for_ip_inb: UnboundedSender<RawIpDataMessage>, tx_for_ip_inb: UnboundedSender<RawIpDataMessage>,

View file

@ -14,8 +14,8 @@ use tokio::sync::mpsc::{channel, unbounded_channel};
//use ringbuf:: //use ringbuf::
mod msg; mod task_msg;
use crate::msg::{PcmFrameMessage, RawIpDataMessage}; use crate::task_msg::{PcmFrameMessage, RawIpDataMessage};
mod audio_receiver; mod audio_receiver;
use crate::audio_receiver::audio_receiver_main; use crate::audio_receiver::audio_receiver_main;

12
src/wire-fmt/cap.rs Normal file
View file

@ -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,
}

View file

@ -1,11 +1,5 @@
pub enum SpecialCapability { mod cap;
pub Telephone = 1, pub use cap::*;
pub Typewriter = 2,
pub IpDce = 3,
pub EthernetDce = 4,
}
pub struct ChannelCapabilities { mod msg;
pub channels: usize pub use msg::*;
pub sample_rate: (u64, Option<u64>),
}

22
src/wire-fmt/wire_msg.rs Normal file
View file

@ -0,0 +1,22 @@
pub struct WireDataBytes {
data: Vec<u8>,
}
pub enum WireDataFrame {
pub Hello {
sender:
},
pub Complaint,
pub Data,
pub ModeChange,
}
impl From<WireDataFrame> for WireDataBytes {
fn from(value: WireDataFrame) -> Self {
let mut buf = Vec::new::<u8>();
buf.append(&mut vec![0xAA, 0xAA]); // Alternating high-low prelude
match value {
// TODO
}
}
}