diff --git a/Sharp7.Rx/Sharp7Connector.cs b/Sharp7.Rx/Sharp7Connector.cs index 78c911f..51991e3 100644 --- a/Sharp7.Rx/Sharp7Connector.cs +++ b/Sharp7.Rx/Sharp7Connector.cs @@ -40,6 +40,7 @@ internal class Sharp7Connector : IDisposable } public IObservable ConnectionState => connectionStateSubject.DistinctUntilChanged().AsObservable(); + public ConnectionState CurrentConnectionState => connectionStateSubject.Value; public ILogger Logger { get; set; } diff --git a/Sharp7.Rx/Sharp7Plc.cs b/Sharp7.Rx/Sharp7Plc.cs index e77d51b..8cea1e7 100644 --- a/Sharp7.Rx/Sharp7Plc.cs +++ b/Sharp7.Rx/Sharp7Plc.cs @@ -240,6 +240,8 @@ public class Sharp7Plc : IPlc .ToTask(token); } + public override string ToString() => $"S7 {s7Connector} ({s7Connector.CurrentConnectionState})"; + /// /// Initialize PLC and trigger connection. This method will not wait for the connection to be established. ///