feat: Play sound

This commit is contained in:
Xeovalyte 2023-10-16 19:01:34 +02:00
parent 634d1c17e4
commit d2872ef3fd
12 changed files with 696 additions and 37 deletions

View File

@ -62,6 +62,28 @@ dependencies = [
"alloc-no-stdlib", "alloc-no-stdlib",
] ]
[[package]]
name = "alsa"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2562ad8dcf0f789f65c6fdaad8a8a9708ed6b488e649da28c01656ad66b8b47"
dependencies = [
"alsa-sys",
"bitflags 1.3.2",
"libc",
"nix 0.24.3",
]
[[package]]
name = "alsa-sys"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527"
dependencies = [
"libc",
"pkg-config",
]
[[package]] [[package]]
name = "android-tzdata" name = "android-tzdata"
version = "0.1.1" version = "0.1.1"
@ -83,6 +105,12 @@ version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]]
name = "arrayvec"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]] [[package]]
name = "atk" name = "atk"
version = "0.15.1" version = "0.15.1"
@ -140,6 +168,26 @@ version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2"
[[package]]
name = "bindgen"
version = "0.68.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078"
dependencies = [
"bitflags 2.4.0",
"cexpr",
"clang-sys",
"lazy_static",
"lazycell",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"syn 2.0.37",
]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@ -262,6 +310,7 @@ version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
dependencies = [ dependencies = [
"jobserver",
"libc", "libc",
] ]
@ -271,6 +320,15 @@ 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 = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "cexpr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
dependencies = [
"nom",
]
[[package]] [[package]]
name = "cfb" name = "cfb"
version = "0.7.3" version = "0.7.3"
@ -317,9 +375,26 @@ dependencies = [
"iana-time-zone", "iana-time-zone",
"num-traits", "num-traits",
"serde", "serde",
"windows-targets", "windows-targets 0.48.5",
] ]
[[package]]
name = "clang-sys"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]]
name = "claxon"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bfbf56724aa9eca8afa4fcfadeb479e722935bb2a0900c2d37e0cc477af0688"
[[package]] [[package]]
name = "cocoa" name = "cocoa"
version = "0.24.1" version = "0.24.1"
@ -412,6 +487,51 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "coreaudio-rs"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace"
dependencies = [
"bitflags 1.3.2",
"core-foundation-sys",
"coreaudio-sys",
]
[[package]]
name = "coreaudio-sys"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8478e5bdad14dce236b9898ea002eabfa87cbe14f0aa538dbe3b6a4bec4332d"
dependencies = [
"bindgen",
]
[[package]]
name = "cpal"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d959d90e938c5493000514b446987c07aed46c668faaa7d34d6c7a67b1a578c"
dependencies = [
"alsa",
"core-foundation-sys",
"coreaudio-rs",
"dasp_sample",
"jni 0.19.0",
"js-sys",
"libc",
"mach2",
"ndk 0.7.0",
"ndk-context",
"oboe",
"once_cell",
"parking_lot",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"windows 0.46.0",
]
[[package]] [[package]]
name = "cpufeatures" name = "cpufeatures"
version = "0.2.9" version = "0.2.9"
@ -531,6 +651,12 @@ dependencies = [
"syn 2.0.37", "syn 2.0.37",
] ]
[[package]]
name = "dasp_sample"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"
[[package]] [[package]]
name = "deranged" name = "deranged"
version = "0.3.8" version = "0.3.8"
@ -1161,6 +1287,12 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "hound"
version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"
[[package]] [[package]]
name = "html5ever" name = "html5ever"
version = "0.25.2" version = "0.25.2"
@ -1360,6 +1492,20 @@ dependencies = [
"system-deps 5.0.0", "system-deps 5.0.0",
] ]
[[package]]
name = "jni"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec"
dependencies = [
"cesu8",
"combine",
"jni-sys",
"log",
"thiserror",
"walkdir",
]
[[package]] [[package]]
name = "jni" name = "jni"
version = "0.20.0" version = "0.20.0"
@ -1380,6 +1526,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "jobserver"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.64" version = "0.3.64"
@ -1432,12 +1587,39 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "lewton"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "777b48df9aaab155475a83a7df3070395ea1ac6902f5cd062b8f2b028075c030"
dependencies = [
"byteorder",
"ogg",
"tinyvec",
]
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.148" version = "0.2.148"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
[[package]]
name = "libloading"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
dependencies = [
"cfg-if",
"winapi",
]
[[package]] [[package]]
name = "libudev" name = "libudev"
version = "0.3.0" version = "0.3.0"
@ -1595,6 +1777,12 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.7.1" version = "0.7.1"
@ -1613,11 +1801,25 @@ checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"jni-sys", "jni-sys",
"ndk-sys", "ndk-sys 0.3.0",
"num_enum", "num_enum",
"thiserror", "thiserror",
] ]
[[package]]
name = "ndk"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0"
dependencies = [
"bitflags 1.3.2",
"jni-sys",
"ndk-sys 0.4.1+23.1.7779620",
"num_enum",
"raw-window-handle",
"thiserror",
]
[[package]] [[package]]
name = "ndk-context" name = "ndk-context"
version = "0.1.1" version = "0.1.1"
@ -1633,12 +1835,32 @@ dependencies = [
"jni-sys", "jni-sys",
] ]
[[package]]
name = "ndk-sys"
version = "0.4.1+23.1.7779620"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3"
dependencies = [
"jni-sys",
]
[[package]] [[package]]
name = "new_debug_unreachable" name = "new_debug_unreachable"
version = "1.0.4" version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
[[package]]
name = "nix"
version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"libc",
]
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.26.4" version = "0.26.4"
@ -1656,6 +1878,16 @@ version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]] [[package]]
name = "nu-ansi-term" name = "nu-ansi-term"
version = "0.46.0" version = "0.46.0"
@ -1666,6 +1898,17 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "num-derive"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "num-integer" name = "num-integer"
version = "0.1.45" version = "0.1.45"
@ -1737,6 +1980,17 @@ dependencies = [
"objc_exception", "objc_exception",
] ]
[[package]]
name = "objc-foundation"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
dependencies = [
"block",
"objc",
"objc_id",
]
[[package]] [[package]]
name = "objc_exception" name = "objc_exception"
version = "0.1.2" version = "0.1.2"
@ -1764,6 +2018,38 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "oboe"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0"
dependencies = [
"jni 0.20.0",
"ndk 0.7.0",
"ndk-context",
"num-derive",
"num-traits",
"oboe-sys",
]
[[package]]
name = "oboe-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2"
dependencies = [
"cc",
]
[[package]]
name = "ogg"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6951b4e8bf21c8193da321bcce9c9dd2e13c858fe078bf9054a288b419ae5d6e"
dependencies = [
"byteorder",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.18.0" version = "1.18.0"
@ -1831,7 +2117,7 @@ dependencies = [
"libc", "libc",
"redox_syscall 0.3.5", "redox_syscall 0.3.5",
"smallvec", "smallvec",
"windows-targets", "windows-targets 0.48.5",
] ]
[[package]] [[package]]
@ -1840,6 +2126,12 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.3.0" version = "2.3.0"
@ -2238,12 +2530,89 @@ version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
[[package]]
name = "rfd"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0149778bd99b6959285b0933288206090c50e2327f47a9c463bfdbf45c8823ea"
dependencies = [
"block",
"dispatch",
"glib-sys",
"gobject-sys",
"gtk-sys",
"js-sys",
"lazy_static",
"log",
"objc",
"objc-foundation",
"objc_id",
"raw-window-handle",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"windows 0.37.0",
]
[[package]]
name = "rodio"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdf1d4dea18dff2e9eb6dca123724f8b60ef44ad74a9ad283cdfe025df7e73fa"
dependencies = [
"claxon",
"cpal",
"hound",
"lewton",
"symphonia",
]
[[package]]
name = "rust-embed"
version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1e7d90385b59f0a6bf3d3b757f3ca4ece2048265d70db20a2016043d4509a40"
dependencies = [
"rust-embed-impl",
"rust-embed-utils",
"walkdir",
]
[[package]]
name = "rust-embed-impl"
version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c3d8c6fd84090ae348e63a84336b112b5c3918b3bf0493a581f7bd8ee623c29"
dependencies = [
"proc-macro2",
"quote",
"rust-embed-utils",
"syn 2.0.37",
"walkdir",
]
[[package]]
name = "rust-embed-utils"
version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "873feff8cb7bf86fdf0a71bb21c95159f4e4a37dd7a4bd1855a940909b583ada"
dependencies = [
"sha2",
"walkdir",
]
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.23" version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.4.0" version = "0.4.0"
@ -2448,7 +2817,7 @@ dependencies = [
"cfg-if", "cfg-if",
"libudev", "libudev",
"mach2", "mach2",
"nix", "nix 0.26.4",
"regex", "regex",
"scopeguard", "scopeguard",
"winapi", "winapi",
@ -2484,6 +2853,12 @@ dependencies = [
"lazy_static", "lazy_static",
] ]
[[package]]
name = "shlex"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380"
[[package]] [[package]]
name = "simd-adler32" name = "simd-adler32"
version = "0.3.7" version = "0.3.7"
@ -2586,6 +2961,56 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "symphonia"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62e48dba70095f265fdb269b99619b95d04c89e619538138383e63310b14d941"
dependencies = [
"lazy_static",
"symphonia-bundle-mp3",
"symphonia-core",
"symphonia-metadata",
]
[[package]]
name = "symphonia-bundle-mp3"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f31d7fece546f1e6973011a9eceae948133bbd18fd3d52f6073b1e38ae6368a"
dependencies = [
"bitflags 1.3.2",
"lazy_static",
"log",
"symphonia-core",
"symphonia-metadata",
]
[[package]]
name = "symphonia-core"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c73eb88fee79705268cc7b742c7bc93a7b76e092ab751d0833866970754142"
dependencies = [
"arrayvec",
"bitflags 1.3.2",
"bytemuck",
"lazy_static",
"log",
]
[[package]]
name = "symphonia-metadata"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89c3e1937e31d0e068bbe829f66b2f2bfaa28d056365279e0ef897172c3320c0"
dependencies = [
"encoding_rs",
"lazy_static",
"log",
"symphonia-core",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.109" version = "1.0.109"
@ -2659,13 +3084,13 @@ dependencies = [
"gtk", "gtk",
"image", "image",
"instant", "instant",
"jni", "jni 0.20.0",
"lazy_static", "lazy_static",
"libc", "libc",
"log", "log",
"ndk", "ndk 0.6.0",
"ndk-context", "ndk-context",
"ndk-sys", "ndk-sys 0.3.0",
"objc", "objc",
"once_cell", "once_cell",
"parking_lot", "parking_lot",
@ -2735,6 +3160,7 @@ dependencies = [
"rand 0.8.5", "rand 0.8.5",
"raw-window-handle", "raw-window-handle",
"regex", "regex",
"rfd",
"semver", "semver",
"serde", "serde",
"serde_json", "serde_json",
@ -3083,6 +3509,9 @@ dependencies = [
name = "toos-dashboard" name = "toos-dashboard"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"once_cell",
"rodio",
"rust-embed",
"serde", "serde",
"serde_json", "serde_json",
"serialport", "serialport",
@ -3312,6 +3741,18 @@ dependencies = [
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.87" version = "0.2.87"
@ -3341,6 +3782,16 @@ version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]]
name = "web-sys"
version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]] [[package]]
name = "webkit2gtk" name = "webkit2gtk"
version = "0.18.2" version = "0.18.2"
@ -3457,6 +3908,19 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647"
dependencies = [
"windows_aarch64_msvc 0.37.0",
"windows_i686_gnu 0.37.0",
"windows_i686_msvc 0.37.0",
"windows_x86_64_gnu 0.37.0",
"windows_x86_64_msvc 0.37.0",
]
[[package]] [[package]]
name = "windows" name = "windows"
version = "0.39.0" version = "0.39.0"
@ -3471,13 +3935,22 @@ dependencies = [
"windows_x86_64_msvc 0.39.0", "windows_x86_64_msvc 0.39.0",
] ]
[[package]]
name = "windows"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25"
dependencies = [
"windows-targets 0.42.2",
]
[[package]] [[package]]
name = "windows" name = "windows"
version = "0.48.0" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [ dependencies = [
"windows-targets", "windows-targets 0.48.5",
] ]
[[package]] [[package]]
@ -3527,7 +4000,22 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [ dependencies = [
"windows-targets", "windows-targets 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"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 0.42.2",
"windows_x86_64_msvc 0.42.2",
] ]
[[package]] [[package]]
@ -3563,6 +4051,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.39.0" version = "0.39.0"
@ -3581,6 +4075,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.39.0" version = "0.39.0"
@ -3599,6 +4099,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.39.0" version = "0.39.0"
@ -3617,6 +4123,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.39.0" version = "0.39.0"
@ -3647,6 +4159,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.39.0" version = "0.39.0"

