Add lowerlevel socket implementation

This commit is contained in:
2025-06-21 15:58:19 +01:00
parent 5fb847aec6
commit 8be762b0ef
9 changed files with 671 additions and 25 deletions
+1
View File
@@ -2,6 +2,7 @@
name = "atem-test"
version = "0.1.0"
edition = "2024"
default-run = "main"
[dependencies]
atem-connection-rs = { path = "../atem-connection-rs" }
+48
View File
@@ -0,0 +1,48 @@
use atem_connection_rs::atem_lib::{atem_field::PrgI, atem_socket_two::tokio::TokioBackend};
use clap::Parser;
use color_eyre::Report;
/// ATEM Rust Library Test App
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// IP of the ATEM to connect to
#[arg(short, long)]
ip: String,
}
#[tokio::main]
async fn main() {
let args = Args::parse();
setup_logging().unwrap();
let mut s = TokioBackend::new(args.ip.parse().unwrap()).await.unwrap();
s.connect().await.expect("aa");
let mut buf = [0u8; 2048];
loop {
let p = s.recv(&mut buf).await.unwrap();
let prg: Vec<PrgI> = p.fields::<PrgI>().collect::<Result<_, _>>().unwrap();
if !prg.is_empty() {
println!("{:?}", prg);
}
}
}
fn setup_logging() -> Result<(), Report> {
if std::env::var("RUST_LIB_BACKTRACE").is_err() {
unsafe {
std::env::set_var("RUST_LIB_BACKTRACE", "1");
}
}
color_eyre::install()?;
if std::env::var("RUST_LOG").is_err() {
unsafe {
std::env::set_var("RUST_LOG", "debug");
}
}
env_logger::init();
Ok(())
}