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

namespace Raytheon.GuidedElectronicsUnit
{
    public interface IGuidedElectronicsUnit
    {
        IGuidedElectronicsUnitDiscrete Discrete { get; }
        IGuidedElectronicsUnitInertialMeasurementUnitEmulator InertialMeasurementUnitEmulator { get; }
        IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator EncryptorDecryptorAssemblyEmulator { get; }
        IGuidedElectronicsUnitLowLevel LowLevel { get; }
        IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator IntegratedDewarAssemblyInterfaceEmulator { get; }
        IGuidedElectronicsUnitGsKwSyncronousDataLinkControl GsKwSyncronousDataLinkControl { get; }
        IGuidedElectronicsUnitTestControl TestControl { get; }
    }

    public interface IGuidedElectronicsUnitDiscrete
    {
        Raytheon.GuidedElectronicsUnit.SignalState NcDacsKwOrdEn { get; }
    }

    public interface IGuidedElectronicsUnitInertialMeasurementUnitEmulator
    {
        SdlcStatus FetchStatus();
        void SetDataWord(Raytheon.GuidedElectronicsUnit.ImuMessageWord word, uint data);
        ImuMessage FetchMessageData();
        void Configure(Raytheon.GuidedElectronicsUnit.ImuConfigure control, Raytheon.GuidedElectronicsUnit.ControlState state);
        ImuConfig FetchConfiguration();
        double EODSampleWidth { get; set; }
        ImuDiscreteInput FetchDiscreteInput();
        void SdlcControl(Raytheon.GuidedElectronicsUnit.SdlcControlBits control, Raytheon.GuidedElectronicsUnit.ControlState state);
        SdlcFifoWrCount FifoWrCount { get; }
        RxSdlcMessage ReadMessage();
        RxSdlcMessage[] ReadAllMessages();
        void SendMessage(uint[] data);

        Raytheon.GuidedElectronicsUnit.ControlState FrameEnable { get; set; }
        double FramePeriod { get; set; }
    }

    public interface IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulator
    {
        IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA ChannelA { get; }
    }

    public interface IGuidedElectronicsUnitLowLevel
    {
        IGuidedElectronicsUnitLowLevelHSSub6020a HSSub6020a { get; }
        IGuidedElectronicsUnitLowLevelHSSub9100 HSSub9100 { get; }
    }

    public interface IGuidedElectronicsUnitLowLevelHSSub6020a
    {
        FirmwareInformation GetFirmwareInfo();
        TdfPllStatus GetPllStatus();
        uint ReadRegister(uint address);
        void WriteRegister(uint address, uint data);
        void Reset();
        void ReadModifyWrite(uint address, uint data, uint mask);
        int Chassis { get; }
        string Descriptor { get; }
        string SerialNumber { get; }
        int Slot { get; }
        double DieTemp { get; }
        double VccInt { get; }
        double VccAux { get; }
        bool IsSimulated { get; }
        Raytheon.GuidedElectronicsUnit.ControlState EnableIO { get; set; }
        void ResetEmStatus();
        EmStatus EmStatus { get; }
    }

    public interface IGuidedElectronicsUnitIntegratedDewarAssemblyInterfaceEmulator
    {
        Raytheon.GuidedElectronicsUnit.ControlState Control { get; set; }
        IdaStatus Status { get; }
        uint Version { get; }
    }

    public interface IGuidedElectronicsUnitLowLevelHSSub9100
    {
        FirmwareInformation GetFirmwareInfo();
        TdfPllStatus GetPllStatus();
        uint ReadRegister(uint address);
        void WriteRegister(uint address, uint data);
        void Reset();
        void ReadModifyWrite(uint address, uint data, uint mask);
        int Chassis { get; }
        string Descriptor { get; }
        string SerialNumber { get; }
        int Slot { get; }
        double DieTemp { get; }
        double VccInt { get; }
        double VccAux { get; }
        bool IsSimulated { get; }
        Raytheon.GuidedElectronicsUnit.ControlState EnableIO { get; set; }
        AuroraStatus GetAuroraStatus();
    }

    public interface IGuidedElectronicsUnitGsKwSyncronousDataLinkControl
    {
        void SdlcControl(SdlcControlBits control, ControlState state);
        SdlcStatus FetchStatus();
        void SendMessage(uint[] data);

        event EventHandler<SdlcEventArgs> AutoForwardBufferCapacityWarning;
        SdlcFifoWrCount FifoWrCount { get; }
        bool Sync { get; set; }
        byte[] FetchMessageData();
        RxSdlcMessage ReadMessage();
        RxSdlcMessage[] ReadAllMessages();
        event EventHandler<SdlcEventArgs> AutoForwardProcessExited;

        RxSdlcAutoForwardBuffer SdlcAutoForwardBuffer { get; }
    }

    public interface IGuidedElectronicsUnitTestControl
    {
        void WaitForMsg(ushort count);
    }

    public interface IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelA
    {
        IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT PT { get; }
        IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS CS { get; }
        Scoreboard FetchScoreboard();
        KwdlStatus FetchKwdlStatus();
        byte[] FetchCVData();
        CvcwData FetchCVCWData();
        void Configure(EdaConfig configuration);
        EdaStatus FetchEdaStatus();
        EdaConfig FetchConfiguration();
        bool EdaPbitValid { get; set; }
        bool EdaPbitPass { get; set; }
        bool EdaCVReadyValid { get; set; }
        bool EdaCVReady { get; set; }
        bool EdaCVClearPassFailValid { get; set; }
        bool EdaCVClearPassFail { get; set; }
        short EdaNumCVClear { get; set; }
        short KwdlRFTemp { get; set; }
        bool KwdlMbitPass { get; set; }
        bool KwdlMbitComplete { get; set; }
        bool KwdlPbitPass { get; set; }
        Raytheon.GuidedElectronicsUnit.KwdlState KwdlState { get; set; }
        bool KwdlLinkUp { get; set; }
    }

    public interface IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelAPT
    {
        void SdlcControl(SdlcControlBits control, ControlState state);
        SdlcStatus FetchSdlcStatus();
        RxSdlcMessage[] ReadAllMessages();
        RxSdlcMessage ReadMessage();
        void SendMessage(uint[] data);
        SdlcFifoWrCount FifoWrCount { get; }
    }

    public interface IGuidedElectronicsUnitEncryptorDecryptorAssemblyEmulatorChannelACS
    {
        SdlcStatus FetchSdlcStatus();
        void SdlcControl(SdlcControlBits control, ControlState state);
        RxSdlcMessage[] ReadAllMessages();
        RxSdlcMessage ReadMessage();
        void SendMessage(uint[] data);
        SdlcFifoWrCount FifoWrCount { get; }
    }
}
