Compare commits
No commits in common. "master" and "v0.0.0" have entirely different histories.
|
|
@ -18,6 +18,15 @@ version = "0.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046"
|
checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "addr2line"
|
||||||
|
version = "0.19.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
|
||||||
|
dependencies = [
|
||||||
|
"gimli",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler"
|
name = "adler"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
|
|
@ -213,10 +222,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "backtrace"
|
||||||
version = "0.21.0"
|
version = "0.3.67"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
|
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
|
||||||
|
dependencies = [
|
||||||
|
"addr2line",
|
||||||
|
"cc",
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"miniz_oxide",
|
||||||
|
"object",
|
||||||
|
"rustc-demangle",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bit-set"
|
name = "bit-set"
|
||||||
|
|
@ -300,12 +318,6 @@ version = "1.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bytes"
|
|
||||||
version = "1.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "calloop"
|
name = "calloop"
|
||||||
version = "0.10.5"
|
version = "0.10.5"
|
||||||
|
|
@ -735,15 +747,6 @@ dependencies = [
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding_rs"
|
|
||||||
version = "0.8.32"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
|
@ -800,6 +803,28 @@ dependencies = [
|
||||||
"pkg-config",
|
"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]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "1.9.0"
|
version = "1.9.0"
|
||||||
|
|
@ -876,15 +901,6 @@ version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "form_urlencoded"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
|
|
||||||
dependencies = [
|
|
||||||
"percent-encoding",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "freetype-rs"
|
name = "freetype-rs"
|
||||||
version = "0.26.0"
|
version = "0.26.0"
|
||||||
|
|
@ -1052,6 +1068,45 @@ dependencies = [
|
||||||
"wasi",
|
"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]]
|
[[package]]
|
||||||
name = "glam"
|
name = "glam"
|
||||||
version = "0.21.3"
|
version = "0.21.3"
|
||||||
|
|
@ -1169,25 +1224,6 @@ dependencies = [
|
||||||
"svg_fmt",
|
"svg_fmt",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "h2"
|
|
||||||
version = "0.3.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d"
|
|
||||||
dependencies = [
|
|
||||||
"bytes",
|
|
||||||
"fnv",
|
|
||||||
"futures-core",
|
|
||||||
"futures-sink",
|
|
||||||
"futures-util",
|
|
||||||
"http",
|
|
||||||
"indexmap",
|
|
||||||
"slab",
|
|
||||||
"tokio",
|
|
||||||
"tokio-util",
|
|
||||||
"tracing",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "handlebars"
|
name = "handlebars"
|
||||||
version = "4.3.6"
|
version = "4.3.6"
|
||||||
|
|
@ -1233,61 +1269,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "hidapi"
|
||||||
version = "0.2.9"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
|
checksum = "25440089a47b7c63b7a3515d1cdfcd0ac3d649fdc360540944e05c4e7899b4fe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"cc",
|
||||||
"fnv",
|
"failure",
|
||||||
"itoa",
|
"failure_derive",
|
||||||
]
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
[[package]]
|
|
||||||
name = "http-body"
|
|
||||||
version = "0.4.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
|
|
||||||
dependencies = [
|
|
||||||
"bytes",
|
|
||||||
"http",
|
|
||||||
"pin-project-lite",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "httparse"
|
|
||||||
version = "1.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "httpdate"
|
|
||||||
version = "1.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hyper"
|
|
||||||
version = "0.14.25"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899"
|
|
||||||
dependencies = [
|
|
||||||
"bytes",
|
|
||||||
"futures-channel",
|
|
||||||
"futures-core",
|
|
||||||
"futures-util",
|
|
||||||
"h2",
|
|
||||||
"http",
|
|
||||||
"http-body",
|
|
||||||
"httparse",
|
|
||||||
"httpdate",
|
|
||||||
"itoa",
|
|
||||||
"pin-project-lite",
|
|
||||||
"socket2",
|
|
||||||
"tokio",
|
|
||||||
"tower-service",
|
|
||||||
"tracing",
|
|
||||||
"want",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -1414,16 +1405,6 @@ version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "idna"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
|
|
||||||
dependencies = [
|
|
||||||
"unicode-bidi",
|
|
||||||
"unicode-normalization",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.9.2"
|
version = "1.9.2"
|
||||||
|
|
@ -1446,6 +1427,16 @@ dependencies = [
|
||||||
"web-sys",
|
"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]]
|
[[package]]
|
||||||
name = "io-lifetimes"
|
name = "io-lifetimes"
|
||||||
version = "1.0.9"
|
version = "1.0.9"
|
||||||
|
|
@ -1457,12 +1448,6 @@ dependencies = [
|
||||||
"windows-sys 0.45.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ipnet"
|
|
||||||
version = "2.7.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
|
|
@ -1526,6 +1511,40 @@ dependencies = [
|
||||||
"winapi",
|
"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]]
|
[[package]]
|
||||||
name = "linked-hash-map"
|
name = "linked-hash-map"
|
||||||
version = "0.5.6"
|
version = "0.5.6"
|
||||||
|
|
@ -1558,6 +1577,15 @@ dependencies = [
|
||||||
"value-bag",
|
"value-bag",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mach"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "malloc_buf"
|
name = "malloc_buf"
|
||||||
version = "0.0.6"
|
version = "0.0.6"
|
||||||
|
|
@ -1614,12 +1642,6 @@ dependencies = [
|
||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mime"
|
|
||||||
version = "0.3.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "minimal-lexical"
|
name = "minimal-lexical"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
|
@ -1852,6 +1874,15 @@ dependencies = [
|
||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "object"
|
||||||
|
version = "0.30.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.17.1"
|
version = "1.17.1"
|
||||||
|
|
@ -2215,6 +2246,36 @@ dependencies = [
|
||||||
"num_cpus",
|
"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]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.2.16"
|
version = "0.2.16"
|
||||||
|
|
@ -2231,39 +2292,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
|
checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "rusb"
|
||||||
version = "0.11.15"
|
version = "0.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ba30cc2c0cd02af1222ed216ba659cdb2f879dfe3181852fe7c50b1d0005949"
|
checksum = "703aa035c21c589b34fb5136b12e68fc8dcf7ea46486861381361dd8ebf5cee0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"libc",
|
||||||
"bytes",
|
"libusb1-sys",
|
||||||
"encoding_rs",
|
|
||||||
"futures-core",
|
|
||||||
"futures-util",
|
|
||||||
"h2",
|
|
||||||
"http",
|
|
||||||
"http-body",
|
|
||||||
"hyper",
|
|
||||||
"ipnet",
|
|
||||||
"js-sys",
|
|
||||||
"log",
|
|
||||||
"mime",
|
|
||||||
"once_cell",
|
|
||||||
"percent-encoding",
|
|
||||||
"pin-project-lite",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"serde_urlencoded",
|
|
||||||
"tokio",
|
|
||||||
"tower-service",
|
|
||||||
"url",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"wasm-bindgen-futures",
|
|
||||||
"web-sys",
|
|
||||||
"winreg",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc-demangle"
|
||||||
|
version = "0.1.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-hash"
|
name = "rustc-hash"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
|
|
@ -2288,10 +2331,14 @@ dependencies = [
|
||||||
name = "rusty-pipe"
|
name = "rusty-pipe"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"gilrs",
|
||||||
"handlebars",
|
"handlebars",
|
||||||
|
"hidapi",
|
||||||
"iced",
|
"iced",
|
||||||
"iced_futures",
|
"iced_futures",
|
||||||
"reqwest",
|
"iced_native",
|
||||||
|
"rdkafka",
|
||||||
|
"rusb",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
|
|
@ -2367,18 +2414,6 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_urlencoded"
|
|
||||||
version = "0.7.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
|
||||||
dependencies = [
|
|
||||||
"form_urlencoded",
|
|
||||||
"itoa",
|
|
||||||
"ryu",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.9.19"
|
version = "0.9.19"
|
||||||
|
|
@ -2568,6 +2603,18 @@ dependencies = [
|
||||||
"unicode-ident",
|
"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]]
|
[[package]]
|
||||||
name = "termcolor"
|
name = "termcolor"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
|
|
@ -2622,21 +2669,6 @@ dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyvec"
|
|
||||||
version = "1.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
|
||||||
dependencies = [
|
|
||||||
"tinyvec_macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyvec_macros"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.26.0"
|
version = "1.26.0"
|
||||||
|
|
@ -2644,30 +2676,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
|
checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"bytes",
|
|
||||||
"libc",
|
|
||||||
"memchr",
|
|
||||||
"mio",
|
|
||||||
"num_cpus",
|
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"socket2",
|
|
||||||
"windows-sys 0.45.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tokio-util"
|
|
||||||
version = "0.7.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2"
|
|
||||||
dependencies = [
|
|
||||||
"bytes",
|
|
||||||
"futures-core",
|
|
||||||
"futures-sink",
|
|
||||||
"pin-project-lite",
|
|
||||||
"tokio",
|
|
||||||
"tracing",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.5.11"
|
version = "0.5.11"
|
||||||
|
|
@ -2694,38 +2706,6 @@ dependencies = [
|
||||||
"winnow",
|
"winnow",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tower-service"
|
|
||||||
version = "0.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tracing"
|
|
||||||
version = "0.1.37"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"pin-project-lite",
|
|
||||||
"tracing-core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tracing-core"
|
|
||||||
version = "0.1.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
|
||||||
dependencies = [
|
|
||||||
"once_cell",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "try-lock"
|
|
||||||
version = "0.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ttf-parser"
|
name = "ttf-parser"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
|
|
@ -2755,27 +2735,12 @@ version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
|
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-bidi"
|
|
||||||
version = "0.3.13"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.8"
|
version = "1.0.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-normalization"
|
|
||||||
version = "0.1.22"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
|
|
||||||
dependencies = [
|
|
||||||
"tinyvec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-segmentation"
|
name = "unicode-segmentation"
|
||||||
version = "1.10.1"
|
version = "1.10.1"
|
||||||
|
|
@ -2801,15 +2766,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c"
|
checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "uuid"
|
||||||
version = "2.3.1"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
|
checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79"
|
||||||
dependencies = [
|
|
||||||
"form_urlencoded",
|
|
||||||
"idna",
|
|
||||||
"percent-encoding",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "value-bag"
|
name = "value-bag"
|
||||||
|
|
@ -2821,6 +2781,12 @@ dependencies = [
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vcpkg"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vec_map"
|
name = "vec_map"
|
||||||
version = "0.8.2"
|
version = "0.8.2"
|
||||||
|
|
@ -2839,16 +2805,6 @@ version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
|
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "want"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
|
|
||||||
dependencies = [
|
|
||||||
"log",
|
|
||||||
"try-lock",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
|
@ -3029,7 +2985,7 @@ dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot 0.11.2",
|
"parking_lot 0.12.1",
|
||||||
"raw-window-handle 0.5.1",
|
"raw-window-handle 0.5.1",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
|
|
@ -3055,7 +3011,7 @@ dependencies = [
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot 0.11.2",
|
"parking_lot 0.12.1",
|
||||||
"profiling",
|
"profiling",
|
||||||
"raw-window-handle 0.5.1",
|
"raw-window-handle 0.5.1",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
|
|
@ -3091,7 +3047,7 @@ dependencies = [
|
||||||
"metal",
|
"metal",
|
||||||
"naga",
|
"naga",
|
||||||
"objc",
|
"objc",
|
||||||
"parking_lot 0.11.2",
|
"parking_lot 0.12.1",
|
||||||
"profiling",
|
"profiling",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
"raw-window-handle 0.5.1",
|
"raw-window-handle 0.5.1",
|
||||||
|
|
@ -3179,6 +3135,21 @@ dependencies = [
|
||||||
"thiserror",
|
"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]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.36.1"
|
version = "0.36.1"
|
||||||
|
|
@ -3345,15 +3316,6 @@ dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winreg"
|
|
||||||
version = "0.10.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
|
||||||
dependencies = [
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wio"
|
name = "wio"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
|
|
||||||
12
Cargo.toml
12
Cargo.toml
|
|
@ -8,8 +8,12 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1.0.156", features = ["derive"] }
|
serde = { version = "1.0.156", features = ["derive"] }
|
||||||
serde_yaml = "0.9.19"
|
serde_yaml = "0.9.19"
|
||||||
serde_json = { version = "1", default-features=false, features=["alloc"] }
|
serde_json = "1"
|
||||||
iced = { version = "0.8.0" }
|
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"
|
handlebars = "4"
|
||||||
iced_futures = { version = "0.6.0", default-features=false, features = ["async-std"] }
|
iced_futures = { version = "0.6.0", features = ["async-std"] }
|
||||||
reqwest = { version = "0.11", default-features=false, features = ["blocking"] }
|
|
||||||
|
|
|
||||||
|
|
@ -37,17 +37,14 @@ pub struct Device {
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct GUI {
|
pub struct GUI {
|
||||||
pub buttons: Buttons,
|
pub buttons: Buttons,
|
||||||
pub release_prefix: String,
|
pub press: PreSufFix,
|
||||||
pub format_keys: Option<String>,
|
pub release: PreSufFix,
|
||||||
pub user: String,
|
|
||||||
pub feedback: GUIFeedback,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct GUIFeedback {
|
pub struct PreSufFix {
|
||||||
pub url_read: Option<String>,
|
pub prefix: String,
|
||||||
pub url_say: Option<String>,
|
pub suffix: String,
|
||||||
pub url_send: Option<String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
|
@ -60,7 +57,6 @@ pub struct Buttons {
|
||||||
pub b: String,
|
pub b: String,
|
||||||
pub x: String,
|
pub x: String,
|
||||||
pub y: String,
|
pub y: String,
|
||||||
pub start: String,
|
|
||||||
pub l: String,
|
pub l: String,
|
||||||
pub r: String,
|
pub r: String,
|
||||||
}
|
}
|
||||||
|
|
@ -121,32 +117,16 @@ fn build_config_std() -> Config {
|
||||||
b: env::var("INPUT_GUI_BUTTON_B").unwrap_or(String::from("2")),
|
b: env::var("INPUT_GUI_BUTTON_B").unwrap_or(String::from("2")),
|
||||||
x: env::var("INPUT_GUI_BUTTON_X").unwrap_or(String::from("3")),
|
x: env::var("INPUT_GUI_BUTTON_X").unwrap_or(String::from("3")),
|
||||||
y: env::var("INPUT_GUI_BUTTON_Y").unwrap_or(String::from("4")),
|
y: env::var("INPUT_GUI_BUTTON_Y").unwrap_or(String::from("4")),
|
||||||
start: env::var("INPUT_GUI_BUTTON_START").unwrap_or(String::from("5")),
|
|
||||||
l: env::var("INPUT_GUI_BUTTON_L").unwrap_or(String::from("q")),
|
l: env::var("INPUT_GUI_BUTTON_L").unwrap_or(String::from("q")),
|
||||||
r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")),
|
r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")),
|
||||||
},
|
},
|
||||||
release_prefix: env::var("INPUT_GUI_RELEASE_PREFIX").unwrap_or(String::from("")),
|
press: PreSufFix{
|
||||||
user: env::var("INPUT_GUI_USER").unwrap_or(String::from("me")),
|
prefix: env::var("INPUT_GUI_PRESS_PREFIX").unwrap_or(String::from("")),
|
||||||
format_keys: match env::var("INPUT_GUI_FORMAT") {
|
suffix: env::var("INPUT_GUI_PRESS_SUFFIX").unwrap_or(String::from("")),
|
||||||
Ok(x) => Some(x),
|
|
||||||
Err(_) => match env::var("INPUT_GUI_FORMAT_V01").unwrap_or(String::from("false")) == String::from("true") {
|
|
||||||
true => Some(String::from("{\"T\":{{ms}},\"U\":\"{{user}}\",\"Y\":\"{{pressed}}\",\"N\":\"{{released}}\"}")),
|
|
||||||
false => None,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
feedback: GUIFeedback{
|
release: PreSufFix{
|
||||||
url_read: match env::var("INPUT_GUI_FEEDBACK_URL_READ") {
|
prefix: env::var("INPUT_GUI_RELEASE_PREFIX").unwrap_or(String::from("!")),
|
||||||
Ok(url) => Some(url),
|
suffix: env::var("INPUT_GUI_RELEASE_SUFFIX").unwrap_or(String::from("")),
|
||||||
Err(_) => None,
|
|
||||||
},
|
|
||||||
url_say: match env::var("INPUT_GUI_FEEDBACK_URL_SAY") {
|
|
||||||
Ok(url) => Some(url),
|
|
||||||
Err(_) => None,
|
|
||||||
},
|
|
||||||
url_send: match env::var("INPUT_GUI_FEEDBACK_URL_SEND") {
|
|
||||||
Ok(url) => Some(url),
|
|
||||||
Err(_) => None,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
device: None,
|
device: None,
|
||||||
|
|
|
||||||
367
src/gui.rs
367
src/gui.rs
|
|
@ -1,18 +1,12 @@
|
||||||
use iced::widget::{button, column, row, text};
|
use iced::widget::{button, column, text};
|
||||||
use iced::widget::text_input;
|
|
||||||
use iced::executor;
|
use iced::executor;
|
||||||
use iced::keyboard;
|
use iced::keyboard;
|
||||||
use iced::subscription;
|
use iced::subscription;
|
||||||
use iced::{Alignment, Element, Application, Settings, Subscription, Theme, Command};
|
use iced::{Alignment, Element, Application, Settings, Subscription, Theme, Command};
|
||||||
use iced_futures::backend::native::async_std::time::every;
|
use iced_futures::backend::native::async_std::time::every;
|
||||||
use handlebars::Handlebars;
|
|
||||||
use serde_json::{json, Value};
|
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
|
||||||
use std::thread;
|
|
||||||
use reqwest;
|
|
||||||
|
|
||||||
use crate::stream::OutputStream;
|
use crate::stream::OutputStream;
|
||||||
use crate::config::{GUI,GUIFeedback};
|
use crate::config::GUI;
|
||||||
|
|
||||||
pub fn main(cfg: GUI, output_stream: Box<dyn OutputStream>) -> iced::Result {
|
pub fn main(cfg: GUI, output_stream: Box<dyn OutputStream>) -> iced::Result {
|
||||||
let def: iced::Settings<()> = Settings::default();
|
let def: iced::Settings<()> = Settings::default();
|
||||||
|
|
@ -28,28 +22,19 @@ pub fn main(cfg: GUI, output_stream: Box<dyn OutputStream>) -> iced::Result {
|
||||||
id: def.id,
|
id: def.id,
|
||||||
text_multithreading: def.text_multithreading,
|
text_multithreading: def.text_multithreading,
|
||||||
try_opengles_first: def.try_opengles_first,
|
try_opengles_first: def.try_opengles_first,
|
||||||
window: iced::window::Settings{
|
window: def.window,
|
||||||
size: (300, 900),
|
|
||||||
position: iced::window::Position::Specific(0, 0),
|
|
||||||
..iced::window::Settings::default()
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
Main::run(settings)
|
Main::run(settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Main {
|
struct Main {
|
||||||
feedback_recv_c: std::sync::mpsc::Receiver<Feedback>,
|
ntfy: String,
|
||||||
feedback_send_c: std::sync::mpsc::Sender<Feedback>,
|
|
||||||
ntfy_from_client: String,
|
|
||||||
ntfy_from_server: String,
|
|
||||||
configuring: Option<Message>,
|
configuring: Option<Message>,
|
||||||
inputs: Inputs,
|
inputs: Inputs,
|
||||||
keys_newly_down: Vec<iced::keyboard::KeyCode>,
|
keys_newly_down: Vec<iced::keyboard::KeyCode>,
|
||||||
keys_already_down: Vec<iced::keyboard::KeyCode>,
|
keys_already_down: Vec<iced::keyboard::KeyCode>,
|
||||||
keys_up: Vec<iced::keyboard::KeyCode>,
|
keys_up: Vec<iced::keyboard::KeyCode>,
|
||||||
flags: Flags,
|
flags: Flags,
|
||||||
input_text_entry_instruction: String,
|
|
||||||
input_text_entry_value: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Flags {
|
struct Flags {
|
||||||
|
|
@ -63,7 +48,6 @@ struct Inputs {
|
||||||
b: iced::keyboard::KeyCode,
|
b: iced::keyboard::KeyCode,
|
||||||
x: iced::keyboard::KeyCode,
|
x: iced::keyboard::KeyCode,
|
||||||
y: iced::keyboard::KeyCode,
|
y: iced::keyboard::KeyCode,
|
||||||
start: iced::keyboard::KeyCode,
|
|
||||||
l: iced::keyboard::KeyCode,
|
l: iced::keyboard::KeyCode,
|
||||||
r: iced::keyboard::KeyCode,
|
r: iced::keyboard::KeyCode,
|
||||||
}
|
}
|
||||||
|
|
@ -77,11 +61,8 @@ struct Stick {
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum Message {
|
enum Message {
|
||||||
EventOccurred(iced::Event),
|
EventOccurred(iced_native::Event),
|
||||||
Tick,
|
Tick,
|
||||||
InputTextEntryUpdate(String),
|
|
||||||
InputTextEntrySubmitSay,
|
|
||||||
InputTextEntrySubmitSend,
|
|
||||||
Up,
|
Up,
|
||||||
Down,
|
Down,
|
||||||
Left,
|
Left,
|
||||||
|
|
@ -90,18 +71,10 @@ enum Message {
|
||||||
B,
|
B,
|
||||||
X,
|
X,
|
||||||
Y,
|
Y,
|
||||||
Start,
|
|
||||||
L,
|
L,
|
||||||
R,
|
R,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
enum Feedback {
|
|
||||||
Heard(String),
|
|
||||||
Say(String),
|
|
||||||
Send(String),
|
|
||||||
}
|
|
||||||
|
|
||||||
fn controller_button_to_string(btn: Message, cur: iced::keyboard::KeyCode) -> String {
|
fn controller_button_to_string(btn: Message, cur: iced::keyboard::KeyCode) -> String {
|
||||||
return format!("{:?} => {:?}", cur, btn);
|
return format!("{:?} => {:?}", cur, btn);
|
||||||
}
|
}
|
||||||
|
|
@ -117,101 +90,11 @@ impl Main {
|
||||||
_ if key_code == &self.inputs.b => Some(&self.flags.cfg.buttons.b),
|
_ if key_code == &self.inputs.b => Some(&self.flags.cfg.buttons.b),
|
||||||
_ if key_code == &self.inputs.x => Some(&self.flags.cfg.buttons.x),
|
_ if key_code == &self.inputs.x => Some(&self.flags.cfg.buttons.x),
|
||||||
_ if key_code == &self.inputs.y => Some(&self.flags.cfg.buttons.y),
|
_ if key_code == &self.inputs.y => Some(&self.flags.cfg.buttons.y),
|
||||||
_ if key_code == &self.inputs.start => Some(&self.flags.cfg.buttons.start),
|
|
||||||
_ if key_code == &self.inputs.l => Some(&self.flags.cfg.buttons.l),
|
_ if key_code == &self.inputs.l => Some(&self.flags.cfg.buttons.l),
|
||||||
_ if key_code == &self.inputs.r => Some(&self.flags.cfg.buttons.r),
|
_ if key_code == &self.inputs.r => Some(&self.flags.cfg.buttons.r),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_from_client(&mut self, text: Feedback) {
|
|
||||||
match text.clone() {
|
|
||||||
Feedback::Say(s) | Feedback::Send(s) if s.len() > 0 && s.len() < 1000 => {},
|
|
||||||
_ => return,
|
|
||||||
};
|
|
||||||
match self.feedback_send_c.send(text) {
|
|
||||||
Ok(_) => {},
|
|
||||||
Err(err) => eprintln!("main.send_say() failed to enqueue: {}", err),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
fn exchange(&mut self) {
|
|
||||||
self.exchange_send();
|
|
||||||
self.exchange_recv();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn exchange_recv(&mut self) {
|
|
||||||
loop {
|
|
||||||
match self.feedback_recv_c.try_recv() {
|
|
||||||
Ok(msg) => {
|
|
||||||
match msg {
|
|
||||||
Feedback::Heard(msg) => {
|
|
||||||
self.ntfy_from_server = msg;
|
|
||||||
},
|
|
||||||
_ => break,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
_ => break,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn exchange_send(&mut self) {
|
|
||||||
let mut s = vec![];
|
|
||||||
for key_code in self.keys_newly_down.iter() {
|
|
||||||
match self.key_code_to_string(key_code) {
|
|
||||||
Some(x) => {
|
|
||||||
for c in x.chars() {
|
|
||||||
s.push(c);
|
|
||||||
}
|
|
||||||
self.keys_already_down.push(*key_code);
|
|
||||||
},
|
|
||||||
None => {},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
let mut t = vec![];
|
|
||||||
self.keys_newly_down.clear();
|
|
||||||
for key_code in self.keys_up.iter() {
|
|
||||||
match self.key_code_to_string(key_code) {
|
|
||||||
Some(x) => {
|
|
||||||
for c in x.chars() {
|
|
||||||
for c in self.flags.cfg.release_prefix.chars() {
|
|
||||||
t.push(c);
|
|
||||||
}
|
|
||||||
t.push(c);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
None => {},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if t.len() + s.len() > 0 {
|
|
||||||
self.flags.output_stream.put(self.sprintf_pressed_released(s, t));
|
|
||||||
}
|
|
||||||
self.keys_up.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn sprintf(&self, format: &String, content: &Value) -> Vec<char> {
|
|
||||||
return Handlebars::new().render_template(format, content).unwrap().chars().collect();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn sprintf_pressed_released(&self, pressed: Vec<char>, released: Vec<char>) -> Vec<char> {
|
|
||||||
match self.flags.cfg.format_keys.clone() {
|
|
||||||
Some(x) => {
|
|
||||||
return self.sprintf(&x, &json!({
|
|
||||||
"pressed": pressed.iter().collect::<String>(),
|
|
||||||
"released": released.iter().collect::<String>(),
|
|
||||||
"ms": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(),
|
|
||||||
"user": self.flags.cfg.user,
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
None => {
|
|
||||||
let mut combo = vec![];
|
|
||||||
combo.extend(pressed);
|
|
||||||
combo.extend(released);
|
|
||||||
return combo;
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Application for Main {
|
impl Application for Main {
|
||||||
|
|
@ -221,21 +104,8 @@ impl Application for Main {
|
||||||
type Executor = executor::Default;
|
type Executor = executor::Default;
|
||||||
|
|
||||||
fn new(flags: Self::Flags) -> (Self, Command<Message>) {
|
fn new(flags: Self::Flags) -> (Self, Command<Message>) {
|
||||||
let (sender1, receiver1) = std::sync::mpsc::channel();
|
|
||||||
let (sender2, receiver2) = std::sync::mpsc::channel();
|
|
||||||
let feedback_cfg = flags.cfg.feedback.clone();
|
|
||||||
thread::spawn(move || {
|
|
||||||
Feedbacker{
|
|
||||||
send_c: sender1,
|
|
||||||
recv_c: receiver2,
|
|
||||||
cfg: feedback_cfg,
|
|
||||||
}.listen()
|
|
||||||
});
|
|
||||||
return (Self {
|
return (Self {
|
||||||
feedback_send_c: sender2,
|
ntfy: String::from(":wave:"),
|
||||||
feedback_recv_c: receiver1,
|
|
||||||
ntfy_from_client: String::from(" "),
|
|
||||||
ntfy_from_server: String::from(" "),
|
|
||||||
configuring: None,
|
configuring: None,
|
||||||
inputs: Inputs{
|
inputs: Inputs{
|
||||||
stick: Stick {
|
stick: Stick {
|
||||||
|
|
@ -248,7 +118,6 @@ impl Application for Main {
|
||||||
b: iced::keyboard::KeyCode::Key2,
|
b: iced::keyboard::KeyCode::Key2,
|
||||||
x: iced::keyboard::KeyCode::Key3,
|
x: iced::keyboard::KeyCode::Key3,
|
||||||
y: iced::keyboard::KeyCode::Key4,
|
y: iced::keyboard::KeyCode::Key4,
|
||||||
start: iced::keyboard::KeyCode::Key5,
|
|
||||||
l: iced::keyboard::KeyCode::Q,
|
l: iced::keyboard::KeyCode::Q,
|
||||||
r: iced::keyboard::KeyCode::E,
|
r: iced::keyboard::KeyCode::E,
|
||||||
},
|
},
|
||||||
|
|
@ -256,8 +125,6 @@ impl Application for Main {
|
||||||
keys_newly_down: vec![],
|
keys_newly_down: vec![],
|
||||||
keys_already_down: vec![],
|
keys_already_down: vec![],
|
||||||
keys_up: vec![],
|
keys_up: vec![],
|
||||||
input_text_entry_instruction: String::from(""),
|
|
||||||
input_text_entry_value: String::from(""),
|
|
||||||
}, Command::none())
|
}, Command::none())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -268,18 +135,50 @@ impl Application for Main {
|
||||||
fn update(&mut self, msg: Message) -> Command<Message> {
|
fn update(&mut self, msg: Message) -> Command<Message> {
|
||||||
match msg.clone() {
|
match msg.clone() {
|
||||||
Message::Tick => {
|
Message::Tick => {
|
||||||
self.exchange();
|
let mut s = vec![];
|
||||||
},
|
for key_code in self.keys_newly_down.iter() {
|
||||||
Message::InputTextEntryUpdate(payload) => {
|
match self.key_code_to_string(key_code) {
|
||||||
self.input_text_entry_value = payload;
|
Some(x) => {
|
||||||
},
|
for c in self.flags.cfg.press.prefix.chars() {
|
||||||
Message::InputTextEntrySubmitSend => {
|
s.push(c);
|
||||||
self.send_from_client(Feedback::Send(self.input_text_entry_value.clone()));
|
}
|
||||||
self.input_text_entry_value = String::from("");
|
for c in x.chars() {
|
||||||
},
|
s.push(c);
|
||||||
Message::InputTextEntrySubmitSay => {
|
}
|
||||||
self.send_from_client(Feedback::Say(self.input_text_entry_value.clone()));
|
for c in self.flags.cfg.press.suffix.chars() {
|
||||||
self.input_text_entry_value = String::from("");
|
s.push(c);
|
||||||
|
}
|
||||||
|
self.keys_already_down.push(*key_code);
|
||||||
|
},
|
||||||
|
None => {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if s.len() > 0 {
|
||||||
|
self.flags.output_stream.put(s);
|
||||||
|
}
|
||||||
|
self.keys_newly_down.clear();
|
||||||
|
|
||||||
|
let mut s = vec![];
|
||||||
|
for key_code in self.keys_up.iter() {
|
||||||
|
match self.key_code_to_string(key_code) {
|
||||||
|
Some(x) => {
|
||||||
|
for c in x.chars() {
|
||||||
|
for c in self.flags.cfg.release.prefix.chars() {
|
||||||
|
s.push(c);
|
||||||
|
}
|
||||||
|
s.push(c);
|
||||||
|
for c in self.flags.cfg.release.suffix.chars() {
|
||||||
|
s.push(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if s.len() > 0 {
|
||||||
|
self.flags.output_stream.put(s);
|
||||||
|
}
|
||||||
|
self.keys_up.clear();
|
||||||
},
|
},
|
||||||
Message::EventOccurred(event) if self.configuring.is_some() => {
|
Message::EventOccurred(event) if self.configuring.is_some() => {
|
||||||
match event {
|
match event {
|
||||||
|
|
@ -297,16 +196,15 @@ impl Application for Main {
|
||||||
Message::B => { self.inputs.b = key_code },
|
Message::B => { self.inputs.b = key_code },
|
||||||
Message::X => { self.inputs.x = key_code },
|
Message::X => { self.inputs.x = key_code },
|
||||||
Message::Y => { self.inputs.y = key_code },
|
Message::Y => { self.inputs.y = key_code },
|
||||||
Message::Start => { self.inputs.start = key_code },
|
|
||||||
Message::L => { self.inputs.l = key_code },
|
Message::L => { self.inputs.l = key_code },
|
||||||
Message::R => { self.inputs.r = key_code },
|
Message::R => { self.inputs.r = key_code },
|
||||||
_ => {},
|
_ => {},
|
||||||
};
|
};
|
||||||
self.ntfy_from_client = format!("{:?} => {:?}", key_code.clone(), self.configuring.as_ref().unwrap());
|
self.ntfy = format!("{:?} => {:?}", key_code.clone(), self.configuring.as_ref().unwrap());
|
||||||
self.configuring = None;
|
self.configuring = None;
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
Message::EventOccurred(event) => {
|
Message::EventOccurred(event) => {
|
||||||
match event {
|
match event {
|
||||||
|
|
@ -322,7 +220,6 @@ impl Application for Main {
|
||||||
self.keys_newly_down.dedup();
|
self.keys_newly_down.dedup();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
self.exchange();
|
|
||||||
},
|
},
|
||||||
iced::event::Event::Keyboard(keyboard::Event::KeyReleased{
|
iced::event::Event::Keyboard(keyboard::Event::KeyReleased{
|
||||||
key_code,
|
key_code,
|
||||||
|
|
@ -342,14 +239,13 @@ impl Application for Main {
|
||||||
},
|
},
|
||||||
None => {},
|
None => {},
|
||||||
};
|
};
|
||||||
self.exchange();
|
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
self.configuring = Some(msg.clone());
|
self.configuring = Some(msg.clone());
|
||||||
self.ntfy_from_client = format!("push a key to bind to {:?}", msg.clone());
|
self.ntfy = format!("push a key to bind to {:?}", msg.clone());
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return Command::none();
|
return Command::none();
|
||||||
|
|
@ -357,149 +253,30 @@ impl Application for Main {
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
return subscription::Subscription::batch(vec![
|
return subscription::Subscription::batch(vec![
|
||||||
subscription::events_with(|event, status| match status {
|
subscription::events_with(|event, _| match event {
|
||||||
iced::event::Status::Ignored => match event {
|
iced::Event::Keyboard(_) => Some(Message::EventOccurred(event)),
|
||||||
iced::Event::Keyboard(_) => Some(Message::EventOccurred(event)),
|
|
||||||
_ => None,
|
|
||||||
},
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}),
|
}),
|
||||||
every(std::time::Duration::from_millis(2000)).map(|_| Message::Tick),
|
every(std::time::Duration::from_millis(5)).map(|_| Message::Tick),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Element<Message> {
|
fn view(&self) -> Element<Message> {
|
||||||
let new_cfg_button = |msg: Message, s| button(text(controller_button_to_string(msg.clone(), s))).on_press(msg.clone());
|
|
||||||
return column![
|
return column![
|
||||||
text(String::from("= MAYHEM PARTY =")).size(32),
|
button(text(controller_button_to_string(Message::Up, self.inputs.stick.up))).on_press(Message::Up),
|
||||||
column![
|
button(text(controller_button_to_string(Message::Down, self.inputs.stick.down))).on_press(Message::Down),
|
||||||
column![
|
button(text(controller_button_to_string(Message::Left, self.inputs.stick.left))).on_press(Message::Left),
|
||||||
text(String::from("Button Mapping")).size(24),
|
button(text(controller_button_to_string(Message::Right, self.inputs.stick.right))).on_press(Message::Right),
|
||||||
text(String::from("--------------")).size(24),
|
button(text(controller_button_to_string(Message::A, self.inputs.a))).on_press(Message::A),
|
||||||
row![
|
button(text(controller_button_to_string(Message::B, self.inputs.b))).on_press(Message::B),
|
||||||
column![
|
button(text(controller_button_to_string(Message::X, self.inputs.x))).on_press(Message::X),
|
||||||
new_cfg_button(Message::Up, self.inputs.stick.up),
|
button(text(controller_button_to_string(Message::Y, self.inputs.y))).on_press(Message::Y),
|
||||||
new_cfg_button(Message::Down, self.inputs.stick.down),
|
button(text(controller_button_to_string(Message::L, self.inputs.l))).on_press(Message::L),
|
||||||
new_cfg_button(Message::Left, self.inputs.stick.left),
|
button(text(controller_button_to_string(Message::R, self.inputs.r))).on_press(Message::R),
|
||||||
new_cfg_button(Message::Right, self.inputs.stick.right),
|
text(self.ntfy.clone()).size(50),
|
||||||
new_cfg_button(Message::Start, self.inputs.start),
|
]
|
||||||
].padding(5).align_items(Alignment::Center),
|
.padding(20)
|
||||||
column![
|
.align_items(Alignment::Center)
|
||||||
new_cfg_button(Message::A, self.inputs.a),
|
.into();
|
||||||
new_cfg_button(Message::B, self.inputs.b),
|
|
||||||
new_cfg_button(Message::X, self.inputs.x),
|
|
||||||
new_cfg_button(Message::Y, self.inputs.y),
|
|
||||||
new_cfg_button(Message::L, self.inputs.l),
|
|
||||||
new_cfg_button(Message::R, self.inputs.r),
|
|
||||||
].padding(5).align_items(Alignment::Center),
|
|
||||||
].padding(5).align_items(Alignment::Center),
|
|
||||||
text(String::from("--------------")).size(24),
|
|
||||||
text(self.ntfy_from_client.clone()).size(18),
|
|
||||||
].padding(20).align_items(Alignment::Center),
|
|
||||||
column![
|
|
||||||
text_input(
|
|
||||||
&self.input_text_entry_instruction,
|
|
||||||
&self.input_text_entry_value,
|
|
||||||
Message::InputTextEntryUpdate
|
|
||||||
),
|
|
||||||
row![
|
|
||||||
button(text("Say")).on_press(Message::InputTextEntrySubmitSay).padding(20),
|
|
||||||
button(text("Send")).on_press(Message::InputTextEntrySubmitSend).padding(20),
|
|
||||||
].padding(20).align_items(Alignment::Center),
|
|
||||||
text(self.ntfy_from_server.clone().trim()).size(18),
|
|
||||||
].padding(20).align_items(Alignment::Center),
|
|
||||||
].padding(0).align_items(Alignment::Center),
|
|
||||||
].padding(0).align_items(Alignment::Center).into();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Feedbacker {
|
|
||||||
send_c: std::sync::mpsc::Sender<Feedback>,
|
|
||||||
recv_c: std::sync::mpsc::Receiver<Feedback>,
|
|
||||||
cfg: GUIFeedback,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Feedbacker {
|
|
||||||
fn listen(&mut self) {
|
|
||||||
loop {
|
|
||||||
std::thread::sleep(std::time::Duration::from_secs(2));
|
|
||||||
match self.read_from_server() {
|
|
||||||
Some(msg) if msg.len() > 0 => {
|
|
||||||
self.write_from_server(msg.clone());
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
};
|
|
||||||
match self.read_from_client() {
|
|
||||||
Some(msg) => self.write_from_client(msg.clone()),
|
|
||||||
_ => {},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_from_server(&mut self) -> Option<String> {
|
|
||||||
return match &self.cfg.url_read {
|
|
||||||
Some(url) => {
|
|
||||||
match reqwest::blocking::get(url) {
|
|
||||||
Ok(resp) => match resp.text() {
|
|
||||||
Ok(text) => Some(text),
|
|
||||||
_ => None,
|
|
||||||
},
|
|
||||||
Err(err) => {
|
|
||||||
eprintln!("feedback.read: cannot fetch: {}", err);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
fn write_from_server(&mut self, msg: String) {
|
|
||||||
match self.send_c.send(Feedback::Heard(msg.clone())) {
|
|
||||||
Ok(_) => {},
|
|
||||||
Err(err) => eprintln!("feedback.listen() failed to display {}: {}", msg, err),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_from_client(&mut self) -> Option<Feedback> {
|
|
||||||
let mut last: Option<Feedback> = None;
|
|
||||||
loop {
|
|
||||||
match self.recv_c.try_recv() {
|
|
||||||
Ok(msg) => {
|
|
||||||
last = Some(msg);
|
|
||||||
},
|
|
||||||
_ => break,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return last;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn write_from_client(&mut self, msg: Feedback) {
|
|
||||||
match msg {
|
|
||||||
Feedback::Send(send) if send.len() > 0 => match &self.cfg.url_send {
|
|
||||||
Some(url) => {
|
|
||||||
match reqwest::blocking::get(format!("{}{}", url, send)) {
|
|
||||||
Err(err) => {
|
|
||||||
eprintln!("feedback.write_from_client: cannot send: {}", err);
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
Feedback::Say(say) if say.len() > 0 => match &self.cfg.url_say {
|
|
||||||
Some(url) => {
|
|
||||||
match reqwest::blocking::get(format!("{}{}", url, say)) {
|
|
||||||
Err(err) => {
|
|
||||||
eprintln!("feedback.write_from_client: cannot say: {}", err);
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
use crate::config::Stream;
|
use crate::config::Stream;
|
||||||
|
|
||||||
|
use hidapi::HidApi;
|
||||||
|
use rusb::UsbContext;
|
||||||
|
use gilrs::{Gilrs, Button, Event};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use handlebars::Handlebars;
|
use handlebars::Handlebars;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
@ -17,6 +20,7 @@ pub fn build_input_stream(cfg: &Stream) -> Box<dyn InputStream> {
|
||||||
return Box::new(build_input_stream_kafka(&cfg).unwrap());
|
return Box::new(build_input_stream_kafka(&cfg).unwrap());
|
||||||
},
|
},
|
||||||
"udp" => return Box::new(build_input_stream_udp(&cfg).unwrap()),
|
"udp" => return Box::new(build_input_stream_udp(&cfg).unwrap()),
|
||||||
|
"device" => return Box::new(build_input_stream_device(&cfg).unwrap()),
|
||||||
_ => {},
|
_ => {},
|
||||||
};
|
};
|
||||||
assert!(false);
|
assert!(false);
|
||||||
|
|
@ -26,9 +30,78 @@ pub fn build_input_stream(cfg: &Stream) -> Box<dyn InputStream> {
|
||||||
pub struct InputStreamDevice {
|
pub struct InputStreamDevice {
|
||||||
}
|
}
|
||||||
|
|
||||||
//pub fn build_input_stream_device_gilrs(cfg: &Stream) -> Result<InputStreamDevice, String> {
|
pub fn build_input_stream_device(cfg: &Stream) -> Result<InputStreamDevice, String> {
|
||||||
//pub fn build_input_stream_device_hidapi(cfg: &Stream) -> Result<InputStreamDevice, String> {
|
return build_input_stream_device_gilrs(cfg)
|
||||||
//pub fn build_input_stream_device_rusb(cfg: &Stream) -> Result<InputStreamDevice, String> {
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
impl InputStream for InputStreamDevice {
|
impl InputStream for InputStreamDevice {
|
||||||
fn get(&mut self) -> Vec<char> {
|
fn get(&mut self) -> Vec<char> {
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
p := os.Getenv("PORT")
|
|
||||||
if err := http.ListenAndServe(":"+p, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
b, _ := io.ReadAll(r.Body)
|
|
||||||
log.Printf("> %s (%+v) %s", r.URL, r.Header, b)
|
|
||||||
body := os.Getenv("BODY")
|
|
||||||
if body == "-" {
|
|
||||||
body = string(b)
|
|
||||||
}
|
|
||||||
w.Write([]byte(body))
|
|
||||||
})); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue