/// <summary> /// Initializes a new instance of the class. Initializes the communication interface and read/write locks. /// </summary> /// <param name="communicationInterface">Reference to the communication interface used to communicate with the target hardware.</param> /// <param name="formViewEventLog">Reference to the form that called this form.</param> public ThreadPollEvent(ICommunicationEvent communicationInterface, FormViewEventLog formViewEventLog) { CommunicationInterface = communicationInterface; Debug.Assert(m_CommunicationInterface != null, "ThreadPollEvent.Ctor() - [m_CommunicationInterface != null]"); m_FormViewEventLog = formViewEventLog; Debug.Assert(m_FormViewEventLog != null, "ThreadPollEvent.Ctor() - [m_FormViewEventLog != null]"); m_MutexPause = new Mutex(); m_MutexPauseFeedback = new Mutex(); m_MutexCommunicationFault = new Mutex(); m_PacketCount = 0; m_PollScheduler = new PollScheduler(); m_ReadTimeoutCountdown = ReadTimeoutCountdown; }
/// <summary> /// Initializes a new instance of the class. Initializes the: communication interface; main window interface; cyclic queues; max/min values and /// read/write locks. /// </summary> /// <param name="communicationInterface">Reference to the communication interface used to communicate with the target hardware.</param> /// <param name="cyclicQueueRecordSize">The required size of the cyclic buffer used to record watch data.</param> /// <param name="cyclicQueueLogSize">The required size of the cyclic buffer used to log watch data.</param> /// <param name="formWatchView">Reference to the form that called this form.</param> public ThreadPollWatch(ICommunicationWatch communicationInterface, int cyclicQueueRecordSize, int cyclicQueueLogSize, FormViewWatch formWatchView) { m_CommunicationInterface = communicationInterface; Debug.Assert(m_CommunicationInterface != null); m_FormViewWatch = formWatchView; Debug.Assert(m_FormViewWatch != null, "ThreadPollWatch.Ctor() - [m_FormViewWatch != null]"); m_CyclicQueueRecord = new CyclicQueue<WatchFrame_t>(cyclicQueueRecordSize); m_CyclicQueueLog = new CyclicQueue<WatchFrame_t>(cyclicQueueLogSize); m_MutexPause = new Mutex(); m_MutexPauseFeedback = new Mutex(); m_MutexCommunicationFault = new Mutex(); m_MutexRecord = new Mutex(); m_MutexAutoScaleWatchValues = new Mutex(); #region - [AutoScale] - m_AutoScaleWatchValues = new AutoScale_t[Parameter.WatchSize]; #endregion - [AutoScale] - m_PacketCount = 0; m_PollScheduler = new PollScheduler(); m_ReadTimeoutCountdown = ReadTimeoutCountdown; }