コード例 #1
0
        /// <summary>
        /// Starts the view monitor.
        /// </summary>
        /// <param name="callbackEndpointAddress">The callback endpoint address.</param>
        /// <param name="measurements">The measurements.</param>
        /// <param name="error">The error.</param>
        /// <param name="exception">The exception.</param>
        /// <returns><c>true</c> if the operation succeeds, <c>false</c> otherwise</returns>
        private bool StartViewMonitor(string callbackEndpointAddress, ConfiguredMeasurements measurements, out uint error, out Exception exception)
        {
            if (this.ViewMonitorScheduler.IsRunning)
            {
                error     = ResultCodes.MonitorAlreadyRunning;
                exception = null;
                return(false);
            }

            if (measurements == null)
            {
                error     = ResultCodes.MissingArgument;
                exception = null;
                return(false);
            }

            // Checks gateway validity.
            if (!OpcMonitor.IsGatewayValid(this.DataManager.Configuration.Gateway))
            {
                error     = ResultCodes.InvalidGateway;
                exception = null;
                return(false);
            }

            // Start monitor.
            this.ViewMonitorScheduler.Start(this.DataManager.Configuration, measurements, ViewMonitorRefreshRate);
            this.ViewMonitorTimeoutHandler.SetCurrentTime();
            this.MonitorCallbackAddress = callbackEndpointAddress;
            error     = ResultCodes.Success;
            exception = null;
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Determines whether the FIS communication is required.
        /// </summary>
        /// <returns><c>true</c> if the FIS communication is required; otherwise, <c>false</c>.</returns>
        /// <remarks>
        /// This method checks all the conditions for which the FIS communication is required or not.
        /// </remarks>
        private bool IsFisCommunicationRequired()
        {
            // The communication with the FIS server is required if some conditions meet.
            // All the conditions are checked here in cascade.

            // Check FIS activation flag.
            if (!this.DataManager.Configuration.FisSettings.Enabled)
            {
                return(false);
            }

            // Check the gateway validity.
            if (!OpcMonitor.IsGatewayValid(this.DataManager.Configuration.Gateway))
            {
                return(false);
            }

            // Check whether a first registration has already been done.
            string user     = null;
            string password = null;

            if (this.FisFirstRegistrationRequired(ref user, ref password))
            {
                return(false);
            }

            // The communication with the FIS Server is active!
            return(true);
        }