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 KwdlStatus
    {

        public KwdlStatus(uint status)
        {
            AntennaPort = (int)((status & (uint)BitMask.AntennaPort) >> (int)Bit.AntennaPort);
            Channel = (int)((status & (uint)BitMask.Channel) >> (int)Bit.Channel);
            DestinationId = (int)((status & (uint)BitMask.DestinationId) >> (int)Bit.DestinationId);
            Location = (KwdlLocation)((status & (uint)BitMask.Location) >> (int)Bit.Location);
            RFPower = (int)((status & (uint)BitMask.RFPower) >> (int)Bit.RFPower);
            SourceId = (int)((status & (uint)BitMask.SourceId) >> (int)Bit.SourceId);
        }

        #region Private Members

        private enum BitMask
        {
            DestinationId = 0x0000_000F,
            SourceId = 0x0000_00F0,
            Channel = 0x0000_3F00,
            Location = 0x0001_0000,
            AntennaPort = 0x0030_0000,
            RFPower = 0x0300_0000
        }

        private enum Bit
        {
            DestinationId = 0,
            SourceId = 4,
            Channel = 8,
            Location = 16,
            AntennaPort = 20,
            RFPower = 24
        }

        #endregion

        public int RFPower { get; internal set; }

        public int AntennaPort { get; internal set; }

        public KwdlLocation Location { get; internal set; }

        public int Channel { get; internal set; }

        public int SourceId { get; internal set; }

        public int DestinationId { get; internal set; }

    }
}