// *******************************************************************************************
// **                                                                                       **
// **      IDCPwr.cs
// **      4/14/2023
// **                                                                                       **
// **      RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION                 **
// **      PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS         **
// **      AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT.DISCLOSURE TO                **
// **      UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO          **
// **      RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS              **
// **      CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS         **
// **      OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON        **
// **      COMPANY.                                                                         **
// **                                                                                       **
// **      THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.               **
// **      GOVERNMENT.                                                                      **
// **                                                                                       **
// **      UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY 2023.
// **                                                                                       **
// **      WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE         **
// **      EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED         **
// **      BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION        **
// **      120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION         **
// **      730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER          **
// **      OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER         **
// **      LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS         **
// **      BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT         **
// **      APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL          **
// **      PENALTIES.                                                                       **
// **                                                                                       **
// **      CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED        **
// **      EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE            **
// **      PROJECTS/PROGRAMS.                                                               **
// **                                                                                       **
// *******************************************************************************************

using System;
using Raytheon.Communication;
using Raytheon.Units;

namespace Raytheon.Instruments
{
    /// <summary>
    /// IDCPwr - simple dc power supply interface
    /// </summary>
    [UmsContract]
    public interface IDCPwr : IInstrument
    {
        /// <summary>
        /// Gets or sets the current limit.
        /// </summary>
        /// <value>
        /// The current limit.
        /// </value>
        Current CurrentLimit 
        {
            [UmsCommand("IDCPwr.GetCurrentLimit")]
            get; 

            [UmsCommand("IDCPwr.SetCurrentLimit")]
            set; 
        }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="IDCPwr"/> is enabled.
        /// </summary>
        /// <value>
        ///   <c>true</c> if enabled; otherwise, <c>false</c>.
        /// </value>
        bool Enabled 
        {
            [UmsCommand("IDCPwr.GetEnabled")]
            get; 

            [UmsCommand("IDCPwr.SetEnabled")]
            set; 
        }

        /// <summary>
        /// Measures the current.
        /// </summary>
        /// <returns>current within <see cref="Current"/></returns>
        [UmsCommand("IDCPwr.MeasureCurrent")]
        Current MeasureCurrent();

        /// <summary>
        /// Measures the voltage.
        /// </summary>
        /// <returns>voltage within <see cref="Voltage"/></returns>
        [UmsCommand("IDCPwr.MeasureVoltage")]
        Voltage MeasureVoltage();

        /// <summary>
        /// Gets or sets the output voltage.
        /// </summary>
        /// <value>
        /// The output voltage within <see cref="Voltage"/>
        /// </value>
        Voltage OutputVoltage
        {
            [UmsCommand("IDCPwr.GetOutputVoltage")]
            get;

            [UmsCommand("IDCPwr.SetOutputVoltage")]
            set;
        }

        /// <summary>
        /// Gets or sets the over voltage protection.
        /// </summary>
        /// <value>
        /// The over voltage protection within <see cref="Voltage"/>
        /// </value>
        Voltage OverVoltageProtection 
        {
            [UmsCommand("IDCPwr.GetOverVoltageProtection")]
            get; 

            [UmsCommand("IDCPwr.SetOverVoltageProtection")]
            set; 
        }

        /// <summary>
        /// Gets or sets a value indicating whether [over voltage protection enabled].
        /// </summary>
        /// <value>
        /// <c>true</c> if [over voltage protection enabled]; otherwise, <c>false</c>.
        /// </value>
        bool OverVoltageProtectionEnabled
        {
            [UmsCommand("IDCPwr.GetOverVoltageProtectionEnabled")]
            get; 

            [UmsCommand("IDCPwr.SetOverVoltageProtectionEnabled")]
            set; 
        }

        /// <summary>
        /// Gets or sets the voltage soft limit.
        /// </summary>
        /// <value>
        /// The voltage soft limit within <see cref="Voltage"/>
        /// </value>
        Voltage VoltageSoftLimit
        {
            [UmsCommand("IDCPwr.GetVoltageSoftLimit")]
            get;

            [UmsCommand("IDCPwr.SetVoltageSoftLimit")]
            set;
        }


        /// <summary>
        /// Gets or sets a value indicating whether the power supplies inhibit is enabled.
        /// </summary>
        /// <value>
        ///   <c>true</c> if [inhibit enabled]; otherwise, <c>false</c>.
        /// </value>
        bool InhibitEnabled 
        {
            [UmsCommand("IDCPwr.GetInhibitEnabled")]
            get;

            [UmsCommand("IDCPwr.SetInhibitEnabled")]
            set; 
        }

        /// <summary>
        /// Occurs when the supply over currents.
        /// </summary>
        [UmsEvent("IDCPwr.OverCurrent")]
        event EventHandler<OverCurrentEventArgs> OverCurrent;

        /// <summary>
        /// Occurs when the supply over voltages.
        /// </summary>
        [UmsEvent("IDCPwr.OverVoltage")]
        event EventHandler<OverVoltageEventArgs> OverVoltage;


      /// <summary>
      /// reads protection status (fault register) of the power supply
      /// </summary>
      /// <returns></returns>
      [UmsCommand("IDCPwr.ReadProtectionStatus")]
		int ReadProtectionStatus();

      /// <summary>
      /// Control the power supply internal mechanical relay state
      /// </summary>
      /// <param name="shallWeConnect">True to connect, false to disconnect</param>
		[UmsCommand( "IDCPwr.MechanicalRelayOutputControl" )]
      void MechanicalRelayOutputControl(bool shallWeConnect);

      //*** possible future enhancements
      //SetVoltageTriggerSource(…);
      //SetVoltageTriggerLevels(…);
      //InitiateVoltageTrigger();
      //TriggerVoltage();
      //SetMeasurementTriggerSource(…);
      //InitiateMeasurementTrigger(…);
      //TriggerMeasurement();
      //AbortMeasurement();
   }
}