View File

@ -13,10 +13,13 @@ edition = "2021"
tauri-build = { version = "1.5", features = [] } tauri-build = { version = "1.5", features = [] }
[dependencies] [dependencies]
tauri = { version = "1.5", features = ["shell-open"] } tauri = { version = "1.5", features = [ "dialog-all", "shell-open"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
serialport = "4.2.2" serialport = "4.2.2"
rodio = "0.17.1"
rust-embed="8.0.0"
once_cell = "1.18.0"
[features] [features]
# this feature is used for production builds or when `devPath` points to the filesystem # this feature is used for production builds or when `devPath` points to the filesystem

Binary file not shown.

View File

@ -1,15 +1,25 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!! // Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use std::sync:: Mutex;
use std::io::ErrorKind; use std::io::ErrorKind;
use std::thread;
use std::time::Duration; use std::time::Duration;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Mutex;
use tauri::State; use tauri::State;
use tauri::Manager;
use std::fs::File;
use std::io::BufReader;
use rodio::{Decoder, OutputStream, Sink};
#[derive(Default)] #[derive(Default)]
struct PortMap(Mutex<HashMap<String, Box<dyn serialport::SerialPort>>>); struct PortMap(Mutex<HashMap<String, Box<dyn serialport::SerialPort>>>);
#[derive(Clone, serde::Serialize)]
struct PayloadPortState {
open: bool,
}
#[tauri::command] #[tauri::command]
async fn write_serial(input: &str, port_name: &str, port_map: State<'_, PortMap>) -> Result<(), String> { async fn write_serial(input: &str, port_name: &str, port_map: State<'_, PortMap>) -> Result<(), String> {
match port_map.0.lock().unwrap().get(port_name) { match port_map.0.lock().unwrap().get(port_name) {
@ -24,11 +34,12 @@ async fn write_serial(input: &str, port_name: &str, port_map: State<'_, PortMap>
} }
} }
None => { None => {
Ok(()) Err(String::from("Port is closed"))
} }
} }
} }
#[tauri::command] #[tauri::command]
fn get_serial_ports() -> Vec<String> { fn get_serial_ports() -> Vec<String> {
let ports = serialport::available_ports().expect("No ports found"); let ports = serialport::available_ports().expect("No ports found");
@ -42,16 +53,29 @@ fn get_serial_ports() -> Vec<String> {
} }
#[tauri::command] #[tauri::command]
async fn open_port(_app_handle: tauri::AppHandle, port_map: State<'_, PortMap>) -> Result<(), String> { fn close_port(app_handle: tauri::AppHandle, port_name: &str, port_map: State<'_, PortMap>) {
match serialport::new("/dev/ttyUSB0", 9600).timeout(Duration::from_millis(10)).open() { match port_map.0.lock().unwrap().remove(port_name) {
Ok(port) => { Some(_) => {
port_map.0.lock().unwrap().insert("/dev/ttyUSB0".to_string(), port.try_clone().expect("Error cloning")); println!("Port {} closed", port_name);
app_handle.emit_all("port-state", PayloadPortState { open: false }).unwrap();
},
None => println!("Port {} was already closed", port_name),
}
}
println!("Port is open"); #[tauri::command]
async fn open_port(app_handle: tauri::AppHandle, port_name: &str, baud: u32, port_map: State<'_, PortMap>) -> Result<(), String> {
match serialport::new(port_name, baud).timeout(Duration::from_millis(10)).open() {
Ok(port) => {
port_map.0.lock().unwrap().insert(port_name.to_string(), port.try_clone().expect("Error cloning"));
let mut clone = port.try_clone().expect("Failed to clone"); let mut clone = port.try_clone().expect("Failed to clone");
let mut buffer: Vec<u8> = vec![0; 1024]; let mut buffer: Vec<u8> = vec![0; 1024];
println!("Port {} is open", port_name);
app_handle.emit_all("port-state", PayloadPortState { open: true }).unwrap();
loop { loop {
match clone.read(buffer.as_mut_slice()) { match clone.read(buffer.as_mut_slice()) {
Ok(bytes_read) => { Ok(bytes_read) => {
@ -60,6 +84,10 @@ async fn open_port(_app_handle: tauri::AppHandle, port_map: State<'_, PortMap>)
let data = String::from_utf8_lossy(data).to_string(); let data = String::from_utf8_lossy(data).to_string();
if !data.trim().is_empty() { if !data.trim().is_empty() {
println!("{}", data.trim()); println!("{}", data.trim());
if data.trim() == "1" {
play_sound()
// app_handle.emit_all("button-on", PayloadPortState { open: true }).unwrap();
}
} }
} }
}, },
@ -70,14 +98,27 @@ async fn open_port(_app_handle: tauri::AppHandle, port_map: State<'_, PortMap>)
} }
}, },
Err(err) => return Err(err.to_string()), Err(err) => return Err(err.to_string()),
}; }
}
fn play_sound() {
thread::spawn(|| {
let (_stream, stream_handle) = OutputStream::try_default().unwrap();
let sink = Sink::try_new(&stream_handle).unwrap();
let file = BufReader::new(File::open("assets/audio.mp3").unwrap());
let source = Decoder::new(file).unwrap();
sink.append(source);
sink.sleep_until_end();
});
} }
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
.manage(PortMap::default()) .manage(PortMap::default())
.invoke_handler(tauri::generate_handler![get_serial_ports, write_serial, open_port]) .invoke_handler(tauri::generate_handler![get_serial_ports, write_serial, open_port, close_port])
.run(tauri::generate_context!()) .run(tauri::generate_context!())
.expect("error while running tauri application"); .expect("error while running tauri application");
} }

