Skip to main content

Crate bhtune_driver

Crate bhtune_driver 

Source
Expand description

bhtune-driver — the extensibility seam.

Defines a single async Driver trait abstracting all tag I/O (read/write/ browse/search) so bhtune-core’s tuning engine never knows what it is talking to. Three implementations exist:

  • opcda: the primary driver for v1 (OpcDaDriver), over the opcda-bridge crates.io dependency (Windows OPC DA via a network gateway — no COM/DCOM dependency in this process). Also home to list_opcda_servers, a standalone pre-connection function for OPC DA server discovery (see that function’s doc comment for why it isn’t a Driver/OpcDaDriver method).
  • simulator: an in-process FOPDT (first-order-plus-dead-time) process model (SimulatorDriver), used for fully automated E2E tests on CI (no Windows, no Kepware, no external process) and as a demo mode. Also home to VirtualPid, a standalone PID controller for closed-loop validation/demos.
  • replay: feeds a recorded golden-master trace (ReplayDriver) back through the engine, for regression validation — see that module’s doc comment for why this complements, rather than duplicates, core-replay-harness’s pure-engine parity proof.

OpcUaDriver and ModbusDriver are roadmap items (see AGENTS.md) that should slot in later without requiring any changes to bhtune-core.

Re-exports§

pub use driver::Driver;
pub use error::DriverError;
pub use error::DriverResult;
pub use opcda::DEFAULT_INDEX_SEARCH_MAX_RESULTS;
pub use opcda::DEFAULT_PAGE_SIZE;
pub use opcda::DEFAULT_SEARCH_MAX_RESULTS;
pub use opcda::OpcDaDriver;
pub use opcda::close_opcda_browse_session;
pub use opcda::list_opcda_servers;
pub use replay::RecordedWrite;
pub use replay::ReplayDriver;
pub use replay::ReplaySample;
pub use replay::ReplayTraceExhausted;
pub use simulator::FopdtConfig;
pub use simulator::FopdtProcess;
pub use simulator::SimulatorDriver;
pub use simulator::VirtualPid;
pub use simulator::VirtualPidConfig;
pub use types::BrowseBreadcrumb;
pub use types::BrowseNode;
pub use types::BrowseNodeKind;
pub use types::BrowsePage;
pub use types::BrowsePageRequest;
pub use types::BrowseSource;
pub use types::DriverCapabilities;
pub use types::IndexSchedulerDiagnostics;
pub use types::IndexedSearchMatch;
pub use types::IndexedSearchProgress;
pub use types::NamespaceOrganization;
pub use types::Quality;
pub use types::SearchCompleted;
pub use types::SearchEvent;
pub use types::SearchIndexControlAction;
pub use types::SearchIndexRequest;
pub use types::SearchIndexResponse;
pub use types::SearchIndexState;
pub use types::SearchIndexStatus;
pub use types::SearchMatch;
pub use types::SearchMatchMode;
pub use types::SearchProgress;
pub use types::SearchRequest;
pub use types::TagId;
pub use types::TagValue;
pub use types::TagWrite;
pub use types::WriteOutcome;

Modules§

driver
The Driver trait: bhtune’s single seam for all tag I/O.
error
Errors a crate::Driver method can fail with.
opcda
OpcDaDriver: the primary Driver implementation, talking to a DCS/PLC’s OPC DA server through the opcda-bridge gateway’s gRPC API.
replay
ReplayDriver: feeds a previously captured golden-master trace back through the Driver trait, tick by tick, instead of a live OPC DA connection or the in-process FOPDT simulator.
simulator
SimulatorDriver: an in-process FOPDT (first-order-plus-dead-time) process model, served through the Driver trait, for fully automated E2E tests (no Windows, no Kepware, no external process) and demo mode.
types
Plain data types moved across the crate::Driver trait boundary.