diff --git a/Cargo.lock b/Cargo.lock index a4f038f..3cf3669 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -222,6 +231,10 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +[[package]] +name = "client" +version = "0.1.0" + [[package]] name = "colorchoice" version = "1.0.0" @@ -725,6 +738,15 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matches" version = "0.1.10" @@ -1056,6 +1078,50 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + [[package]] name = "reqwest" version = "0.11.23" @@ -1548,6 +1614,7 @@ dependencies = [ "serde", "serde_json", "strum", + "test-log", "thiserror", "tokio", "tracing", @@ -1556,6 +1623,27 @@ dependencies = [ "urlencoding", ] +[[package]] +name = "test-log" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6159ab4116165c99fc88cce31f99fa2c9dbe08d3691cb38da02fc3b45f357d2b" +dependencies = [ + "test-log-macros", + "tracing-subscriber", +] + +[[package]] +name = "test-log-macros" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ba277e77219e9eea169e8508942db1bf5d8a41ff2db9b20aab5a5aadc9fa25d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.43", +] + [[package]] name = "textwrap" version = "0.15.2" @@ -1760,10 +1848,14 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ + "matchers", "nu-ansi-term", + "once_cell", + "regex", "sharded-slab", "smallvec", "thread_local", + "tracing", "tracing-core", "tracing-log", ] diff --git a/Cargo.toml b/Cargo.toml index 4eeeace..ef1368c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,32 +1,4 @@ -[package] -name = "tesla-charge-controller" -version = "0.1.0" -edition = "2021" -license = "MITNFA" -description = "Controls Tesla charge rate based on solar charge data" -authors = ["Alex Janka"] - -[package.metadata.deb] -maintainer-scripts = "debian/" -systemd-units = { enable = false } -depends = "" -assets = [ - [ - "target/release/tesla-charge-controller", - "usr/bin/", - "755", - ], - [ - "conf/default", - "etc/tesla-charge-controller/config", - "644", - ], -] - -[dependencies] -clap = { version = "4.0", features = ["derive"] } -ron = "0.8" -serde = { version = "1.0", features = ["derive"] } -tokio = { version = "1.35.1", features = ["full"] } -teslatte = { path = "vendored/teslatte" } -thiserror = "1.0" +[workspace] +members = ["server", "client"] +default-members = ["server"] +resolver = "2" diff --git a/client/Cargo.toml b/client/Cargo.toml new file mode 100644 index 0000000..729587b --- /dev/null +++ b/client/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "client" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/client/src/main.rs b/client/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/client/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/server/Cargo.toml b/server/Cargo.toml new file mode 100644 index 0000000..8aad05c --- /dev/null +++ b/server/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "tesla-charge-controller" +version = "0.1.0" +edition = "2021" +license = "MITNFA" +description = "Controls Tesla charge rate based on solar charge data" +authors = ["Alex Janka"] + +[package.metadata.deb] +maintainer-scripts = "debian/" +systemd-units = { enable = false } +depends = "" +assets = [ + [ + "target/release/tesla-charge-controller", + "usr/bin/", + "755", + ], + [ + "conf/default", + "etc/tesla-charge-controller/config", + "644", + ], +] + +[dependencies] +clap = { version = "4.0", features = ["derive"] } +ron = "0.8" +serde = { version = "1.0", features = ["derive"] } +tokio = { version = "1.35.1", features = ["full"] } +teslatte = { path = "../vendored/teslatte" } +thiserror = "1.0" diff --git a/conf/default b/server/conf/default similarity index 100% rename from conf/default rename to server/conf/default diff --git a/debian/service b/server/debian/service similarity index 100% rename from debian/service rename to server/debian/service diff --git a/src/config.rs b/server/src/config.rs similarity index 100% rename from src/config.rs rename to server/src/config.rs diff --git a/src/errors.rs b/server/src/errors.rs similarity index 100% rename from src/errors.rs rename to server/src/errors.rs diff --git a/src/main.rs b/server/src/main.rs similarity index 100% rename from src/main.rs rename to server/src/main.rs