Initial Commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "atem-test"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
atem-connection-rs = { path = "../atem-connection-rs" }
|
||||
color-eyre = "0.5.11"
|
||||
env_logger = "0.9.0"
|
||||
tokio = "1.14.0"
|
||||
@@ -0,0 +1,44 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use atem_connection_rs::atem_lib::atem_socket::AtemSocket;
|
||||
|
||||
use color_eyre::Report;
|
||||
use tokio::time::sleep;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
setup_logging().unwrap();
|
||||
|
||||
let switch_raw_name: &str = "CPgI";
|
||||
let switch_source_to_1: [u8; 4] = [0, 0, 0, 1];
|
||||
let switch_source_to_2: [u8; 4] = [0, 0, 0, 2];
|
||||
|
||||
let mut atem = AtemSocket::new();
|
||||
atem.connect("127.0.0.1".to_string(), 9910).await.ok();
|
||||
|
||||
let mut tracking_id = 0;
|
||||
loop {
|
||||
sleep(Duration::from_millis(5000)).await;
|
||||
atem.send_command(&switch_source_to_1, switch_raw_name, tracking_id)
|
||||
.await;
|
||||
tracking_id += 1;
|
||||
sleep(Duration::from_millis(5000)).await;
|
||||
atem.send_command(&switch_source_to_2, switch_raw_name, tracking_id)
|
||||
.await;
|
||||
tracking_id += 1;
|
||||
}
|
||||
}
|
||||
|
||||
fn setup_logging() -> Result<(), Report> {
|
||||
if std::env::var("RUST_LIB_BACKTRACE").is_err() {
|
||||
std::env::set_var("RUST_LIB_BACKTRACE", "1");
|
||||
}
|
||||
color_eyre::install()?;
|
||||
|
||||
if std::env::var("RUST_LOG").is_err() {
|
||||
std::env::set_var("RUST_LOG", "debug");
|
||||
}
|
||||
env_logger::init();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user