using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Hylasoft.Opc.Common { /// /// Client interface to perform basic Opc tasks, like discovery, monitoring, reading/writing tags, /// public interface IClient : IDisposable where TNode : Node { /// /// Connect the client to the OPC Server /// Task Connect(); /// /// Gets the current status of the OPC Client /// OpcStatus Status { get; } /// /// Gets the datatype of an OPC tag /// /// Tag to get datatype of /// System Type System.Type GetDataType(string tag); /// /// Read a tag /// /// The type of tag to read /// The fully-qualified identifier of the tag. You can specify a subfolder by using a comma delimited name. /// E.g: the tag `foo.bar` reads the tag `bar` on the folder `foo` /// The value retrieved from the OPC ReadEvent Read(string tag); /// /// Write a value on the specified opc tag /// /// The type of tag to write on /// The fully-qualified identifier of the tag. You can specify a subfolder by using a comma delimited name. /// E.g: the tag `foo.bar` writes on the tag `bar` on the folder `foo` /// void Write(string tag, T item); /// /// Monitor the specified tag for changes /// /// the type of tag to monitor /// The fully-qualified identifier of the tag. You can specify a subfolder by using a comma delimited name. /// E.g: the tag `foo.bar` monitors the tag `bar` on the folder `foo` /// the callback to execute when the value is changed. /// The first parameter is the new value of the node, the second is an `unsubscribe` function to unsubscribe the callback [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an async method.")] void Monitor(string tag, Action, Action> callback); /// /// Finds a node on the Opc Server /// /// The fully-qualified identifier of the tag. You can specify a subfolder by using a comma delimited name. /// E.g: the tag `foo.bar` finds the tag `bar` on the folder `foo` /// If there is a tag, it returns it, otherwise it throws an TNode FindNode(string tag); /// /// Gets the root node of the server /// TNode RootNode { get; } /// /// Explore a folder on the Opc Server /// /// The fully-qualified identifier of the tag. You can specify a subfolder by using a comma delimited name. /// E.g: the tag `foo.bar` finds the sub nodes of `bar` on the folder `foo` /// The list of sub-nodes IEnumerable ExploreFolder(string tag); /// /// Read a tag asynchronusly /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an async method.")] Task> ReadAsync(string tag); /// /// Write a value on the specified opc tag asynchronously /// Task WriteAsync(string tag, T item); /// /// Finds a node on the Opc Server asynchronously /// Task FindNodeAsync(string tag); /// /// Explore a folder on the Opc Server asynchronously /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Task")] Task> ExploreFolderAsync(string tag); } }