Skip to content

Commit 81b203d

Browse files
committed
Add missing file
1 parent 3ac844d commit 81b203d

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

viz-udp-app-lib/src/blink.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
use crate::common::{
2+
MAX_F32_SAMPLES_TO_SEND, PROGRAM_NAME, VizUdpClient, VizUdpServer,
3+
};
4+
use std::{
5+
net::{SocketAddr, ToSocketAddrs},
6+
process::{Child, Command},
7+
};
8+
9+
pub struct Config {
10+
pub width: u32,
11+
pub height: u32,
12+
pub red: u8,
13+
pub green: u8,
14+
pub blue: u8,
15+
}
16+
17+
impl Default for Config {
18+
fn default() -> Self {
19+
Self {
20+
width: 100,
21+
height: 100,
22+
red: 0,
23+
green: 255,
24+
blue: 0,
25+
}
26+
}
27+
}
28+
29+
fn start_client_app(
30+
server_addr: SocketAddr,
31+
program_name: &str,
32+
title: &str,
33+
config: &Config,
34+
) -> anyhow::Result<Child> {
35+
let mut command = Command::new(program_name);
36+
command.args([
37+
format!("--server={}", server_addr.to_string()),
38+
format!("--title={}", title.to_string()),
39+
"oscilloscope".to_string(),
40+
format!("--width={}", config.width),
41+
format!("--height={}", config.height),
42+
format!("--red={}", config.red),
43+
format!("--green={}", config.green),
44+
format!("--blue={}", config.blue),
45+
]);
46+
Ok(command.spawn()?)
47+
}

0 commit comments

Comments
 (0)