reai_board_sdk/lib.rs
1//! # ReAI Vibe Board Hardware SDK (V2)
2//!
3//! English:
4//! An embeddable Rust crate that encapsulates USB/BLE connectivity,
5//! auto-reconnect, the HID protocol, mSBC decoding, and USB Audio capture for
6//! the ReAI Vibe Board hardware family. Designed to be embedded into any host
7//! application that needs to talk to the board.
8//!
9//! Product site: <https://b.reai.com>
10//!
11//! 简体中文:
12//! 封装 USB/BLE 连接、断线重连、HID 协议、mSBC 解码、USB Audio 采集能力的
13//! Rust crate,可嵌入任意应用。
14//!
15//! ## V2 Architecture (four layers)
16//! - [`kernel`] — pure logic kernel (protocol / events / errors / sink / mSBC /
17//! aggregator). No threads, no I/O.
18//! - [`runtime`] — tokio async orchestration (device lifecycle / hotplug /
19//! USB / BLE I/O)
20//! - [`facade`] — `BoardDevice` high-level entry point, three event flavors
21//! (`events()` / `on_event()` / `subscribe()`)
22//! - [`tool`] — I/O-aware helpers (device-info parsing, mSBC file decoding)
23//!
24//! `runtime`/`facade` require at least one of `usb` / `ble`. With both disabled
25//! only `kernel`/`tool` are available (lightweight protocol layer).
26//!
27//! ## Hardware targets
28//! Protocol constants (USB VID/PID, BLE GATT service UUIDs, command opcodes)
29//! are tuned for the **ReAI Vibe Board** hardware family. See module-level docs
30//! for details; they are not generic USB/BLE abstractions.
31
32pub mod dfu;
33pub mod kernel;
34pub mod tool;
35
36// runtime layer requires at least one of usb / ble; with both disabled only
37// kernel/tool are available (lightweight protocol layer).
38#[cfg(any(feature = "usb", feature = "ble"))]
39pub mod runtime;
40
41#[cfg(any(feature = "usb", feature = "ble"))]
42pub mod facade;
43
44// ============ Top-level re-exports ============
45pub use kernel::error::{BoardError, Result};
46#[cfg(feature = "test-mode")]
47pub use kernel::event::FactoryKeyEvent;
48pub use kernel::event::{BoardEvent, ModeChangeEvent, ModeSource};
49pub use kernel::protocol_hid::WorkMode;
50#[cfg(feature = "test-mode")]
51pub use kernel::protocol_hid::{FactoryKeyControlAck, FactoryKeyControlResult};
52pub use kernel::sink; // top-level re-export (consumers use reai_board_sdk::sink::PcmSink)
53pub use kernel::types::ConnectionType;
54
55#[cfg(any(feature = "usb", feature = "ble"))]
56pub use facade::device::{BoardConfig, BoardDevice, EventListenerHandle};
57
58#[cfg(any(feature = "usb", feature = "ble"))]
59pub use facade::events::{EventStream, EventStreamError};
60
61#[cfg(any(feature = "usb", feature = "ble"))]
62pub use facade::blocking::BoardDeviceBlocking;
63
64#[cfg(feature = "ble")]
65pub use runtime::ble::gatt_client::BleDeviceInfo;