Esempio n. 1
0
        /// <summary>
        /// Check the current event log for new events.
        /// </summary>
        /// <param name="eventCount">The number of new events that have been added to the event log.</param>
        /// <param name="newIndex">The new index of the latest event.</param>
        /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the PTUDLL32.CheckFaultlogger() method is not 
        /// CommunicationError.Success.</exception>
        public void CheckFaultlogger(out short eventCount, out uint newIndex)
        {
            // Check that the function delegate has been initialized.
            Debug.Assert(m_CheckFaultlogger != null, "CommunicationEvent.CheckFaultlogger() - [m_CheckFaultlogger != null]");
            Debug.Assert(m_MutexCommuncationInterface != null, "CommunicationEvent.CheckFaultlogger() - [m_MutexCommuncationInterface != null]");

            CommunicationError errorCode = CommunicationError.UnknownError;
            try
            {
                m_MutexCommuncationInterface.WaitOne(DefaultMutexWaitDurationMs, false);
                errorCode = (CommunicationError)m_CheckFaultlogger(out eventCount, out newIndex);
            }
            catch (Exception)
            {
                errorCode = CommunicationError.SystemException;
                throw new CommunicationException("CommunicationEvent.CheckFaultlogger()", errorCode);
            }
            finally
            {
                m_MutexCommuncationInterface.ReleaseMutex();
            }

            if (DebugMode.Enabled == true)
            {
                DebugMode.CheckFaultlogger_t checkFaultlogger = new DebugMode.CheckFaultlogger_t(eventCount, newIndex, errorCode);
                DebugMode.Write(checkFaultlogger.ToXML());
            }

            if (errorCode != CommunicationError.Success)
            {
                throw new CommunicationException("CommunicationEvent.CheckFaultlogger()", errorCode);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Check the current event log for new events.
        /// </summary>
        /// <param name="eventCount">The number of new events that have been added to the event log.</param>
        /// <param name="newIndex">The new index of the latest event.</param>
        /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the PTUDLL32.CheckFaultlogger() method is not
        /// CommunicationError.Success.</exception>
        public void CheckFaultLogger(ref short eventCount, ref uint newIndex, ref uint newEventsLogged)
        {
            Debug.Assert(m_MutexCommuncationInterface != null, "CommunicationEvent.CheckFaultlogger() - [m_MutexCommuncationInterface != null]");

            CommunicationError errorCode = CommunicationError.UnknownError;

            try
            {
                m_MutexCommuncationInterface.WaitOne(DefaultMutexWaitDurationMs, false);
                errorCode = m_EventStreamMarshal.CheckFaultlogger(ref eventCount, ref newIndex, ref newEventsLogged);
            }
            catch (Exception)
            {
                errorCode = CommunicationError.SystemException;
                throw new CommunicationException("CommunicationEvent.CheckFaultlogger()", errorCode);
            }
            finally
            {
                m_MutexCommuncationInterface.ReleaseMutex();
            }

            if (DebugMode.Enabled == true)
            {
                DebugMode.CheckFaultlogger_t checkFaultlogger = new DebugMode.CheckFaultlogger_t(eventCount, newIndex, errorCode);
                DebugMode.Write(checkFaultlogger.ToXML());
            }

            if (errorCode != CommunicationError.Success)
            {
                throw new CommunicationException("CommunicationEvent.CheckFaultlogger()", errorCode);
            }
        }