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 EdaStatus
    {
        public EdaStatus(uint status)
        {
            CryptoGoValue = Convert.ToBoolean(status & (uint)BitMask.CryptoGoValue);
            XcvrPowerMode = (EdaPowerMode)((status & (uint)BitMask.XcvrPowerMode) >> (int)Bit.XcvrPowerMode);
            DataBusMode = (EdaDataBusMode)((status & (uint)BitMask.DataBusMode) >> (int)Bit.DataBusMode);
            LowPowerMode = (EdaPowerMode)((status & (uint)BitMask.LowPowerMode) >> (int)Bit.LowPowerMode);
            TerminalId = (int)((status & (uint)BitMask.TerminalId) >> (int)Bit.TerminalId);
        }

        #region Private Members

        private enum BitMask
        {
            CryptoGoValue = 0x0000_0800,
            XcvrPowerMode = 0x0000_0300,
            DataBusMode = 0x0000_0030,
            LowPowerMode = 0x0000_0003,
            TerminalId = 0x0000_F000
        }

        private enum Bit
        {
            LowPowerMode = 0,
            DataBusMode = 4,
            XcvrPowerMode = 8,
            TerminalId = 12
        }

        #endregion

        public bool CryptoGoValue { get; internal set; }

        public EdaPowerMode XcvrPowerMode { get; internal set; }

        public EdaDataBusMode DataBusMode { get; internal set; }

        public EdaPowerMode LowPowerMode { get; internal set; }

        public int TerminalId { get; internal set; }

    }
}