using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Text;
using MindWorks.Nimbus;
using Ivi.Driver;

namespace Raytheon.GuidedElectronicsUnit
{
    public struct ImuDiscreteInput
    {
        public ImuDiscreteInput(uint status)
        {
            ExternalSync = Convert.ToBoolean(status & (uint)BitMask.ExternalSync) ? SignalState.High : SignalState.Low;
            PowerOnreset = Convert.ToBoolean(status & (uint)BitMask.PowerOnreset) ? SignalState.High : SignalState.Low;
            FastRestart = Convert.ToBoolean(status & (uint)BitMask.FastRestart) ? SignalState.High : SignalState.Low;
            NotCommandBit = Convert.ToBoolean(status & (uint)BitMask.NotCommandBit) ? SignalState.High : SignalState.Low;
            NotInhibitBit = Convert.ToBoolean(status & (uint)BitMask.NotInhibitBit) ? SignalState.High : SignalState.Low;
            InhibitPowerOnReset = Convert.ToBoolean(status & (uint)BitMask.InhibitPowerOnReset) ? SignalState.High : SignalState.Low;
            SimExternalSync = Convert.ToBoolean(status & (uint)BitMask.SimExternalSync) ? SignalState.High : SignalState.Low;
            SimPowerOnreset = Convert.ToBoolean(status & (uint)BitMask.SimPowerOnreset) ? SignalState.High : SignalState.Low;
            SimFastRestart = Convert.ToBoolean(status & (uint)BitMask.SimFastRestart) ? SignalState.High : SignalState.Low;
            SimNotCommandBit = Convert.ToBoolean(status & (uint)BitMask.SimNotCommandBit) ? SignalState.High : SignalState.Low;
            SimNotInhibitBit = Convert.ToBoolean(status & (uint)BitMask.SimNotInhibitBit) ? SignalState.High : SignalState.Low;
        }

        #region Internal Members

        internal enum BitMask
        {
            ExternalSync = 0x1,
            PowerOnreset = 0x2,
            FastRestart = 0x4,
            NotCommandBit = 0x8,
            NotInhibitBit = 0x10,
            InhibitPowerOnReset = 0x20,
            SimExternalSync = 0x100,
            SimPowerOnreset = 0x200,
            SimFastRestart = 0x400,
            SimNotCommandBit = 0x800,
            SimNotInhibitBit = 0x1000
        }

        #endregion

        public Raytheon.GuidedElectronicsUnit.SignalState SimNotInhibitBit { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState SimNotCommandBit { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState SimFastRestart { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState SimExternalSync { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState SimPowerOnreset { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState ExternalSync { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState FastRestart { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState NotCommandBit { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState NotInhibitBit { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState PowerOnreset { get; internal set; }

        public Raytheon.GuidedElectronicsUnit.SignalState InhibitPowerOnReset { get; internal set; }

    }
}