Ejemplo n.º 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;
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
		}
Ejemplo n.º 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;
		}
Ejemplo n.º 6
0
 private void CheckChannel( DVBError errorCode )
 {
     // Validate
     DVBException.ThrowOnError( errorCode, "Unable to set channel" );
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 8
0
 private void CheckChannel(DVBError errorCode)
 {
     // Validate
     DVBException.ThrowOnError(errorCode, "Unable to set channel");
 }