/// <summary> /// Initializes object with default values. /// </summary> public TsCAeSubscription(TsCAeServer server, ITsCAeSubscription subscription, TsCAeSubscriptionState state) { server_ = server ?? throw new ArgumentNullException(nameof(server)); subscription_ = subscription ?? throw new ArgumentNullException(nameof(subscription)); state_ = (TsCAeSubscriptionState)state.Clone(); name_ = state.Name; }
/////////////////////////////////////////////////////////////////////// #region Constructors, Destructor, Initialization /// <summary> /// Initializes object with default values. /// </summary> public TsCAeSubscription(TsCAeServer server, ITsCAeSubscription subscription, TsCAeSubscriptionState state) { if (server == null) { throw new ArgumentNullException("server"); } if (subscription == null) { throw new ArgumentNullException("subscription"); } _server = server; _subscription = subscription; _state = (Ae.TsCAeSubscriptionState)state.Clone(); _name = state.Name; }
/// <summary> /// Creates a server object for the specified URL. /// </summary> /// <param name="url">The OpcUrl of the OPC server.</param> /// <returns>The OpcServer object.</returns> public static OpcServer GetServer(OpcUrl url) { if (url == null) { throw new ArgumentNullException(nameof(url)); } OpcServer server = null; // create an unconnected server object for COM based servers. // DA if (String.CompareOrdinal(url.Scheme, OpcUrlScheme.DA) == 0) { server = new Da.TsCDaServer(new Factory(), url); } // AE else if (String.CompareOrdinal(url.Scheme, OpcUrlScheme.AE) == 0) { server = new Ae.TsCAeServer(new Factory(), url); } // HDA else if (String.CompareOrdinal(url.Scheme, OpcUrlScheme.HDA) == 0) { server = new Hda.TsCHdaServer(new Factory(), url); } // Other specifications not supported yet. if (server == null) { throw new NotSupportedException(url.Scheme); } return(server); }
/////////////////////////////////////////////////////////////////////// #region Public Methods (Returns OpcServer object for a specific URL) /// <summary> /// Creates a server object for the specified URL. /// </summary> /// <param name="url">The OpcUrl of the OPC server.</param> /// <returns>The OpcServer obkect.</returns> public static OpcServer GetServer(Technosoftware.DaAeHdaClient.OpcUrl url) { if (url == null) { throw new ArgumentNullException("url"); } OpcServer server = null; // create an unconnected server object for COM based servers. // DA if (server == null && String.Compare(url.Scheme, OpcUrlScheme.DA, false) == 0) { server = new Da.TsCDaServer(new Technosoftware.DaAeHdaClient.Com.Factory(), url); } // AE else if (String.Compare(url.Scheme, OpcUrlScheme.AE, false) == 0) { server = new Ae.TsCAeServer(new Technosoftware.DaAeHdaClient.Com.Factory(), url); } // HDA else if (String.Compare(url.Scheme, OpcUrlScheme.HDA, false) == 0) { server = new Hda.TsCHdaServer(new Technosoftware.DaAeHdaClient.Com.Factory(), url); } // Other specifications not supported yet. if (server == null) { throw new NotSupportedException(url.Scheme); } return(server); }