View File

@ -16,6 +16,9 @@
"shell": { "shell": {
"all": false, "all": false,
"open": true "open": true
},
"dialog": {
"all": true
} }
}, },
"bundle": { "bundle": {

View File

@ -2,10 +2,14 @@
<div class="w-full flex h-screen bg-neutral-950"> <div class="w-full flex h-screen bg-neutral-950">
<Sidebar @updateCurrentPage="setCurrentPage" /> <Sidebar @updateCurrentPage="setCurrentPage" />
<div class="w-full"> <div class="w-full">
<Status />
<Main v-if="currentPage === 0" /> <Main v-if="currentPage === 0" />
<Conf v-if="currentPage === 1" /> <Conf v-if="currentPage === 1" />
<Test v-if="currentPage === 2" /> <Test v-if="currentPage === 2" />
</div> </div>
<audio id="audioContainer">
<source src="./assets/audio.mp3" type="audio/mp3">
</audio>
</div> </div>
</template> </template>
@ -14,12 +18,32 @@ import Sidebar from "./components/Sidebar.vue";
import Test from "./components/Test.vue"; import Test from "./components/Test.vue";
import Main from "./components/Main.vue"; import Main from "./components/Main.vue";
import Conf from "./components/Conf.vue"; import Conf from "./components/Conf.vue";
import Status from "./components/Status.vue";
import { ref } from "vue"; import { ref, onMounted } from "vue";
import { listen } from '@tauri-apps/api/event';
import { invoke } from "@tauri-apps/api/tauri"
import { useLocalStorage } from '@vueuse/core'
const serialConfig = useLocalStorage('serialConfig', { port: '', baud: 9600, open: false })
const currentPage = ref(2); const currentPage = ref(2);
const setCurrentPage = (x) => { const setCurrentPage = (x) => {
currentPage.value = x; currentPage.value = x;
} }
onMounted(async () => {
await invoke('close_port', { portName: serialConfig.value.port, baud: serialConfig.value.baud });
serialConfig.value.open = false;
await listen('port-state', (event) => {
serialConfig.value.open = event.payload.open
});
await listen('button-on', async () => {
const audioContainer = document.getElementById("audioContainer");
await audioContainer.play();
});
})
</script> </script>

Binary file not shown.

View File

@ -0,0 +1,31 @@
<template>
<div class="text-white flex justify-center w-full bg-neutral-800 py-3">
<span class="font-bold">PORT {{serialConfig.port}} is
<span v-if="serialConfig.open" class="text-green-500 hover:cursor-pointer" @click="closePort">OPEN</span>
<span v-else class="text-red-600 hover:cursor-pointer" @click="openPort">CLOSED</span>
</span>
</div>
</template>
<script setup>
import { useLocalStorage } from '@vueuse/core'
import { invoke } from "@tauri-apps/api/tauri"
const serialConfig = useLocalStorage('serialConfig', { port: '', baud: 9600, open: false })
const openPort = () => {
try {
invoke('open_port', { portName: serialConfig.value.port, baud: serialConfig.value.baud });
} catch (err) {
console.error(err);
}
}
const closePort = async () => {
try {
await invoke('close_port', { portName: serialConfig.value.port, baud: serialConfig.value.baud });
} catch (err) {
console.error(err);
}
}
</script>

View File

@ -2,7 +2,7 @@
<h1 class="text-white text-2xl w-full font-bold text-center my-24">Frankenstein Test</h1> <h1 class="text-white text-2xl w-full font-bold text-center my-24">Frankenstein Test</h1>
<div class="flex w-full justify-center gap-10"> <div class="flex w-full justify-center gap-10">
<div class="bg-neutral-800 rounded-2xl p-5 h-min"> <div class="bg-neutral-800 rounded-2xl p-5 h-min">
<h2 class="text-white font-bold text-lg text-center my-5">LED Strip Monster</h2> <h2 class="text-white font-bold text-lg text-center mb-5">LED Strip Monster</h2>
<div class="flex flex-col items-center"> <div class="flex flex-col items-center">
<color-input disable-alpha v-model="color" /> <color-input disable-alpha v-model="color" />
<div class="space-x-3"> <div class="space-x-3">
@ -15,25 +15,46 @@
</div> </div>
</div> </div>
</div> </div>
<div class="bg-neutral-800 rounded-2xl p-5"> <div class="bg-neutral-800 rounded-2xl p-5 h-min">
<h2 class="text-white font-bold text-lg text-center my-5">LED Strip Hallway</h2> <h2 class="text-white font-bold text-lg text-center mb-5">LED Strip Hallway</h2>
<div class="flex flex-col items-center"> <div class="flex flex-col items-center">
<input v-model="brightness" type="range" min="0" max="100" class="w-40"> <input v-model="brightness" type="range" min="0" max="100" class="w-40">
<label class="text-white mt-2">BRIGHTNESS: {{ brightness }}% </label> <label class="text-white mt-2">BRIGHTNESS: {{ brightness }}% </label>
<button @click="submitBrightness" class="px-5 py-2 bg-sky-400 w-full rounded my-5"> <button @click="submitBrightness" class="px-5 py-2 bg-sky-400 w-full rounded mt-4">
Submit Submit
</button> </button>
</div> </div>
</div> </div>
<div class="bg-neutral-800 rounded-2xl p-5">
<h2 class="text-white font-bold text-lg text-center mb-5">LED Strip Electrons</h2>
<div class="flex flex-col items-center">
<color-input disable-alpha v-model="pixel.color" />
<div class="flex items-center mt-4">
<label class="text-white mr-2">Pixel: </label>
<input v-model="pixel.pixel" type="number" min="0" max="182" class="w-40">
</div>
<button @click="submitPixel" class="px-5 py-2 bg-sky-400 w-full rounded my-5">
Submit Color
</button>
<button @click="useLedTest(pixel.color.r, pixel.color.g, pixel.color.b)" class="px-5 py-2 bg-sky-400 w-full rounded mb-5">
Test
</button>
<button @click="resetStrip" class="px-5 py-2 bg-red-700 w-full rounded">
Turn Off
</button>
</div>
</div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref } from "vue" import { ref } from "vue"
import { useSerial } from "../composables/useSerial" import { useSerial } from "../composables/useSerial"
import { useLedTest } from "../composables/useAnimations"
const color = ref({ r: 0, g: 128, b: 255, a: 1}); const color = ref({ r: 0, g: 128, b: 255, a: 1});
const brightness = ref(100); const brightness = ref(100);
const pixel = ref({ color: { r: 64, g: 255, b: 255, a: 1 }, pixel: 0 });
const submitColor = () => { const submitColor = () => {
useSerial("SET_STRIP_COLOR:" + `${color.value.r},${color.value.g},${color.value.b}`); useSerial("SET_STRIP_COLOR:" + `${color.value.r},${color.value.g},${color.value.b}`);
@ -42,6 +63,14 @@ const submitColor = () => {
const submitBrightness = () => { const submitBrightness = () => {
useSerial("SET_LIGHT:" + brightness.value * 2.55); useSerial("SET_LIGHT:" + brightness.value * 2.55);
} }
const submitPixel = () => {
useSerial("SET_LED:" + `${pixel.value.pixel},${pixel.value.color.r},${pixel.value.color.g},${pixel.value.color.b}`);
}
const resetStrip = () => {
useSerial("SET_LED_OFF");
}
</script> </script>
<style> <style>

View File

@ -8,11 +8,10 @@
<label class="text-white mr-2">BAUD</label> <label class="text-white mr-2">BAUD</label>
<input type="number" v-model="serialConfig.baud"> <input type="number" v-model="serialConfig.baud">
</div> </div>
<span class="text-white mt-3">Available ports</span> <span class="text-white mt-3 font-bold">Available ports:</span>
<span v-for="port in ports" class="text-white hover:cursor-pointer" @click="serialConfig.port = port"> <span v-for="port in ports" class="text-white hover:cursor-pointer bg-neutral-900 rounded w-full px-3 py-1 hover:bg-opacity-50" @click="serialConfig.port = port">
{{ port }} {{ port }}
</span> </span>
<button @click="readSerial">READ</button>
</div> </div>
</div> </div>
</template> </template>
@ -24,7 +23,7 @@ import { useLocalStorage } from '@vueuse/core'
const ports = ref([]) const ports = ref([])
const serialConfig = useLocalStorage('serialConfig', { port: '', baud: 9600 }) const serialConfig = useLocalStorage('serialConfig', { port: '', baud: 9600, open: false })
const getSerialPorts = async () => { const getSerialPorts = async () => {
return await invoke('get_serial_ports'); return await invoke('get_serial_ports');
@ -32,11 +31,5 @@ const getSerialPorts = async () => {
onMounted(async () => { onMounted(async () => {
ports.value = await getSerialPorts() ports.value = await getSerialPorts()
invoke('open_port');
}) })
const readSerial = async () => {
return await invoke('read_serial', { portName: "/dev/ttyUSB0" });
}
</script> </script>

View File

@ -0,0 +1,12 @@
import { useSerial } from "./useSerial"
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export async function useLedTest(r, g, b) {
for (let i = 0; i < 182; i++) {
useSerial("SET_LED:" + `${i},${r},${g},${b}`);
await sleep(20);
}
}

View File

@ -1,9 +1,14 @@
import { invoke } from "@tauri-apps/api/tauri" import { invoke } from "@tauri-apps/api/tauri"
import { message } from '@tauri-apps/api/dialog';
import { useLocalStorage } from '@vueuse/core' import { useLocalStorage } from '@vueuse/core'
const serialConfig = useLocalStorage('serialConfig', { port: '', baud: 9600 }) const serialConfig = useLocalStorage('serialConfig', { port: '', baud: 9600 })
export function useSerial(input) { export async function useSerial(input) {
console.log(serialConfig.value) try {
invoke('write_serial', { input: input + ";", portName: serialConfig.value.port, baud: serialConfig.value.baud }); await invoke('write_serial', { input: input + ";", portName: serialConfig.value.port, baud: serialConfig.value.baud });
} catch (err) {
console.error(err);
await message(err, { title: 'Error while writing serial', type: 'error' });
}
} }