Beispiel #1
0
        void timerProcessAlarmObjects_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            /* Pause the timer till the process is completed. */
            timerProcessAlarmObject.Stop();

            /*Processing the queued objects.*/
            target.ProcessAlarmObjects();

            /* Start the timer once ConstructSensorObjects process completed. */
            timerProcessAlarmObject.Start();
        }
Beispiel #2
0
        /// <summary>
        /// check for the data received from the external source, if
        /// received construct the alarm object and process them
        /// </summary>
        private void HandleThread()
        {
            while (true)
            {
                if (_udpSocket == null)
                {
                    break;
                }
                try
                {
                    byte[] bytes = new byte[1024];
                    _udpSocket.Receive(bytes);

                    string s = System.Text.ASCIIEncoding.ASCII.GetString(bytes);
                    LogBook.Write("Received data from external source, doing update check, data: " + s.Replace("\0", ""));

                    //doing update check.
                    _target.ConstructSensorObjects();
                    _target.ProcessAlarmObjects();
                    Thread.Sleep(1000);
                }
                catch { }
            }
        }