Initial commit
This commit is contained in:
parent
6dab86baae
commit
0237540773
2 changed files with 68 additions and 0 deletions
14
Cargo.toml
Normal file
14
Cargo.toml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
[package]
|
||||||
|
name = "unicorn"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
unicorn_hat_hd_2 = { version = "*" }
|
||||||
|
#unicorn_hat_hd_2 = { version = "*", default-features = false, features = [ "fake-hardware" ] }
|
||||||
|
url = "*"
|
||||||
|
reqwest = "*"
|
||||||
|
trust-dns-client = "*"
|
||||||
|
|
||||||
54
src/main.rs
Normal file
54
src/main.rs
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
use unicorn_hat_hd_2::UnicornHatHd;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
|
pub trait Probe {
|
||||||
|
fn execute() -> ProbeResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ProbeResult {
|
||||||
|
pub status: ProbeStatus,
|
||||||
|
pub metrics: ProbeMetrics
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum ProbeStatus {
|
||||||
|
Ok,
|
||||||
|
NotReady,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ProbeMetrics {
|
||||||
|
pub latency_ms: u32
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTP probe
|
||||||
|
//
|
||||||
|
pub struct HttpProbe {
|
||||||
|
remote_addr: SocketAddr
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Probe for HttpProbe {
|
||||||
|
fn execute() -> ProbeResult {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DNS probe
|
||||||
|
|
||||||
|
pub struct DnsProbe {
|
||||||
|
fn execute() -> ProbeResult {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut hat_hd = UnicornHatHd::default();
|
||||||
|
|
||||||
|
hat_hd.clear_pixels();
|
||||||
|
hat_hd.display().unwrap();
|
||||||
|
|
||||||
|
//hat_hd.set_pixel(x, y, [255, 255, 255].into());
|
||||||
|
//hat_hd.display().unwrap();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue