Beispiel #1
0
        /// <summary>
        /// This ends the SensorMonitoringRoutine. This should only be executed when "Shutdown RT" is clicked.
        /// </summary>
        /// <param name="rebooting">This will tell the function if we are rebooting, or shutting down indefinitely.</param>
        /// <returns>If ended successfully, return true. Else, return false.</returns>
        public void EndSensorMonitoringRoutine(bool rebooting = false)
        {
            CurrentlyRunning = false;
            // The stream will only be null if the sensor monitoring thread has not been called
            if (Stream != null)
            {
                Stream.Close();
                Stream.Dispose();
            }

            Server.Stop();

            if (Timeout.Enabled)
            {
                Timeout.Stop();
            }

            SensorMonitoringThread.Join();

            if (!rebooting)
            { // We want to keep using the timer if we are rebooting, not destroy it.
                Status = SensorNetworkStatusEnum.None;
                Timeout.Dispose();

                if (SimulationSensorNetwork != null)
                {
                    SimulationSensorNetwork.EndSimulationSensorNetwork();
                }
            }
            else
            {
                Status = SensorNetworkStatusEnum.Rebooting;
                SensorMonitoringThread = new Thread(() => { SensorMonitoringRoutine(); });
            }
        }
Beispiel #2
0
 public void LongWaitEnd()
 {
     Timeout.Dispose();
 }
Beispiel #3
0
 public void Dispose()
 {
     _builder.Dispose();
     Timeout.Dispose();
     Result?.Dispose();
 }