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 EdaConfig
    {
        public EdaConfig(uint status)
        {
            KwdlLinkUp = Convert.ToBoolean(status & (uint)EdaConfigure.KwdlLinkUp);
            KwdlState = (KwdlState)((status & (uint)EdaConfigure.KwdlState) >> (int)Bit.KwdlState);
            KwdlPbitPass = Convert.ToBoolean(status & (uint)EdaConfigure.KwdlPbitPass);
            KwdlMbitComplete = Convert.ToBoolean(status & (uint)EdaConfigure.KwdlMbitComplete);
            KwdlMbitPass = Convert.ToBoolean(status & (uint)EdaConfigure.KwdlMbitPass);
            KwdlRFTemp = Convert.ToInt32((status & (uint)EdaConfigure.KwdlRFTemp) >> (int)Bit.KwdlRFTemp);
            EdaNumCVClear = Convert.ToInt32((status & (uint)EdaConfigure.EdaNumCVClear) >> (int)Bit.EdaNumCVClear);
            EdaCVClearPassFail = Convert.ToBoolean(status & (uint)EdaConfigure.EdaCVClearPassFail);
            EdaCVClearPassFailValid = Convert.ToBoolean(status & (uint)EdaConfigure.EdaCVClearPassFailValid);
            EdaCVReady = Convert.ToBoolean(status & (uint)EdaConfigure.EdaCVReady);
            EdaCVReadyValid = Convert.ToBoolean(status & (uint)EdaConfigure.EdaCVReadyValid);
            EdaPbitPass = Convert.ToBoolean(status & (uint)EdaConfigure.EdaPbitPass);
            EdaPbitValid = Convert.ToBoolean(status & (uint)EdaConfigure.EdaPbitValid);
        }

        #region Internal Members

        internal enum Bit
        {
            EdaPbitValid = 0,
            EdaPbitPass = 1,
            EdaCVReadyValid = 2,
            EdaCVReady = 3,
            EdaCVClearPassFailValid = 4,
            EdaCVClearPassFail = 5,
            EdaNumCVClear = 6,
            KwdlRFTemp = 16,
            KwdlMbitPass = 24,
            KwdlMbitComplete = 25,
            KwdlPbitPass = 26,
            KwdlState = 27,
            KwdlLinkUp = 30
        }

        #endregion

        public int KwdlRFTemp { get; set; }

        public bool EdaPbitValid { get; set; }

        public bool EdaCVReadyValid { get; set; }

        public bool EdaPbitPass { get; set; }

        public bool EdaCVReady { get; set; }

        public bool EdaCVClearPassFailValid { get; set; }

        public bool EdaCVClearPassFail { get; set; }

        public int EdaNumCVClear { get; set; }

        public bool KwdlMbitPass { get; set; }

        public bool KwdlMbitComplete { get; set; }

        public bool KwdlPbitPass { get; set; }

        public Raytheon.GuidedElectronicsUnit.KwdlState KwdlState { get; set; }

        public bool KwdlLinkUp { get; set; }

    }
}