Skip to content

Commit 785f4a8

Browse files
committed
WIP
1 parent 65b2483 commit 785f4a8

7 files changed

Lines changed: 122 additions & 22 deletions

File tree

Cargo.lock

Lines changed: 64 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
anyhow = "1.0.99"
8-
arrayvec = "0.7.6"
9-
bitflags = "2.9.1"
10-
color_space = "0.5.4"
11-
crc = "3.3.0"
12-
hidapi = "2.6.3"
13-
thiserror = "2.0.14"
7+
anyhow = "1.0"
8+
arrayvec = "0.7"
9+
bitflags = "2.9"
10+
color_space = "0.5"
11+
crc = "3.3"
12+
hidapi = "2.6"
13+
thiserror = "2.0"
14+
15+
[build-dependencies]
16+
base64 = "0.22"
17+
regex = "1.11"
1418

1519
[lints.rust]
1620
future_incompatible = { level = "warn", priority = -1}

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
`HighFlowNext` is a Rust library for communicating with the [Aquacomputer high flow NEXT](https://shop.aquacomputer.de/Monitoring-and-Controlling/Sensors/Flow-sensor-high-flow-NEXT-G1-4::3953.html) device. It provides strongly typed access to the device’s binary protocol, allowing you to interact with sensor values, settings, and configuration in a safe and structured way. The primary goal of this project is to enable clean integration of the high flow NEXT into [OpenRGB](https://openrgb.org/), so that device data and lighting controls can be accessed and managed alongside other RGB hardware.
1+
<p>
2+
<img src="doc/logo.png" alt="logo" width="128" style="float: left; margin: 0 10px 10px 0;" />
3+
<code>HighFlowNext</code> is a Rust library for communicating with the <a href="https://shop.aquacomputer.de/Monitoring-and-Controlling/Sensors/Flow-sensor-high-flow-NEXT-G1-4::3953.html">Aquacomputer high flow NEXT</a> device. It provides strongly typed access to the device’s binary protocol, allowing you to interact with sensor values, settings, and configuration in a safe and structured way. The primary goal of this project is to enable clean integration of the high flow NEXT into <a href="https://openrgb.org">OpenRGB</a>, so that device data and lighting controls can be accessed and managed alongside other RGB hardware.
4+
</p>
25

36
> [!IMPORTANT]
7+
>
48
> This is **not an official implementation** from Aquacomputer.
59
610
> [!WARNING]
11+
>
712
> No guarantees are given regarding correctness, completeness, or stability of the protocol description. Use it at your own risk.
813
914
# Features
@@ -26,7 +31,7 @@ Beyond `OpenRGB`, the crate can also support monitoring, logging, and automation
2631
# Protocol Specification
2732

2833
If you are only interested in the details of the communication protocol itself,
29-
please have a look at the included [specification file](https://github.com/Bergmann89/HighFlowNext/blob/master/protocol/SPECIFICATION). It describes the binary
34+
please have a look at the included [specification file](https://github.com/Bergmann89/HighFlowNext/blob/master/doc/SPECIFICATION). It describes the binary
3035
layout of settings, frames, effects, colors, and source control mappings.
3136

3237
# License

build.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//! Build script for the `xsd_parser` crate.
2+
3+
use std::env::var;
4+
use std::fs::{read, read_to_string, write};
5+
use std::path::PathBuf;
6+
7+
use base64::{prelude::BASE64_STANDARD, Engine};
8+
use regex::{Captures, Regex};
9+
10+
fn main() {
11+
let cargo_dir =
12+
var("CARGO_MANIFEST_DIR").expect("Missing `CARGO_MANIFEST_DIR` environment variable!");
13+
let cargo_dir = PathBuf::from(cargo_dir);
14+
15+
let readme = cargo_dir.join("README.md");
16+
let logo_png = cargo_dir.join("doc/logo.png");
17+
18+
println!("cargo:rerun-if-changed={}", readme.display());
19+
println!("cargo:rerun-if-changed={}", logo_png.display());
20+
21+
let rx = Regex::new(r"\[!([A-Z]+)\]").unwrap();
22+
23+
let logo_png = read(logo_png).expect("Unable to load `doc/logo.png`");
24+
let logo_png = BASE64_STANDARD.encode(logo_png);
25+
let logo_png = format!("data:image/png;base64,{logo_png}");
26+
27+
let readme = read_to_string(readme).expect("Unable to read `README.md`");
28+
let readme = readme.replace("doc/logo.png", &logo_png);
29+
let readme = rx.replace_all(&readme, |c: &Captures<'_>| {
30+
let keyword = &c[1];
31+
32+
format!("**{keyword}**")
33+
});
34+
35+
let out_dir = var("OUT_DIR").expect("Missing `OUT_DIR` environment variable!");
36+
let out_dir = PathBuf::from(out_dir);
37+
38+
write(out_dir.join("README.md"), &*readme).expect("Unable to write `README.md`");
39+
}

doc/logo.png

1.11 MB
Loading

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![doc = include_str!("../README.md")]
1+
#![doc = include_str!(concat!(env!("OUT_DIR"), "/README.md"))]
22

33
pub mod misc;
44
pub mod protocol;

0 commit comments

Comments
 (0)