Exemple #1
0
        /// <summary>
        /// Update the self test mode.
        /// </summary>
        /// <remarks>This call is used to check whether communication with the VCU has been lost.</remarks>
        /// <param name="selfTestMode">The required self test mode.</param>
        /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the m_SelfTestMarshal.UpdateSTMode() method is not
        /// CommunicationError.Success.</exception>
        public void UpdateSTMode(SelfTestMode selfTestMode)
        {
            Debug.Assert(m_MutexCommuncationInterface != null,
                         "CommunicationSelfTest.UpdateSTMode() - [m_MutexCommuncationInterface != null]");

            CommunicationError errorCode = CommunicationError.UnknownError;

            try
            {
                m_MutexCommuncationInterface.WaitOne(DefaultMutexWaitDurationMs, false);
                errorCode = m_SelfTestMarshal.UpdateSTMode((Int16)selfTestMode);
            }
            catch (Exception)
            {
                errorCode = CommunicationError.SystemException;
                throw new CommunicationException("CommunicationSelfTest.UpdateSTMode()", errorCode);
            }
            finally
            {
                m_MutexCommuncationInterface.ReleaseMutex();
            }

            if (DebugMode.Enabled == true)
            {
                DebugMode.UpdateSTMode_t updateSTMode = new DebugMode.UpdateSTMode_t(selfTestMode, errorCode);
                DebugMode.Write(updateSTMode.ToXML());
            }

            if (errorCode != CommunicationError.Success)
            {
                throw new CommunicationException("CommunicationSelfTest.UpdateSTMode()", errorCode);
            }
        }
        /// <summary>
        /// Update the self test mode.
        /// </summary>
        /// <remarks>This call is used to check whether communication with the VCU has been lost.</remarks>
        /// <param name="selfTestMode">The required self test mode.</param>
        /// <exception cref="CommunicationException">Thrown if the error code returned from the call to the PTUDLL32.UpdateSTMode() method is not 
        /// CommunicationError.Success.</exception>
        public void UpdateSTMode(SelfTestMode selfTestMode)
        {
            Debug.Assert(m_MutexCommuncationInterface != null,
                         "CommunicationSelfTest.UpdateSTMode() - [m_MutexCommuncationInterface != null]");

            CommunicationError errorCode = CommunicationError.UnknownError;
            try
            {
                m_MutexCommuncationInterface.WaitOne(DefaultMutexWaitDurationMs, false);
                errorCode = m_SelfTestMarshal.UpdateSTMode((Int16)selfTestMode);
            }
            catch (Exception)
            {
                errorCode = CommunicationError.SystemException;
                throw new CommunicationException("CommunicationSelfTest.UpdateSTMode()", errorCode);
            }
            finally
            {
                m_MutexCommuncationInterface.ReleaseMutex();
            }

            if (DebugMode.Enabled == true)
            {
                DebugMode.UpdateSTMode_t updateSTMode = new DebugMode.UpdateSTMode_t(selfTestMode, errorCode);
                DebugMode.Write(updateSTMode.ToXML());
            }

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