namespace ZB.MOM.WW.OtOpcUa.Driver.FOCAS; /// /// Wire-layer abstraction over one FOCAS session to a CNC. The driver holds one per /// configured device; lifetime matches the device. /// /// /// No default wire implementation ships with this assembly. FWLIB /// (Fwlib32.dll) is Fanuc-proprietary and requires a valid customer license — it /// cannot legally be redistributed. The deployment team supplies an /// that wraps the licensed Fwlib32.dll via /// P/Invoke and registers it at server startup. /// /// The default throws with a pointer at /// the deployment docs so misconfigured servers fail fast with a clear error rather than /// mysteriously hanging. /// public interface IFocasClient : IDisposable { /// Open the FWLIB handle + TCP session. Idempotent. Task ConnectAsync(FocasHostAddress address, TimeSpan timeout, CancellationToken cancellationToken); /// True when the FWLIB handle is valid + the socket is up. bool IsConnected { get; } /// /// Read the value at in the requested /// . Returns a boxed .NET value + the OPC UA status mapped /// through . /// Task<(object? value, uint status)> ReadAsync( FocasAddress address, FocasDataType type, CancellationToken cancellationToken); /// /// Write to . Returns the mapped /// OPC UA status (0 = Good). /// Task WriteAsync( FocasAddress address, FocasDataType type, object? value, CancellationToken cancellationToken); /// /// Cheap health probe — e.g. cnc_rdcncstat. Returns true when the CNC /// responds with any valid status. /// Task ProbeAsync(CancellationToken cancellationToken); } /// Factory for s. One client per configured device. public interface IFocasClientFactory { IFocasClient Create(); } /// /// Default factory that throws at construction time — the deployment must register a real /// factory. Keeps the driver assembly licence-clean while still allowing the skeleton to /// compile + the abstraction tests to run. /// public sealed class UnimplementedFocasClientFactory : IFocasClientFactory { public IFocasClient Create() => throw new NotSupportedException( "FOCAS driver has no wire client configured. Register a real IFocasClientFactory at " + "server startup wrapping the licensed Fwlib32.dll — see docs/v2/focas-deployment.md. " + "Fanuc licensing forbids shipping Fwlib32.dll in the OtOpcUa package."); }