Compare commits
No commits in common. "800c0d3fc4c4cd9a61c8495c5e690bc089b97442" and "9b863508e484f5e257c873106778312b83e0368e" have entirely different histories.
800c0d3fc4
...
9b863508e4
307
src-tauri/Cargo.lock
generated
307
src-tauri/Cargo.lock
generated
@ -14,7 +14,7 @@ version = "0.7.20"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -23,7 +23,7 @@ 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 = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
|
checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -157,7 +157,7 @@ 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 = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09"
|
checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
|
checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -373,16 +373,10 @@ version = "0.9.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation-sys 0.8.4",
|
"core-foundation-sys",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation-sys"
|
|
||||||
version = "0.6.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation-sys"
|
name = "core-foundation-sys"
|
||||||
version = "0.8.4"
|
version = "0.8.4"
|
||||||
@ -577,72 +571,6 @@ dependencies = [
|
|||||||
"syn 2.0.15",
|
"syn 2.0.15",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ddc"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ba69f2c53e320fc4abad17cb02bbbf04d1a36f18e9907f347589ec5991b3c6c5"
|
|
||||||
dependencies = [
|
|
||||||
"mccs",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ddc-hi"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9c6747b17c926a2aa34739b30f1a6cc726e3a7baf0e2f69a4c03a95cf5de94de"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"ddc",
|
|
||||||
"ddc-i2c",
|
|
||||||
"ddc-macos",
|
|
||||||
"ddc-winapi",
|
|
||||||
"edid",
|
|
||||||
"log",
|
|
||||||
"mccs",
|
|
||||||
"mccs-caps",
|
|
||||||
"mccs-db",
|
|
||||||
"nvapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ddc-i2c"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1ef18fac9fd5c11d0c7b85a80887b01f7361b49edb2b4627243928b90ce2691b"
|
|
||||||
dependencies = [
|
|
||||||
"ddc",
|
|
||||||
"i2c",
|
|
||||||
"i2c-linux",
|
|
||||||
"resize-slice",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ddc-macos"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5cbaf316c113cfc30da8856c8104dfb4168b73fdd78562d1542e358fe8299dea"
|
|
||||||
dependencies = [
|
|
||||||
"core-foundation",
|
|
||||||
"core-foundation-sys 0.8.4",
|
|
||||||
"core-graphics",
|
|
||||||
"ddc",
|
|
||||||
"io-kit-sys",
|
|
||||||
"mach 0.3.2",
|
|
||||||
"thiserror",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ddc-winapi"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "015df0d6d814ea948e012977760324da6d103ec8d67c971c75a6daa3b4fc943f"
|
|
||||||
dependencies = [
|
|
||||||
"ddc",
|
|
||||||
"widestring",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_more"
|
name = "derive_more"
|
||||||
version = "0.99.17"
|
version = "0.99.17"
|
||||||
@ -728,15 +656,6 @@ 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 = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b"
|
checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "edid"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "24ce75530893d834dcfe3bb67ce0e7dec489484e7cb4423ca31618af4bab24fe"
|
|
||||||
dependencies = [
|
|
||||||
"nom",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.8.1"
|
version = "1.8.1"
|
||||||
@ -1002,7 +921,7 @@ dependencies = [
|
|||||||
"futures-macro",
|
"futures-macro",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-task",
|
"futures-task",
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"pin-utils",
|
"pin-utils",
|
||||||
"slab",
|
"slab",
|
||||||
@ -1373,39 +1292,6 @@ version = "2.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "i2c"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "60c7b7bdd7b3a985fdcf94a0d7d98e7a47fde8b7f22fb55ce1a91cc104a2ce9a"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "i2c-linux"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c0268a871aaa071221d6c2875ebedcf64710e59b0d87c68c8faf5e98b87dd2a4"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"i2c",
|
|
||||||
"i2c-linux-sys",
|
|
||||||
"resize-slice",
|
|
||||||
"udev",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "i2c-linux-sys"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "55cd060ed0016621d3da4ed3a23b0158084de90d1f3a8e59f3d391aacd3bbcf8"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"byteorder",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iana-time-zone"
|
name = "iana-time-zone"
|
||||||
version = "0.1.56"
|
version = "0.1.56"
|
||||||
@ -1413,7 +1299,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c"
|
checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android_system_properties",
|
"android_system_properties",
|
||||||
"core-foundation-sys 0.8.4",
|
"core-foundation-sys",
|
||||||
"iana-time-zone-haiku",
|
"iana-time-zone-haiku",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@ -1476,7 +1362,7 @@ dependencies = [
|
|||||||
"globset",
|
"globset",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
"regex",
|
"regex",
|
||||||
"same-file",
|
"same-file",
|
||||||
"thread_local",
|
"thread_local",
|
||||||
@ -1526,16 +1412,6 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "io-kit-sys"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f21dcc74995dd4cd090b147e79789f8d65959cbfb5f0b118002db869ea3bd0a0"
|
|
||||||
dependencies = [
|
|
||||||
"core-foundation-sys 0.6.2",
|
|
||||||
"mach 0.2.3",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "io-lifetimes"
|
name = "io-lifetimes"
|
||||||
version = "1.0.10"
|
version = "1.0.10"
|
||||||
@ -1679,16 +1555,6 @@ version = "0.2.142"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317"
|
checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317"
|
||||||
|
|
||||||
[[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]]
|
[[package]]
|
||||||
name = "line-wrap"
|
name = "line-wrap"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
@ -1707,12 +1573,6 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "linked-hash-map"
|
|
||||||
version = "0.5.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.3.7"
|
version = "0.3.7"
|
||||||
@ -1759,24 +1619,6 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
|
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mach"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[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"
|
||||||
@ -1815,38 +1657,6 @@ version = "0.1.10"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
|
checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mccs"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6090d6b3ded42fed158b660a6b9cdaa1924f3eef6c6598e82a9ca9b70a1988cd"
|
|
||||||
dependencies = [
|
|
||||||
"void",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mccs-caps"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8eb961d01a3bb07969cfa276be2ab88c31d0fefa77a872696832732d6e9ec094"
|
|
||||||
dependencies = [
|
|
||||||
"mccs",
|
|
||||||
"nom",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mccs-db"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3cdaa8fe19a1a1918becc1b8cbbbdc1058bc71411dff4de0a6ec6b5269f49d38"
|
|
||||||
dependencies = [
|
|
||||||
"mccs",
|
|
||||||
"nom",
|
|
||||||
"serde",
|
|
||||||
"serde_derive",
|
|
||||||
"serde_yaml",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mdns-sd"
|
name = "mdns-sd"
|
||||||
version = "0.7.3"
|
version = "0.7.3"
|
||||||
@ -1860,15 +1670,6 @@ dependencies = [
|
|||||||
"socket2",
|
"socket2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memchr"
|
|
||||||
version = "1.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
@ -1946,15 +1747,6 @@ 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 = "3.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b"
|
|
||||||
dependencies = [
|
|
||||||
"memchr 1.0.2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nu-ansi-term"
|
name = "nu-ansi-term"
|
||||||
version = "0.46.0"
|
version = "0.46.0"
|
||||||
@ -2026,28 +1818,6 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nvapi"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7c63de8cd8362e2c38d1a48dea6ae68e6293a8d8d22a52180d0f8dcc779b3158"
|
|
||||||
dependencies = [
|
|
||||||
"i2c",
|
|
||||||
"log",
|
|
||||||
"nvapi-sys",
|
|
||||||
"void",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nvapi-sys"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b29e9a9393c69ee856bfcf5f76ed1ef32d2c0dd6f58558fd43334278fc1e7ea7"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc"
|
name = "objc"
|
||||||
version = "0.2.7"
|
version = "0.2.7"
|
||||||
@ -2454,7 +2224,7 @@ version = "0.28.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1"
|
checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2589,7 +2359,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
|
checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick 1.0.1",
|
"aho-corasick 1.0.1",
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
"regex-syntax 0.7.1",
|
"regex-syntax 0.7.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2614,15 +2384,6 @@ version = "0.7.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c"
|
checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "resize-slice"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8a3cb2f74a9891e76958b9e0ccd269a25b466c3ae3bb3efd71db157248308c4a"
|
|
||||||
dependencies = [
|
|
||||||
"uninitialized",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rustc_version"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@ -2799,18 +2560,6 @@ dependencies = [
|
|||||||
"syn 2.0.15",
|
"syn 2.0.15",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_yaml"
|
|
||||||
version = "0.7.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ef8099d3df28273c99a1728190c7a9f19d444c941044f64adf986bee7ec53051"
|
|
||||||
dependencies = [
|
|
||||||
"dtoa",
|
|
||||||
"linked-hash-map",
|
|
||||||
"serde",
|
|
||||||
"yaml-rust",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serialize-to-javascript"
|
name = "serialize-to-javascript"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
@ -3265,7 +3014,7 @@ dependencies = [
|
|||||||
"infer",
|
"infer",
|
||||||
"json-patch 1.0.0",
|
"json-patch 1.0.0",
|
||||||
"kuchiki",
|
"kuchiki",
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
"phf 0.10.1",
|
"phf 0.10.1",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -3330,7 +3079,6 @@ dependencies = [
|
|||||||
"color_space",
|
"color_space",
|
||||||
"core-foundation",
|
"core-foundation",
|
||||||
"core-graphics",
|
"core-graphics",
|
||||||
"ddc-hi",
|
|
||||||
"display-info",
|
"display-info",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"futures",
|
"futures",
|
||||||
@ -3600,16 +3348,6 @@ version = "1.16.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "udev"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "47504d1a49b2ea1b133e7ddd1d9f0a83cf03feb9b440c2c470d06db4589cf301"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"libudev-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-bidi"
|
name = "unicode-bidi"
|
||||||
version = "0.3.13"
|
version = "0.3.13"
|
||||||
@ -3643,12 +3381,6 @@ version = "0.1.10"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "uninitialized"
|
|
||||||
version = "0.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "74c1aa4511c38276c548406f0b1f5f8b793f000cfb51e18f278a102abd057e81"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "2.3.1"
|
version = "2.3.1"
|
||||||
@ -3721,12 +3453,6 @@ version = "0.9.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "void"
|
|
||||||
version = "1.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vswhom"
|
name = "vswhom"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -4192,7 +3918,7 @@ version = "0.4.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28"
|
checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr 2.5.0",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4283,12 +4009,3 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "yaml-rust"
|
|
||||||
version = "0.4.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
|
|
||||||
dependencies = [
|
|
||||||
"linked-hash-map",
|
|
||||||
]
|
|
||||||
|
@ -35,7 +35,6 @@ core-foundation = "0.9.3"
|
|||||||
tokio-stream = "0.1.14"
|
tokio-stream = "0.1.14"
|
||||||
mdns-sd = "0.7.2"
|
mdns-sd = "0.7.2"
|
||||||
futures = "0.3.28"
|
futures = "0.3.28"
|
||||||
ddc-hi = "0.4.1"
|
|
||||||
|
|
||||||
[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
|
||||||
|
@ -3,7 +3,8 @@ use std::time::SystemTime;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Copy, Serialize, Deserialize, Debug)]
|
#[derive(Clone, Copy, Serialize, Deserialize, Debug)]
|
||||||
pub struct DisplayState {
|
pub struct DisplayConfig {
|
||||||
|
pub id: usize,
|
||||||
pub brightness: u16,
|
pub brightness: u16,
|
||||||
pub max_brightness: u16,
|
pub max_brightness: u16,
|
||||||
pub min_brightness: u16,
|
pub min_brightness: u16,
|
||||||
@ -16,9 +17,10 @@ pub struct DisplayState {
|
|||||||
pub last_modified_at: SystemTime,
|
pub last_modified_at: SystemTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DisplayState {
|
impl DisplayConfig {
|
||||||
pub fn default() -> Self {
|
pub fn default(index: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
id: index,
|
||||||
brightness: 30,
|
brightness: 30,
|
||||||
contrast: 50,
|
contrast: 50,
|
||||||
mode: 0,
|
mode: 0,
|
@ -6,205 +6,182 @@ use std::{
|
|||||||
time::{Duration, SystemTime},
|
time::{Duration, SystemTime},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use base64::Config;
|
||||||
use ddc_hi::Display;
|
use ddc_hi::Display;
|
||||||
use paris::{error, info, warn};
|
use paris::{error, info, warn};
|
||||||
use tokio::sync::{OnceCell, OwnedMutexGuard, RwLock};
|
use tauri::async_runtime::Mutex;
|
||||||
|
use tokio::sync::{broadcast, OwnedMutexGuard};
|
||||||
|
use tracing::warn;
|
||||||
|
|
||||||
use super::display_state::DisplayState;
|
use crate::{display::Brightness, models, rpc};
|
||||||
|
|
||||||
|
use super::{display_config::DisplayConfig, DisplayBrightness};
|
||||||
use ddc_hi::Ddc;
|
use ddc_hi::Ddc;
|
||||||
|
|
||||||
pub struct DisplayHandler {
|
pub struct Manager {
|
||||||
pub state: Arc<RwLock<DisplayState>>,
|
displays: Arc<Mutex<HashMap<usize, Arc<Mutex<DisplayConfig>>>>>,
|
||||||
pub controller: Arc<RwLock<Display>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct DisplayManager {
|
impl Manager {
|
||||||
displays: Arc<RwLock<Vec<Arc<RwLock<DisplayHandler>>>>>,
|
pub fn global() -> &'static Self {
|
||||||
|
static DISPLAY_MANAGER: once_cell::sync::OnceCell<Manager> =
|
||||||
|
once_cell::sync::OnceCell::new();
|
||||||
|
|
||||||
|
DISPLAY_MANAGER.get_or_init(|| Self::create())
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DisplayManager {
|
pub fn create() -> Self {
|
||||||
pub async fn global() -> &'static Self {
|
|
||||||
static DISPLAY_MANAGER: OnceCell<DisplayManager> = OnceCell::const_new();
|
|
||||||
|
|
||||||
DISPLAY_MANAGER.get_or_init(|| Self::create()).await
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn create() -> Self {
|
|
||||||
let instance = Self {
|
let instance = Self {
|
||||||
displays: Arc::new(RwLock::new(Vec::new())),
|
displays: Arc::new(Mutex::new(HashMap::new())),
|
||||||
};
|
};
|
||||||
instance.fetch_displays().await;
|
|
||||||
instance
|
instance
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn fetch_displays(&self) {
|
pub async fn subscribe_display_brightness(&self) {
|
||||||
let mut displays = self.displays.write().await;
|
let rpc = rpc::Manager::global().await;
|
||||||
displays.clear();
|
|
||||||
|
|
||||||
let controllers = Display::enumerate();
|
let mut rx = rpc.client().subscribe_change_display_brightness_rx();
|
||||||
|
|
||||||
for display in controllers {
|
loop {
|
||||||
let controller = Arc::new(RwLock::new(display));
|
if let Ok(display_brightness) = rx.recv().await {
|
||||||
let state = Arc::new(RwLock::new(DisplayState::default()));
|
if let Err(err) = self.set_display_brightness(display_brightness).await {
|
||||||
displays.push(Arc::new(RwLock::new(DisplayHandler { controller, state })));
|
error!("set_display_brightness failed. {:?}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_displays(&self) -> Vec<DisplayState> {
|
fn read_display_config_by_ddc(index: usize) -> anyhow::Result<DisplayConfig> {
|
||||||
let displays = self.displays.read().await;
|
let mut displays = Display::enumerate();
|
||||||
let mut states = Vec::new();
|
match displays.get_mut(index) {
|
||||||
for display in displays.iter() {
|
Some(display) => {
|
||||||
let state = display.read().await.state.read().await.clone();
|
let mut config = DisplayConfig::default(index);
|
||||||
states.push(state);
|
match display.handle.get_vcp_feature(0x10) {
|
||||||
|
Ok(value) => {
|
||||||
|
config.max_brightness = value.maximum();
|
||||||
|
config.min_brightness = 0;
|
||||||
|
config.brightness = value.value();
|
||||||
|
}
|
||||||
|
Err(_) => {}
|
||||||
|
};
|
||||||
|
match display.handle.get_vcp_feature(0x12) {
|
||||||
|
Ok(value) => {
|
||||||
|
config.max_contrast = value.maximum();
|
||||||
|
config.min_contrast = 0;
|
||||||
|
config.contrast = value.value();
|
||||||
|
}
|
||||||
|
Err(_) => {}
|
||||||
|
};
|
||||||
|
match display.handle.get_vcp_feature(0xdc) {
|
||||||
|
Ok(value) => {
|
||||||
|
config.max_mode = value.maximum();
|
||||||
|
config.min_mode = 0;
|
||||||
|
config.mode = value.value();
|
||||||
|
}
|
||||||
|
Err(_) => {}
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(config)
|
||||||
|
}
|
||||||
|
None => anyhow::bail!("display#{} is missed.", index),
|
||||||
}
|
}
|
||||||
states
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub async fn subscribe_display_brightness(&self) {
|
async fn get_display(&self, index: usize) -> anyhow::Result<OwnedMutexGuard<DisplayConfig>> {
|
||||||
// let rpc = rpc::Manager::global().await;
|
let mut displays = self.displays.lock().await;
|
||||||
|
match displays.get_mut(&index) {
|
||||||
// let mut rx = rpc.client().subscribe_change_display_brightness_rx();
|
Some(config) => {
|
||||||
|
let mut config = config.to_owned().lock_owned().await;
|
||||||
// loop {
|
if config.last_modified_at > SystemTime::now().sub(Duration::from_secs(10)) {
|
||||||
// if let Ok(display_brightness) = rx.recv().await {
|
info!("cached");
|
||||||
// if let Err(err) = self.set_display_brightness(display_brightness).await {
|
return Ok(config);
|
||||||
// error!("set_display_brightness failed. {:?}", err);
|
}
|
||||||
// }
|
return match Self::read_display_config_by_ddc(index) {
|
||||||
// }
|
Ok(config) => {
|
||||||
// }
|
let id = config.id;
|
||||||
// }
|
let value = Arc::new(Mutex::new(config));
|
||||||
|
let valueGuard = value.clone().lock_owned().await;
|
||||||
// fn read_display_config_by_ddc(index: usize) -> anyhow::Result<DisplayState> {
|
displays.insert(id, value);
|
||||||
// let mut displays = Display::enumerate();
|
info!("read form ddc");
|
||||||
// match displays.get_mut(index) {
|
Ok(valueGuard)
|
||||||
// Some(display) => {
|
}
|
||||||
// let mut config = DisplayState::default(index);
|
Err(err) => {
|
||||||
// match display.handle.get_vcp_feature(0x10) {
|
warn!(
|
||||||
// Ok(value) => {
|
"can not read config from display by ddc, use CACHED value. {:?}",
|
||||||
// config.max_brightness = value.maximum();
|
err
|
||||||
// config.min_brightness = 0;
|
);
|
||||||
// config.brightness = value.value();
|
config.last_modified_at = SystemTime::now();
|
||||||
// }
|
Ok(config)
|
||||||
// Err(_) => {}
|
}
|
||||||
// };
|
};
|
||||||
// match display.handle.get_vcp_feature(0x12) {
|
}
|
||||||
// Ok(value) => {
|
None => {
|
||||||
// config.max_contrast = value.maximum();
|
let config = Self::read_display_config_by_ddc(index).map_err(|err| {
|
||||||
// config.min_contrast = 0;
|
anyhow::anyhow!(
|
||||||
// config.contrast = value.value();
|
"can not read config from display by ddc,use DEFAULT value. {:?}",
|
||||||
// }
|
err
|
||||||
// Err(_) => {}
|
)
|
||||||
// };
|
})?;
|
||||||
// match display.handle.get_vcp_feature(0xdc) {
|
let id = config.id;
|
||||||
// Ok(value) => {
|
let value = Arc::new(Mutex::new(config));
|
||||||
// config.max_mode = value.maximum();
|
let valueGuard = value.clone().lock_owned().await;
|
||||||
// config.min_mode = 0;
|
displays.insert(id, value);
|
||||||
// config.mode = value.value();
|
Ok(valueGuard)
|
||||||
// }
|
}
|
||||||
// Err(_) => {}
|
}
|
||||||
// };
|
}
|
||||||
|
|
||||||
// Ok(config)
|
pub async fn set_display_brightness(
|
||||||
// }
|
&self,
|
||||||
// None => anyhow::bail!("display#{} is missed.", index),
|
display_brightness: DisplayBrightness,
|
||||||
// }
|
) -> anyhow::Result<()> {
|
||||||
// }
|
match Display::enumerate().get_mut(display_brightness.display_index) {
|
||||||
|
Some(display) => {
|
||||||
// async fn get_display(&self, index: usize) -> anyhow::Result<OwnedMutexGuard<DisplayState>> {
|
match self.get_display(display_brightness.display_index).await {
|
||||||
// let mut displays = self.displays.lock().await;
|
Ok(mut config) => {
|
||||||
// match displays.get_mut(&index) {
|
let curr = config.brightness;
|
||||||
// Some(config) => {
|
info!("curr_brightness: {:?}", curr);
|
||||||
// let mut config = config.to_owned().lock_owned().await;
|
let mut target = match display_brightness.brightness {
|
||||||
// if config.last_modified_at > SystemTime::now().sub(Duration::from_secs(10)) {
|
Brightness::Relative(v) => curr.wrapping_add_signed(v),
|
||||||
// info!("cached");
|
Brightness::Absolute(v) => v,
|
||||||
// return Ok(config);
|
};
|
||||||
// }
|
if target.gt(&config.max_brightness) {
|
||||||
// return match Self::read_display_config_by_ddc(index) {
|
target = config.max_brightness;
|
||||||
// Ok(config) => {
|
} else if target.lt(&config.min_brightness) {
|
||||||
// let id = config.id;
|
target = config.min_brightness;
|
||||||
// let value = Arc::new(Mutex::new(config));
|
}
|
||||||
// let valueGuard = value.clone().lock_owned().await;
|
config.brightness = target;
|
||||||
// displays.insert(id, value);
|
display
|
||||||
// info!("read form ddc");
|
.handle
|
||||||
// Ok(valueGuard)
|
.set_vcp_feature(0x10, target as u16)
|
||||||
// }
|
.map_err(|err| anyhow::anyhow!("can not set brightness. {:?}", err))?;
|
||||||
// Err(err) => {
|
|
||||||
// warn!(
|
let rpc = rpc::Manager::global().await;
|
||||||
// "can not read config from display by ddc, use CACHED value. {:?}",
|
|
||||||
// err
|
rpc.publish_desktop_cmd(
|
||||||
// );
|
format!("display{}/brightness", display_brightness.display_index)
|
||||||
// config.last_modified_at = SystemTime::now();
|
.as_str(),
|
||||||
// Ok(config)
|
target.to_be_bytes().to_vec(),
|
||||||
// }
|
)
|
||||||
// };
|
.await;
|
||||||
// }
|
}
|
||||||
// None => {
|
Err(err) => {
|
||||||
// let config = Self::read_display_config_by_ddc(index).map_err(|err| {
|
info!(
|
||||||
// anyhow::anyhow!(
|
"can not get display#{} brightness. {:?}",
|
||||||
// "can not read config from display by ddc,use DEFAULT value. {:?}",
|
display_brightness.display_index, err
|
||||||
// err
|
);
|
||||||
// )
|
if let Brightness::Absolute(v) = display_brightness.brightness {
|
||||||
// })?;
|
display.handle.set_vcp_feature(0x10, v).map_err(|err| {
|
||||||
// let id = config.id;
|
anyhow::anyhow!("can not set brightness. {:?}", err)
|
||||||
// let value = Arc::new(Mutex::new(config));
|
})?;
|
||||||
// let valueGuard = value.clone().lock_owned().await;
|
};
|
||||||
// displays.insert(id, value);
|
}
|
||||||
// Ok(valueGuard)
|
};
|
||||||
// }
|
}
|
||||||
// }
|
None => {
|
||||||
// }
|
warn!("display#{} is not found.", display_brightness.display_index);
|
||||||
|
}
|
||||||
// pub async fn set_display_brightness(
|
}
|
||||||
// &self,
|
Ok(())
|
||||||
// display_brightness: DisplayBrightness,
|
}
|
||||||
// ) -> anyhow::Result<()> {
|
|
||||||
// match Display::enumerate().get_mut(display_brightness.display_index) {
|
|
||||||
// Some(display) => {
|
|
||||||
// match self.get_display(display_brightness.display_index).await {
|
|
||||||
// Ok(mut config) => {
|
|
||||||
// let curr = config.brightness;
|
|
||||||
// info!("curr_brightness: {:?}", curr);
|
|
||||||
// let mut target = match display_brightness.brightness {
|
|
||||||
// Brightness::Relative(v) => curr.wrapping_add_signed(v),
|
|
||||||
// Brightness::Absolute(v) => v,
|
|
||||||
// };
|
|
||||||
// if target.gt(&config.max_brightness) {
|
|
||||||
// target = config.max_brightness;
|
|
||||||
// } else if target.lt(&config.min_brightness) {
|
|
||||||
// target = config.min_brightness;
|
|
||||||
// }
|
|
||||||
// config.brightness = target;
|
|
||||||
// display
|
|
||||||
// .handle
|
|
||||||
// .set_vcp_feature(0x10, target as u16)
|
|
||||||
// .map_err(|err| anyhow::anyhow!("can not set brightness. {:?}", err))?;
|
|
||||||
|
|
||||||
// let rpc = rpc::Manager::global().await;
|
|
||||||
|
|
||||||
// rpc.publish_desktop_cmd(
|
|
||||||
// format!("display{}/brightness", display_brightness.display_index)
|
|
||||||
// .as_str(),
|
|
||||||
// target.to_be_bytes().to_vec(),
|
|
||||||
// )
|
|
||||||
// .await;
|
|
||||||
// }
|
|
||||||
// Err(err) => {
|
|
||||||
// info!(
|
|
||||||
// "can not get display#{} brightness. {:?}",
|
|
||||||
// display_brightness.display_index, err
|
|
||||||
// );
|
|
||||||
// if let Brightness::Absolute(v) = display_brightness.brightness {
|
|
||||||
// display.handle.set_vcp_feature(0x10, v).map_err(|err| {
|
|
||||||
// anyhow::anyhow!("can not set brightness. {:?}", err)
|
|
||||||
// })?;
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
// None => {
|
|
||||||
// warn!("display#{} is not found.", display_brightness.display_index);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// Ok(())
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
// mod brightness;
|
// mod brightness;
|
||||||
// mod manager;
|
// mod manager;
|
||||||
mod display_state;
|
mod display_config;
|
||||||
mod manager;
|
|
||||||
|
|
||||||
pub use display_state::*;
|
pub use display_config::*;
|
||||||
|
|
||||||
// pub use brightness::*;
|
// pub use brightness::*;
|
||||||
pub use manager::*;
|
// pub use manager::*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ pub mod screenshot;
|
|||||||
mod screenshot_manager;
|
mod screenshot_manager;
|
||||||
|
|
||||||
use ambient_light::{Border, ColorCalibration, LedStripConfig, LedStripConfigGroup};
|
use ambient_light::{Border, ColorCalibration, LedStripConfig, LedStripConfigGroup};
|
||||||
use display::{DisplayManager, DisplayState};
|
|
||||||
use display_info::DisplayInfo;
|
use display_info::DisplayInfo;
|
||||||
use paris::{error, info, warn};
|
use paris::{error, info, warn};
|
||||||
use rpc::{BoardInfo, MqttRpc, UdpRpc};
|
use rpc::{BoardInfo, MqttRpc, UdpRpc};
|
||||||
@ -204,13 +203,6 @@ async fn get_boards() -> Result<Vec<BoardInfo>, String> {
|
|||||||
Ok(boards)
|
Ok(boards)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
async fn get_displays() -> Vec<DisplayState> {
|
|
||||||
let display_manager = DisplayManager::global().await;
|
|
||||||
|
|
||||||
display_manager.get_displays().await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
@ -238,7 +230,6 @@ async fn main() {
|
|||||||
set_color_calibration,
|
set_color_calibration,
|
||||||
read_config,
|
read_config,
|
||||||
get_boards,
|
get_boards,
|
||||||
get_displays
|
|
||||||
])
|
])
|
||||||
.register_uri_scheme_protocol("ambient-light", move |_app, request| {
|
.register_uri_scheme_protocol("ambient-light", move |_app, request| {
|
||||||
let response = ResponseBuilder::new().header("Access-Control-Allow-Origin", "*");
|
let response = ResponseBuilder::new().header("Access-Control-Allow-Origin", "*");
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
use std::{sync::Arc, time::Duration};
|
use std::time::Duration;
|
||||||
|
|
||||||
use paris::{info, warn, error};
|
use paris::{info, warn};
|
||||||
use tokio::{net::UdpSocket, sync::RwLock, time::timeout, io};
|
use tokio::{net::UdpSocket, sync::RwLock, time::timeout};
|
||||||
|
|
||||||
use super::{BoardConnectStatus, BoardInfo};
|
use super::{BoardConnectStatus, BoardInfo};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Board {
|
pub struct Board {
|
||||||
pub info: Arc<RwLock<BoardInfo>>,
|
pub info: RwLock<BoardInfo>,
|
||||||
socket: Option<Arc<UdpSocket>>,
|
socket: Option<UdpSocket>,
|
||||||
listen_handler: Option<tokio::task::JoinHandle<()>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Board {
|
impl Board {
|
||||||
pub fn new(info: BoardInfo) -> Self {
|
pub fn new(info: BoardInfo) -> Self {
|
||||||
Self {
|
Self {
|
||||||
info: Arc::new(RwLock::new(info)),
|
info: RwLock::new(info),
|
||||||
socket: None,
|
socket: None,
|
||||||
listen_handler: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,33 +24,7 @@ impl Board {
|
|||||||
let socket = UdpSocket::bind("0.0.0.0:0").await?;
|
let socket = UdpSocket::bind("0.0.0.0:0").await?;
|
||||||
|
|
||||||
socket.connect((info.address, info.port)).await?;
|
socket.connect((info.address, info.port)).await?;
|
||||||
let socket = Arc::new(socket);
|
self.socket = Some(socket);
|
||||||
self.socket = Some(socket.clone());
|
|
||||||
|
|
||||||
let info = self.info.clone();
|
|
||||||
|
|
||||||
let handler=tokio::spawn(async move {
|
|
||||||
let mut buf = [0u8; 128];
|
|
||||||
if let Err(err) = socket.readable().await {
|
|
||||||
error!("socket read error: {:?}", err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
loop {
|
|
||||||
match socket.try_recv(&mut buf) {
|
|
||||||
Ok(len) => {
|
|
||||||
log::info!("recv: {:?}", &buf[..len]);
|
|
||||||
}
|
|
||||||
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
error!("socket recv error: {:?}", e);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
self.listen_handler = Some(handler);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -65,7 +37,10 @@ impl Board {
|
|||||||
|
|
||||||
let socket = self.socket.as_ref().unwrap();
|
let socket = self.socket.as_ref().unwrap();
|
||||||
|
|
||||||
socket.send(buf).await.unwrap();
|
socket
|
||||||
|
.send(buf)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn check(&self) -> anyhow::Result<()> {
|
pub async fn check(&self) -> anyhow::Result<()> {
|
||||||
@ -124,16 +99,3 @@ impl Board {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl Drop for Board {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
if let Some(handler) = self.listen_handler.take() {
|
|
||||||
info!("aborting listen handler");
|
|
||||||
tokio::task::block_in_place(move || {
|
|
||||||
handler.abort();
|
|
||||||
});
|
|
||||||
info!("listen handler aborted");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,7 +6,6 @@ import { invoke } from '@tauri-apps/api';
|
|||||||
import { setLedStripStore } from './stores/led-strip.store';
|
import { setLedStripStore } from './stores/led-strip.store';
|
||||||
import { LedStripConfigContainer } from './models/led-strip-config';
|
import { LedStripConfigContainer } from './models/led-strip-config';
|
||||||
import { InfoIndex } from './components/info/info-index';
|
import { InfoIndex } from './components/info/info-index';
|
||||||
import { DisplayStateIndex } from './components/displays/display-state-index';
|
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
@ -24,13 +23,11 @@ function App() {
|
|||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<a href="/info">基本信息</a>
|
<a href="/info">基本信息</a>
|
||||||
<a href="/displays">显示器信息</a>
|
|
||||||
<a href="/led-strips-configuration">灯条配置</a>
|
<a href="/led-strips-configuration">灯条配置</a>
|
||||||
<a href="/white-balance">白平衡</a>
|
<a href="/white-balance">白平衡</a>
|
||||||
</div>
|
</div>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/info" component={InfoIndex} />
|
<Route path="/info" component={InfoIndex} />
|
||||||
<Route path="/displays" component={DisplayStateIndex} />
|
|
||||||
<Route path="/led-strips-configuration" component={LedStripConfiguration} />
|
<Route path="/led-strips-configuration" component={LedStripConfiguration} />
|
||||||
<Route path="/white-balance" component={WhiteBalance} />
|
<Route path="/white-balance" component={WhiteBalance} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
import { Component, ParentComponent } from 'solid-js';
|
|
||||||
import { DisplayState } from '../../models/display-state.model';
|
|
||||||
|
|
||||||
type DisplayStateCardProps = {
|
|
||||||
state: DisplayState;
|
|
||||||
};
|
|
||||||
|
|
||||||
type ItemProps = {
|
|
||||||
label: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
const Item: ParentComponent<ItemProps> = (props) => {
|
|
||||||
return (
|
|
||||||
<dl class="flex">
|
|
||||||
<dt class="w-20">{props.label}</dt>
|
|
||||||
<dd class="flex-auto">{props.children}</dd>
|
|
||||||
</dl>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DisplayStateCard: Component<DisplayStateCardProps> = (props) => {
|
|
||||||
return (
|
|
||||||
<section class="p-2 rounded shadow">
|
|
||||||
<Item label="Brightness">{props.state.brightness}</Item>
|
|
||||||
<Item label="Max Brightness">{props.state.max_brightness}</Item>
|
|
||||||
<Item label="Min Brightness">{props.state.min_brightness}</Item>
|
|
||||||
<Item label="Contrast">{props.state.contrast}</Item>
|
|
||||||
<Item label="Max Contrast">{props.state.max_contrast}</Item>
|
|
||||||
<Item label="Min Contrast">{props.state.min_contrast}</Item>
|
|
||||||
<Item label="Max Mode">{props.state.max_mode}</Item>
|
|
||||||
<Item label="Min Mode">{props.state.min_mode}</Item>
|
|
||||||
<Item label="Mode">{props.state.mode}</Item>
|
|
||||||
<Item label="Last Modified At">{props.state.last_modified_at.toISOString()}</Item>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,52 +0,0 @@
|
|||||||
import { Component, For, createEffect, createSignal } from 'solid-js';
|
|
||||||
import { listen } from '@tauri-apps/api/event';
|
|
||||||
import debug from 'debug';
|
|
||||||
import { invoke } from '@tauri-apps/api';
|
|
||||||
import { DisplayState, RawDisplayState } from '../../models/display-state.model';
|
|
||||||
import { DisplayStateCard } from './display-state-card';
|
|
||||||
|
|
||||||
const logger = debug('app:components:displays:display-state-index');
|
|
||||||
|
|
||||||
export const DisplayStateIndex: Component = () => {
|
|
||||||
const [states, setStates] = createSignal<DisplayState[]>([]);
|
|
||||||
|
|
||||||
createEffect(() => {
|
|
||||||
const unlisten = listen<RawDisplayState[]>('displays_changed', (ev) => {
|
|
||||||
logger('displays_changed', ev);
|
|
||||||
setStates(
|
|
||||||
ev.payload.map((it) => ({
|
|
||||||
...it,
|
|
||||||
last_modified_at: new Date(it.last_modified_at.secs_since_epoch * 1000),
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
invoke<RawDisplayState[]>('get_displays').then((states) => {
|
|
||||||
logger('get_displays', states);
|
|
||||||
setStates(
|
|
||||||
states.map((it) => ({
|
|
||||||
...it,
|
|
||||||
last_modified_at: new Date(it.last_modified_at.secs_since_epoch * 1000),
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
unlisten.then((unlisten) => unlisten());
|
|
||||||
};
|
|
||||||
});
|
|
||||||
return (
|
|
||||||
<ol class="grid sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 p-2 gap-2">
|
|
||||||
<For each={states()}>
|
|
||||||
{(state, index) => (
|
|
||||||
<li class="bg-slate-50 text-gray-800 relative border-2 border-slate-50 hover:border-sky-300 focus:border-sky-300 transition">
|
|
||||||
<DisplayStateCard state={state} />
|
|
||||||
<span class="absolute left-2 -top-3 bg-sky-300 text-white px-1 py-0.5 text-xs rounded-sm font-mono">
|
|
||||||
#{index() + 1}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
)}
|
|
||||||
</For>
|
|
||||||
</ol>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,16 +0,0 @@
|
|||||||
export type DisplayState = {
|
|
||||||
brightness: number;
|
|
||||||
max_brightness: number;
|
|
||||||
min_brightness: number;
|
|
||||||
contrast: number;
|
|
||||||
max_contrast: number;
|
|
||||||
min_contrast: number;
|
|
||||||
mode: number;
|
|
||||||
max_mode: number;
|
|
||||||
min_mode: number;
|
|
||||||
last_modified_at: Date;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type RawDisplayState = DisplayState & {
|
|
||||||
last_modified_at: { secs_since_epoch: number };
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user