コード例 #1
0
        /// <summary>
        /// Initialize the frontend.
        /// </summary>
        /// <remarks>
        /// When the C++ method invocation reports a hardware error the call is repeated
        /// up to three times with a <see cref="Thread.Sleep(int)"/>(500) between the calls.
        /// If the error holds a <see cref="DVBException"/> is thrown.
        /// <see cref="StopFilters"/>
        /// </remarks>
        /// <exception cref="DVBException">
        /// Thrown when the C++ method invocation reports some <see cref="DVBError"/>.
        /// </exception>
        public void Initialize()
        {
            // Time to stop all filters
            StopFilters();

            // Execute
            DVBError eCode = CDVBFrontend_Init(m_Class.ClassPointer);

            // Retry
            for (int nRetry = 3; (DVBError.Hardware == eCode) && (nRetry-- > 0);)
            {
                // Delay
                Thread.Sleep(500);

                // Try again
                eCode = CDVBFrontend_Init(m_Class.ClassPointer);
            }

            // Validate
            if (DVBError.None != eCode)
            {
                throw new DVBException("Can not initialize Frontend", eCode);
            }

            // Reset
            m_lastMessage = null;
        }
コード例 #2
0
 /// <summary>
 /// If the code is not <see cref="DVBError">None</see> a new
 /// <see cref="DVBException"/> is created.
 /// </summary>
 /// <param name="eCode">Error code from some API call.</param>
 /// <param name="sMessage">Message to report.</param>
 /// <exception cref="DVBException">If the error code is set.</exception>
 public static void ThrowOnError(DVBError eCode, string sMessage)
 {
     // Check and throw
     if (DVBError.None != eCode)
     {
         throw new DVBException(sMessage, eCode);
     }
 }
コード例 #3
0
        public void Initialize()
        {
            // Execute
            DVBError errorCode = _Init(m_Class.ClassPointer);

            // Retry
            for (int retryCount = 3; (DVBError.Hardware == errorCode) && (retryCount-- > 0);)
            {
                // Delay
                Thread.Sleep(500);

                // Try again
                errorCode = _Init(m_Class.ClassPointer);
            }

            // Validate
            if (DVBError.None != errorCode)
            {
                throw new DVBException("Can not initialize frontend", errorCode);
            }
        }
コード例 #4
0
		/// <summary>
		/// If the code is not <see cref="DVBError">None</see> a new
		/// <see cref="DVBException"/> is created.
		/// </summary>
		/// <param name="eCode">Error code from some API call.</param>
		/// <param name="sMessage">Message to report.</param>
		/// <exception cref="DVBException">If the error code is set.</exception>
		public static void ThrowOnError(DVBError eCode, string sMessage)
		{
			// Check and throw
			if ( DVBError.None != eCode ) throw new DVBException(sMessage, eCode);
		}
コード例 #5
0
		/// <summary>
		/// Error from API call.
		/// </summary>
		/// <param name="sText">Some error string.</param>
		/// <param name="eCode">Return value from the C++ method invocation.</param>
		public DVBException(string sText, DVBError eCode) : base(sText + " [Error: " + eCode.ToString() + "]")
		{
			// Remember
			m_Code = eCode;
		}
コード例 #6
0
ファイル: Frontend.cs プロジェクト: davinx/DVB.NET---VCR.NET
 private void CheckChannel( DVBError errorCode )
 {
     // Validate
     DVBException.ThrowOnError( errorCode, "Unable to set channel" );
 }
コード例 #7
0
 /// <summary>
 /// Error from API call.
 /// </summary>
 /// <param name="sText">Some error string.</param>
 /// <param name="eCode">Return value from the C++ method invocation.</param>
 public DVBException(string sText, DVBError eCode) : base(sText + " [Error: " + eCode.ToString() + "]")
 {
     // Remember
     m_Code = eCode;
 }
コード例 #8
0
 private void CheckChannel(DVBError errorCode)
 {
     // Validate
     DVBException.ThrowOnError(errorCode, "Unable to set channel");
 }