namespace ZB.MOM.WW.OtOpcUa.Commons.OpcUa;
///
/// Writes the OPC UA Server object's ServiceLevel Variable (0–255). Production binds
/// a sink that pokes the SDK's ServiceLevel node; tests + dev mode bind
/// which just records the most recently set level
/// for inspection.
///
public interface IServiceLevelPublisher
{
/// Publishes the service level value to the OPC UA Server object.
/// The service level value (0-255).
void Publish(byte serviceLevel);
}
/// No-op default that retains the last-written ServiceLevel in
/// . Used by dev mode + verified by tests.
public sealed class NullServiceLevelPublisher : IServiceLevelPublisher
{
public static readonly NullServiceLevelPublisher Instance = new();
private NullServiceLevelPublisher() { }
/// Gets the last published service level value.
public byte LastPublished { get; private set; }
/// Records the service level value without publishing.
/// The service level value (0-255).
public void Publish(byte serviceLevel) => LastPublished = serviceLevel;
}