diff --git a/Makefile b/Makefile index 4a47adb..968aec8 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ -all: picomon collectr configr viewr wimon +all: build + +.PHONY: build +build: picomon collectr configr viewr wimon .PHONY: deploy deploy: diff --git a/collectr/Cargo.toml b/collectr/Cargo.toml index f3ac383..f6ec2c4 100644 --- a/collectr/Cargo.toml +++ b/collectr/Cargo.toml @@ -17,8 +17,8 @@ name = "worker" path = "src/worker.rs" [dependencies] -data_model = { path = "../data_model"} -worker = { version = "0.3.0", features = ["queue"]} +data_model = { path = "../data_model" } +worker = { version = "0.3.4", features = ["queue"] } serde_derive = "~1.0" serde = "~1.0" serde_json = "1.0.107" \ No newline at end of file diff --git a/collectr/Makefile b/collectr/Makefile index 2a54dd1..ce4b7cf 100644 --- a/collectr/Makefile +++ b/collectr/Makefile @@ -1,8 +1,11 @@ all: build -.PHONY: build -build: +.PHONY: clippy +clippy: cargo clippy + +.PHONY: build +build: clippy wrangler deploy --dry-run --outdir=dist local: diff --git a/picomon/Cargo.toml b/picomon/Cargo.toml index e36112e..4608cc6 100644 --- a/picomon/Cargo.toml +++ b/picomon/Cargo.toml @@ -4,6 +4,10 @@ version = "0.1.0" readme = "README.md" edition = "2021" +[features] +default = ["pico"] +pico = [] + [dependencies] embassy-time = { version = "0.3.0", default-features = false, features = ["defmt", "defmt-timestamp-uptime"] } embassy-executor = { version = "0.6.0", default-features = false, features = ["task-arena-size-65536", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } @@ -14,19 +18,19 @@ cyw43 = { version = "0.1.0", default-features = false, features = ["defmt"] } cyw43-pio = { version = "0.1.0", default-features = false, features = ["defmt"] } panic-probe = { version = "0.3", default-features = false, features = ["print-defmt"] } portable-atomic = { version = "1.5", default-features = false, features = ["critical-section"] } -defmt = { version = "0.3", default-features = false} +defmt = { version = "0.3", default-features = false } defmt-rtt = { version = "0.4", default-features = false } cortex-m-rt = { version = "0.7.0", default-features = false } -static_cell = { version = "2", default-features = false} +static_cell = { version = "2", default-features = false } log = "0.4" # To convert device_id into hex for use as a string -faster-hex = { version = "0.9.0", default-features = false } +faster-hex = { version = "0.9.0", default-features = false } # To make httpclient requests to the server, with TLS -reqwless = { version="0.12.0", default-features = false, features = ["embedded-tls"]} +reqwless = { version = "0.12.0", default-features = false, features = ["embedded-tls"] } # Needed to workaround an embassy dns server count bug -smoltcp = { version = "0.11.0", default-features = false, features = ["dns-max-server-count-4"]} +smoltcp = { version = "0.11.0", default-features = false, features = ["dns-max-server-count-4"] } [build-dependencies] # for reading config from a file in build.rs diff --git a/viewr/Cargo.toml b/viewr/Cargo.toml index 900f3c7..6090738 100644 --- a/viewr/Cargo.toml +++ b/viewr/Cargo.toml @@ -14,8 +14,8 @@ path = "src/viewr.rs" [dependencies] data_model = { path = "../data_model" } console_error_panic_hook = "0.1.7" -leptos = { version = "0.6.9", features = ["csr"] } -leptos_router = { version = "0.6.9", features = ["csr"] } +leptos = { version = "0.6.13", features = ["csr"] } +leptos_router = { version = "0.6.13", features = ["csr"] } reqwasm = "0.5" serde = { version = "1", features = ["derive"] } -chrono = "0.4.34" \ No newline at end of file +chrono = "0.4.38" \ No newline at end of file diff --git a/viewr/Makefile b/viewr/Makefile index fc4e0ff..dd431a1 100644 --- a/viewr/Makefile +++ b/viewr/Makefile @@ -3,8 +3,7 @@ all: build build: trunk build --release -deploy: - trunk build --release +deploy: build wrangler pages deploy dist local: diff --git a/wimon/Cargo.toml b/wimon/Cargo.toml index 80b004d..80017d8 100644 --- a/wimon/Cargo.toml +++ b/wimon/Cargo.toml @@ -14,6 +14,7 @@ path = "src/main.rs" [features] default = [] ssids = ["wifiscanner"] +pico = [] [dependencies] data_model = { path = "../data_model" } @@ -35,7 +36,7 @@ curl = { version = "~0.4", default-features = false, features = ["rustls"] } ctrlc = { version = "3.4.1", features = ["termination"] } # for installing as a system service -service-manager = "0.6.0" +service-manager = "0.7.1" # for scanning wifi and getting SSIDs visible wifiscanner = { version = "0.5.1", optional = true } \ No newline at end of file diff --git a/wimon/src/lib/config.rs b/wimon/src/lib/config.rs index c79314e..3f183d5 100644 --- a/wimon/src/lib/config.rs +++ b/wimon/src/lib/config.rs @@ -6,7 +6,7 @@ use serde_derive::{Deserialize, Serialize}; use url::Url; #[cfg_attr( - not(target_abi = "eabi"), + not(feature = "pico"), derive(Default, Serialize, Deserialize, Debug, PartialEq) )] pub enum MonitorSpec { @@ -18,7 +18,7 @@ pub enum MonitorSpec { } #[cfg_attr( - not(target_abi = "eabi"), + not(feature = "pico"), derive(Serialize, Deserialize, Debug, PartialEq) )] pub struct ReportSpec { @@ -27,7 +27,7 @@ pub struct ReportSpec { } #[cfg_attr( - not(target_abi = "eabi"), + not(feature = "pico"), derive(Default, Serialize, Deserialize) )] pub struct Config { diff --git a/wimon/src/main.rs b/wimon/src/main.rs index c642e8d..139c8f8 100644 --- a/wimon/src/main.rs +++ b/wimon/src/main.rs @@ -1,12 +1,14 @@ -use config::MonitorSpec; +use std::{env, io}; +use std::path::PathBuf; +use std::sync::mpsc::channel; +use std::time::Duration; + use service_manager::{ ServiceInstallCtx, ServiceLabel, ServiceManager, ServiceStartCtx, ServiceStopCtx, ServiceUninstallCtx, }; -use std::path::PathBuf; -use std::sync::mpsc::channel; -use std::time::Duration; -use std::{env, io}; + +use config::MonitorSpec; mod monitor; @@ -47,7 +49,7 @@ fn run(config_file_path: &PathBuf) -> Result<(), io::Error> { println!("Control-C captured, sending Stop report"); tx.send(()).expect("Could not send signal on channel.") }) - .expect("Error setting Ctrl-C handler"); + .expect("Error setting Ctrl-C handler"); monitor::monitor_loop(config, rx)?; @@ -86,6 +88,7 @@ fn install_service(service_name: &ServiceLabel, path_to_exec: &str) -> Result<() username: None, // Optional String for alternative user to run service. working_directory: Some(exec_dir), environment: None, // Optional list of environment variables to supply the service process. + autostart: true, // autostart on reboot })?; // Start our service using the underlying service management platform @@ -128,10 +131,12 @@ fn uninstall_service(service_name: &ServiceLabel) -> Result<(), io::Error> { #[cfg(test)] mod test { - use super::CONFIG_FILE_NAME; - use config::{Config, MonitorSpec}; use std::path::PathBuf; + use config::{Config, MonitorSpec}; + + use super::CONFIG_FILE_NAME; + #[test] fn bundled_spec() { let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));