feat: Program input command
This commit is contained in:
+21
-8
@@ -1,6 +1,12 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use atem_connection_rs::atem_lib::atem_socket::AtemSocket;
|
||||
use atem_connection_rs::{
|
||||
atem_lib::atem_socket::AtemSocket,
|
||||
commands::{
|
||||
command_base::{BasicWritableCommand, SerializableCommand},
|
||||
mix_effects::ProgramInput,
|
||||
},
|
||||
};
|
||||
|
||||
use color_eyre::Report;
|
||||
use tokio::time::sleep;
|
||||
@@ -9,9 +15,8 @@ use tokio::time::sleep;
|
||||
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 switch_to_source_1 = ProgramInput::new(0, 1);
|
||||
let switch_to_source_2 = ProgramInput::new(0, 2);
|
||||
|
||||
let mut atem = AtemSocket::new();
|
||||
atem.connect("127.0.0.1".to_string(), 9910).await.ok();
|
||||
@@ -19,12 +24,20 @@ async fn main() {
|
||||
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;
|
||||
atem.send_command(
|
||||
&switch_to_source_1.payload(atem_connection_rs::enums::ProtocolVersion::Unknown),
|
||||
switch_to_source_1.get_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;
|
||||
atem.send_command(
|
||||
&switch_to_source_2.payload(atem_connection_rs::enums::ProtocolVersion::Unknown),
|
||||
switch_to_source_2.get_raw_name(),
|
||||
tracking_id,
|
||||
)
|
||||
.await;
|
||||
tracking_id += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user