dalybms_lib/lib.rs
1#![cfg_attr(docsrs, feature(doc_cfg))]
2//! # dalybms_lib
3//!
4//! This crate provides a library for interacting with Daly BMS (Battery Management System) devices.
5//! It offers both synchronous and asynchronous clients for communication.
6//!
7//! ## Features
8//!
9//! This crate uses a feature-based system to keep dependencies minimal.
10//! You need to enable the client you want to use.
11//!
12//! - `default`: Enables `bin-dependencies`, which is intended for compiling the `dalybms` command-line tool and pulls in `serialport` and `serde`.
13//!
14//! ### Client Features
15//! - `serialport`: Enables the **synchronous** client using the `serialport` crate.
16//! - `tokio-serial-async`: Enables the **asynchronous** client using `tokio` and `tokio-serial`.
17//!
18//! ### Utility Features
19//! - `serde`: Enables `serde` support for serializing/deserializing data structures.
20//! - `bin-dependencies`: Enables all features required by the `dalybms` binary executable (currently `serialport` and `serde`).
21
22/// Contains error types for the library.
23mod error;
24/// Defines the communication protocol for Daly BMS.
25pub mod protocol;
26
27pub use error::Error;
28
29/// Synchronous client for Daly BMS communication.
30#[cfg_attr(docsrs, doc(cfg(feature = "serialport")))]
31#[cfg(feature = "serialport")]
32pub mod serialport;
33
34/// Asynchronous client for Daly BMS communication.
35#[cfg_attr(docsrs, doc(cfg(feature = "tokio-serial-async")))]
36#[cfg(feature = "tokio-serial-async")]
37pub mod tokio_serial_async;