示例#1
0
        ///////////////////////////////////////////////////////////////////////
        #region ICloneable Members

        /// <summary>
        /// Returns an unconnected copy of the server with the same OpcUrl.
        /// </summary>
        public override object Clone()
        {
            // clone the base object.
            TsCHdaServer clone = (TsCHdaServer)base.Clone();

            // return clone.
            return(clone);
        }
示例#2
0
        /// <summary>
        /// Initializes the object with the specified server.
        /// </summary>
        public TsCHdaTrend(TsCHdaServer server)
        {
            // save a reference to a server.
            hdaServer_ = server ?? throw new ArgumentNullException(nameof(server));

            // create a default name.
            do
            {
                Name = $"Trend{++count_,2:00}";
            }while (hdaServer_.Trends[Name] != null);
        }
        ///////////////////////////////////////////////////////////////////////
        #region Constructors, Destructor, Initialization

        /// <summary>
        /// Initializes the object with the specified server.
        /// </summary>
        public TsCHdaTrend(TsCHdaServer server)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            // save a reference to a server.
            _server = server;

            // create a default name.
            do
            {
                Name = String.Format("Trend{0,2:00}", ++_count);
            }while (_server.Trends[Name] != null);
        }
示例#4
0
        /// <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);
        }
 /// <summary>
 /// Used to set the server after the object is deserialized.
 /// </summary>
 internal void SetServer(TsCHdaServer server)
 {
     _server = server;
 }