[package]
name = "laser-dac"
version = "0.8.0"
edition = "2021"
authors = ["Kees Kluskens <kees@kees.im>"]
description = "Unified laser DAC abstraction supporting multiple protocols"
license = "MIT"
keywords = ["laser", "dac", "ilda", "helios", "etherdream"]
categories = ["hardware-support"]
readme = "README.md"
repository = "https://github.com/ModulaserApp/laser-dac-rs"
homepage = "https://github.com/ModulaserApp/laser-dac-rs"
documentation = "https://docs.rs/laser-dac"
rust-version = "1.87"

[workspace]
members = [".", "tools/idn-simulator", "tools/idn-mock-server"]

[features]
default = ["all-dacs"]

# Meta features
all-dacs = ["usb-dacs", "network-dacs"]
usb-dacs = ["helios", "lasercube-usb"]
network-dacs = ["ether-dream", "idn", "lasercube-wifi"]

# Individual DAC protocols
helios = ["dep:rusb"]
lasercube-usb = ["dep:rusb"]
ether-dream = []
idn = ["dep:socket2", "dep:libc"]
lasercube-wifi = ["dep:socket2", "dep:libc"]

# Optional serialization
serde = ["dep:serde"]

# Test utilities (exposes additional APIs for testing)
testutils = []

[dependencies]
thiserror = "1.0"
bitflags = "2"
byteorder = "1.5"
log = "0.4"

# USB DACs (optional)
rusb = { version = "0.9", optional = true }

# Network DACs (optional for lasercube-wifi)
socket2 = { version = "0.5", features = ["all"], optional = true }

# Optional serialization
serde = { version = "1.0", features = ["derive"], optional = true }

# Unix-only for lasercube-wifi
[target.'cfg(unix)'.dependencies]
libc = { version = "0.2", optional = true }

[dev-dependencies]
clap = { version = "4", features = ["derive"] }
env_logger = "0.11"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
idn-mock-server = { path = "tools/idn-mock-server" }
cpal = "0.15"

[[example]]
name = "stream"
path = "examples/stream.rs"

[[example]]
name = "callback"
path = "examples/callback.rs"

[[example]]
name = "frame_adapter"
path = "examples/frame_adapter.rs"

[[example]]
name = "audio"
path = "examples/audio.rs"

[[example]]
name = "reconnect"
path = "examples/reconnect.rs"

[package.metadata.docs.rs]
features = ["all-dacs"]
