[package]
name = "meshtastic"
description = "A Rust library for communicating with and configuring Meshtastic devices."
homepage = "https://meshtastic.org/"
repository = "https://github.com/meshtastic/rust"
documentation = "https://docs.rs/heapless"
keywords = ["meshtastic", "mesh", "lora", "tcp", "serial"]
categories = ["embedded", "config", "encoding"]
authors = ["Adam McQuilkin"]
readme = "README.md"
license = "GPL-3.0"
version = "0.1.8"
rust-version = "1.84"
edition = "2021"

[lib]
doctest = false

[features]
default = ["serde", "tokio"]
gen = ["dep:prost-build", "dep:protoc-bin-vendored", "dep:walkdir"]

serde = ["dep:serde", "dep:serde_json"]
ts-gen = ["serde", "dep:specta", "dep:specta-typescript"]
bluetooth-le = ["dep:uuid", "dep:btleplug", "dep:futures", "dep:bluez-async"]
tokio = ["dep:tokio", "dep:tokio-serial", "dep:tokio-util"]

[lints.rust]
missing_docs = "warn"

[[example]]
name = "basic_serial"
required-features = ["tokio"]

[[example]]
name = "basic_tcp"
required-features = ["tokio"]

[[example]]
name = "message_filtering"
required-features = ["tokio"]

[[example]]
name = "generate_typescript_types"
required-features = ["ts-gen", "tokio"]

[[example]]
name = "basic_ble"
required-features = ["bluetooth-le", "tokio"]

[build-dependencies]
prost-build = { version = "0.14", optional = true }
protoc-bin-vendored = { version = "3.1.0", optional = true }
walkdir = { version = "2.5.0", optional = true }

[dependencies]
futures-util = "0.3.31"
rand = "0.9.0"
tokio = { version = "1.43.0", features = ["full"], optional = true }
tokio-serial = { version = "5.4.5", optional = true }
tokio-util = { version = "0.7.13", optional = true }
prost = "0.14"
log = "0.4.25"

specta = { git = "https://github.com/specta-rs/specta.git", rev = "b596ef0", optional = true, features = [
    "derive",
    "export",
    "chrono",
], version = "=2.0.0-rc.22" }
specta-typescript = { git = "https://github.com/specta-rs/specta.git", rev = "b596ef0", optional = true, version = "=0.0.9" }
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
thiserror = "2.0.11"
uuid = { version = "1.12.1", optional = true }
btleplug = { version = "0.11.7", optional = true, features = ["serde"] }
futures = { version = "0.3.31", optional = true }

#TODO: drop pinning of the bluez-async version once we move the MSRV to 1.84 and we can use
#MSRV-aware resolver instead of this hack. See
#https://blog.rust-lang.org/2025/01/09/Rust-1.84.0/#cargo-considers-rust-versions-for-dependency-version-selection
[target.'cfg(target_os = "linux")'.dependencies]
bluez-async = { version = "=0.8.0", optional = true }

[dev-dependencies]
fern = { version = "0.7.1", features = ["colored"] }
humantime = "2.1.0"

[package.metadata.docs.rs]
features = ["bluetooth-le"]
rustdoc-args = ["--cfg", "docsrs"]
