#region  --------------- Copyright Dresser Wayne Pignone -------------
/*
 * $Log: /Wrk/WayneLibraries/Wrk/Common/ConnectableWrongStateException.cs $
 * 
 * 2     07-05-18 14:41 Mattias.larsson
 * Added comments.
 * 
 * 1     07-05-03 10:48 Mattias.larsson
 * Added ConnectableWrongStateException.
 */
#endregion

using System;
namespace Wayne.Lib
{
    /// <summary>
    /// The wrong state of the connection to a device.
    /// </summary>
    public enum WrongDeviceConnectionState
    {
        #region Fields

        /// <summary>
        /// Device is not Disconnected.
        /// </summary>
        NotDisconnected,

        /// <summary>
        /// Device is not Connecting.
        /// </summary>
        NotConnecting,

        /// <summary>
        /// Device is not Connected.
        /// </summary>
        NotConnected,

        /// <summary>
        /// Device is not Disconnecting.
        /// </summary>
        NotDisconnecting

        #endregion
    }


    /// <summary>
    /// The ConnectableWrongStateException is thrown when trying to access an IConnectable-object that
    /// is is a wrong state.
    /// </summary>
    public class ConnectableWrongStateException : Exception
    {
        #region Fields

        WrongDeviceConnectionState wrongState;

        #endregion

        #region Construction

        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public ConnectableWrongStateException(WrongDeviceConnectionState wrongState) { this.wrongState = wrongState; }

        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public ConnectableWrongStateException(WrongDeviceConnectionState wrongState, string message) : base(message) { this.wrongState = wrongState; }

        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public ConnectableWrongStateException(WrongDeviceConnectionState wrongState, string message, Exception inner) : base(message, inner) { this.wrongState = wrongState; }

        #endregion

        #region Properties

        /// <summary>
        /// The wrong state of the connection to a device.
        /// </summary>
        public WrongDeviceConnectionState WrongState
        {
            get { return wrongState; }
        }

        #endregion
    }
}