using System; using System.Collections.Generic; namespace Modbus.Net.OPC { /// /// Opc UA设备 /// /// 设备Id的类型 /// 设备中地址的Id的类型 public class OpcUaMachine : OpcMachine where TKey : IEquatable where TUnitKey : IEquatable { /// /// 构造函数 /// /// 设备的ID号 /// 连接地址 /// 需要读写的数据 /// 是否保持连接 /// 是否开启正则匹配 public OpcUaMachine(TKey id, string connectionString, IEnumerable> getAddresses, bool keepConnect, bool isRegexOn = false) : base(id, getAddresses, keepConnect) { BaseUtility = new OpcUaUtility(connectionString, isRegexOn); ((OpcUtility) BaseUtility).GetSeperator += () => ((AddressFormaterOpc) AddressFormater).Seperator; } /// /// 构造函数 /// /// 设备的ID号 /// 连接地址 /// 需要读写的数据 public OpcUaMachine(TKey id, string connectionString, IEnumerable> getAddresses) : this(id, connectionString, getAddresses, false) { } } /// /// Opc UA设备 /// public class OpcUaMachine : OpcMachine { /// /// 构造函数 /// /// 设备的ID号 /// 连接地址 /// 需要读写的数据 /// 是否保持连接 /// 是否开启正则匹配 public OpcUaMachine(string id, string connectionString, IEnumerable getAddresses, bool keepConnect, bool isRegexOn = false) : base(id, getAddresses, keepConnect) { BaseUtility = new OpcUaUtility(connectionString, isRegexOn); ((OpcUtility) BaseUtility).GetSeperator += () => ((AddressFormaterOpc) AddressFormater).Seperator; } /// /// 构造函数 /// /// 设备的ID号 /// 连接地址 /// 需要读写的数据 public OpcUaMachine(string id, string connectionString, IEnumerable getAddresses) : this(id, connectionString, getAddresses, false) { } } }