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 get_opcda_gateway_info, check_gateway_compatibility, and list_opcda_servers, standalone pre-connection functions for gateway diagnostics, gateway protocol compatibility checks, and OPC DA server discovery (see those functions’ doc comments for why they aren’t Driver/OpcDaDriver methods).
  • 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, the pure-engine parity test in bhtune-core.

OpcUaDriver and ModbusDriver are roadmap items (see docs/roadmap.md) that can slot in without requiring 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::OpcDaCompatibilitySource;
pub use opcda::OpcDaCompatibilityStatus;
pub use opcda::OpcDaDriver;
pub use opcda::OpcDaFeatureCompatibility;
pub use opcda::OpcDaFeatureCompatibilityStatus;
pub use opcda::OpcDaGatewayCompatibility;
pub use opcda::OpcDaGatewayFeature;
pub use opcda::OpcDaGatewayFeatureSupport;
pub use opcda::OpcDaGatewayInfo;
pub use opcda::OpcDaProtocolRange;
pub use opcda::check_gateway_compatibility;
pub use opcda::close_opcda_browse_session;
pub use opcda::get_opcda_gateway_info;
pub use opcda::list_opcda_servers;
pub use readonly::ReadOnlyDriver;
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.
readonly
A driver adapter that forwards reads but never forwards writes.
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.