drop unimplemented streams and dependencies for build time

master v0.1.1
bel 2023-03-24 23:55:30 -06:00
parent 451a1c43a3
commit 14df9125ef
3 changed files with 3 additions and 340 deletions

260
Cargo.lock generated
View File

@ -18,15 +18,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046"
[[package]]
name = "addr2line"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
dependencies = [
"gimli",
]
[[package]]
name = "adler"
version = "1.0.2"
@ -221,21 +212,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
version = "0.3.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
dependencies = [
"addr2line",
"cc",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
]
[[package]]
name = "bit-set"
version = "0.5.3"
@ -803,28 +779,6 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "failure"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
dependencies = [
"backtrace",
"failure_derive",
]
[[package]]
name = "failure_derive"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"synstructure",
]
[[package]]
name = "fastrand"
version = "1.9.0"
@ -1068,45 +1022,6 @@ dependencies = [
"wasi",
]
[[package]]
name = "gilrs"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d0342acdc7b591d171212e17c9350ca02383b86d5f9af33c6e3598e03a6c57e"
dependencies = [
"fnv",
"gilrs-core",
"log",
"uuid",
"vec_map",
]
[[package]]
name = "gilrs-core"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6789d356476c3280a4e15365d23f62b4b4f1bcdac81fdd552f65807bce4666dd"
dependencies = [
"core-foundation",
"io-kit-sys",
"js-sys",
"libc",
"libudev-sys",
"log",
"nix 0.25.1",
"uuid",
"vec_map",
"wasm-bindgen",
"web-sys",
"windows",
]
[[package]]
name = "gimli"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
[[package]]
name = "glam"
version = "0.21.3"
@ -1268,19 +1183,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
[[package]]
name = "hidapi"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25440089a47b7c63b7a3515d1cdfcd0ac3d649fdc360540944e05c4e7899b4fe"
dependencies = [
"cc",
"failure",
"failure_derive",
"libc",
"pkg-config",
]
[[package]]
name = "iced"
version = "0.8.0"
@ -1427,16 +1329,6 @@ dependencies = [
"web-sys",
]
[[package]]
name = "io-kit-sys"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7789f7f3c9686f96164f5109d69152de759e76e284f736bd57661c6df5091919"
dependencies = [
"core-foundation-sys",
"mach",
]
[[package]]
name = "io-lifetimes"
version = "1.0.9"
@ -1511,40 +1403,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "libudev-sys"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324"
dependencies = [
"libc",
"pkg-config",
]
[[package]]
name = "libusb1-sys"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9d0e2afce4245f2c9a418511e5af8718bcaf2fa408aefb259504d1a9cb25f27"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "libz-sys"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
@ -1577,15 +1435,6 @@ dependencies = [
"value-bag",
]
[[package]]
name = "mach"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
dependencies = [
"libc",
]
[[package]]
name = "malloc_buf"
version = "0.0.6"
@ -1874,15 +1723,6 @@ dependencies = [
"objc",
]
[[package]]
name = "object"
version = "0.30.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.17.1"
@ -2246,36 +2086,6 @@ dependencies = [
"num_cpus",
]
[[package]]
name = "rdkafka"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd7c5d6d17442bcb9f943aae96d67d98c6d36af60442dd5da62aaa7fcbb25c48"
dependencies = [
"futures-channel",
"futures-util",
"libc",
"log",
"rdkafka-sys",
"serde",
"serde_derive",
"serde_json",
"slab",
"tokio",
]
[[package]]
name = "rdkafka-sys"
version = "4.3.0+1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d222a401698c7f2010e3967353eae566d9934dcda49c29910da922414ab4e3f4"
dependencies = [
"libc",
"libz-sys",
"num_enum",
"pkg-config",
]
[[package]]
name = "redox_syscall"
version = "0.2.16"
@ -2291,22 +2101,6 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
[[package]]
name = "rusb"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "703aa035c21c589b34fb5136b12e68fc8dcf7ea46486861381361dd8ebf5cee0"
dependencies = [
"libc",
"libusb1-sys",
]
[[package]]
name = "rustc-demangle"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "rustc-hash"
version = "1.1.0"
@ -2331,14 +2125,10 @@ dependencies = [
name = "rusty-pipe"
version = "0.1.0"
dependencies = [
"gilrs",
"handlebars",
"hidapi",
"iced",
"iced_futures",
"iced_native",
"rdkafka",
"rusb",
"serde",
"serde_json",
"serde_yaml",
@ -2603,18 +2393,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"unicode-xid",
]
[[package]]
name = "termcolor"
version = "1.2.0"
@ -2669,17 +2447,6 @@ dependencies = [
"bytemuck",
]
[[package]]
name = "tokio"
version = "1.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
dependencies = [
"autocfg",
"pin-project-lite",
"windows-sys 0.45.0",
]
[[package]]
name = "toml"
version = "0.5.11"
@ -2765,12 +2532,6 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c"
[[package]]
name = "uuid"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79"
[[package]]
name = "value-bag"
version = "1.0.0-alpha.9"
@ -2781,12 +2542,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vec_map"
version = "0.8.2"
@ -3135,21 +2890,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "windows"
version = "0.43.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.36.1"

View File

@ -9,10 +9,6 @@ edition = "2021"
serde = { version = "1.0.156", features = ["derive"] }
serde_yaml = "0.9.19"
serde_json = "1"
rdkafka = "0.29.0"
rusb = "0.9.1"
hidapi = "0.5.0"
gilrs = "0.10.1"
iced = "0.8.0"
iced_native = "0.9.1"
handlebars = "4"

View File

@ -1,8 +1,5 @@
use crate::config::Stream;
use hidapi::HidApi;
use rusb::UsbContext;
use gilrs::{Gilrs, Button, Event};
use serde_json::json;
use handlebars::Handlebars;
use std::time::{SystemTime, UNIX_EPOCH};
@ -20,7 +17,6 @@ pub fn build_input_stream(cfg: &Stream) -> Box<dyn InputStream> {
return Box::new(build_input_stream_kafka(&cfg).unwrap());
},
"udp" => return Box::new(build_input_stream_udp(&cfg).unwrap()),
"device" => return Box::new(build_input_stream_device(&cfg).unwrap()),
_ => {},
};
assert!(false);
@ -30,78 +26,9 @@ pub fn build_input_stream(cfg: &Stream) -> Box<dyn InputStream> {
pub struct InputStreamDevice {
}
pub fn build_input_stream_device(cfg: &Stream) -> Result<InputStreamDevice, String> {
return build_input_stream_device_gilrs(cfg)
}
pub fn build_input_stream_device_gilrs(cfg: &Stream) -> Result<InputStreamDevice, String> {
let _device_cfg = cfg.engine.device.as_ref().unwrap();
let mut gilrs = Gilrs::new().unwrap();
eprintln!("printing gamepads");
for (_id, gamepad) in gilrs.gamepads() {
eprintln!("{} is {:?}", gamepad.name(), gamepad.power_info());
}
eprintln!("printing gamepads events");
loop {
// eprintln!("reading gamepads events");
// Examine new events
while let Some(Event { id, event, time }) = gilrs.next_event() {
eprintln!("{:?} New event from {}: {:?}", time, id, event);
let active_gamepad = Some(id);
eprintln!("inspecting event");
// You can also use cached gamepad state
if let Some(gamepad) = active_gamepad.map(|id| gilrs.gamepad(id)) {
if gamepad.is_pressed(Button::South) {
eprintln!("Button South is pressed (XBox - A, PS - X)");
}
}
break;
}
std::thread::sleep(std::time::Duration::from_millis(15));
break;
}
return Err("do what".to_string());
}
pub fn build_input_stream_device_hidapi(cfg: &Stream) -> Result<InputStreamDevice, String> {
let _device_cfg = cfg.engine.device.as_ref().unwrap();
match HidApi::new() {
Ok(api) => {
for device in api.devices() {
eprintln!("{:#?}", device);
}
},
Err(e) => {
eprintln!("Error: {}", e);
},
};
return Err("do what".to_string());
}
pub fn build_input_stream_device_rusb(cfg: &Stream) -> Result<InputStreamDevice, String> {
let _device_cfg = cfg.engine.device.as_ref().unwrap();
assert!(rusb::has_capability());
let ctx = rusb::Context::new().unwrap();
assert!(ctx.devices().unwrap().len() > 0);
for device in ctx.devices().unwrap().iter() {
let device_desc = device.device_descriptor().unwrap();
eprintln!("Bus {:03} Device {:03} ID {:04x}:{:04x}",
device.bus_number(),
device.address(),
device_desc.vendor_id(),
device_desc.product_id());
}
return Err("do what".to_string());
}
//pub fn build_input_stream_device_gilrs(cfg: &Stream) -> Result<InputStreamDevice, String> {
//pub fn build_input_stream_device_hidapi(cfg: &Stream) -> Result<InputStreamDevice, String> {
//pub fn build_input_stream_device_rusb(cfg: &Stream) -> Result<InputStreamDevice, String> {
impl InputStream for InputStreamDevice {
fn get(&mut self) -> Vec<char> {