1use anyhow::Result;
6use remote_xy::remote_xy;
7use remote_xy::RemoteXY;
8use serde::Deserialize;
9use serde::Serialize;
10use std::time::Duration;
11
12const CONF_BUF: &[u8] = &[
13 255, 2, 0, 2, 0, 59, 0, 16, 31, 1, 4, 0, 44, 10, 10, 78, 2, 26, 2, 0, 9, 77, 22, 11, 2, 26, 31,
14 31, 79, 78, 0, 79, 70, 70, 0, 72, 12, 9, 16, 23, 23, 2, 26, 140, 38, 0, 0, 0, 0, 0, 0, 200, 66,
15 0, 0, 0, 0, 70, 16, 16, 63, 9, 9, 26, 37, 0,
16];
17
18#[derive(Serialize, Deserialize, Debug, Default)]
19#[repr(C)]
20struct InputData {
21 slider_1: i8, switch_1: u8, }
25
26#[derive(Serialize, Deserialize, Debug, Default)]
27#[repr(C)]
28struct OutputData {
29 circularbar_1: i8, led_1: u8, }
34
35#[tokio::main]
36async fn main() -> Result<()> {
37 let remotexy = remote_xy!(InputData, OutputData, "[::]:6377", CONF_BUF).await?;
38 let mut output = OutputData::default();
39
40 loop {
41 let input = remotexy.get_input();
42 println!("Received input: {:?}", input);
43
44 output.circularbar_1 = input.slider_1;
45 output.led_1 = input.switch_1;
46 remotexy.set_output(&output);
47
48 tokio::time::sleep(Duration::from_millis(200)).await;
49 }
50}