bhtune_driver/lib.rs
1//! `bhtune-driver` — the extensibility seam.
2//!
3//! Defines a single async [`Driver`] trait abstracting all tag I/O (`read`/`write`/
4//! browse/search) so `bhtune-core`'s tuning engine never knows what it is talking to. Three
5//! implementations exist:
6//!
7//! - [`opcda`]: the primary driver for v1 ([`OpcDaDriver`]), over the `opcda-bridge`
8//! crates.io dependency (Windows OPC DA via a network gateway — no COM/DCOM dependency in
9//! this process). Also home to [`list_opcda_servers`], a standalone pre-connection
10//! function for OPC DA server discovery (see that function's doc comment for why it
11//! isn't a `Driver`/`OpcDaDriver` method).
12//! - [`simulator`]: an in-process FOPDT (first-order-plus-dead-time) process model
13//! ([`SimulatorDriver`]), used for fully automated E2E tests on CI (no Windows, no
14//! Kepware, no external process) and as a demo mode. Also home to [`VirtualPid`], a
15//! standalone PID controller for closed-loop validation/demos.
16//! - [`replay`]: feeds a recorded golden-master trace ([`ReplayDriver`]) back through the
17//! engine, for regression validation — see that module's doc comment for why this
18//! complements, rather than duplicates, `core-replay-harness`'s pure-engine parity proof.
19//!
20//! `OpcUaDriver` and `ModbusDriver` are roadmap items (see AGENTS.md) that should slot in
21//! later without requiring any changes to `bhtune-core`.
22//!
23//! - [`driver`] — the [`Driver`] trait itself.
24//! - [`types`] — the plain data types ([`TagId`], [`TagValue`], [`TagWrite`],
25//! [`WriteOutcome`], browse-page, capability, and search types) that cross the trait boundary.
26//! - [`error`] — the crate's error type, [`DriverError`].
27//! - [`opcda`] — [`OpcDaDriver`], the OPC DA implementation, and [`list_opcda_servers`].
28//! - [`simulator`] — [`SimulatorDriver`], [`FopdtProcess`]/[`FopdtConfig`], and
29//! [`VirtualPid`]/[`VirtualPidConfig`].
30//! - [`replay`] — [`ReplayDriver`], [`ReplaySample`], and [`RecordedWrite`].
31
32pub mod driver;
33pub mod error;
34pub mod opcda;
35pub mod replay;
36pub mod simulator;
37pub mod types;
38
39pub use driver::Driver;
40pub use error::{DriverError, DriverResult};
41pub use opcda::{
42 DEFAULT_INDEX_SEARCH_MAX_RESULTS, DEFAULT_PAGE_SIZE, DEFAULT_SEARCH_MAX_RESULTS, OpcDaDriver,
43 close_opcda_browse_session, list_opcda_servers,
44};
45pub use replay::{RecordedWrite, ReplayDriver, ReplaySample, ReplayTraceExhausted};
46pub use simulator::{FopdtConfig, FopdtProcess, SimulatorDriver, VirtualPid, VirtualPidConfig};
47pub use types::{
48 BrowseBreadcrumb, BrowseNode, BrowseNodeKind, BrowsePage, BrowsePageRequest, BrowseSource,
49 DriverCapabilities, IndexSchedulerDiagnostics, IndexedSearchMatch, IndexedSearchProgress,
50 NamespaceOrganization, Quality, SearchCompleted, SearchEvent, SearchIndexControlAction,
51 SearchIndexRequest, SearchIndexResponse, SearchIndexState, SearchIndexStatus, SearchMatch,
52 SearchMatchMode, SearchProgress, SearchRequest, TagId, TagValue, TagWrite, WriteOutcome,
53};