using System.Runtime.InteropServices;
using System;

namespace Raytheon.Instruments
{
    public static class NiseNativeMethods
   {
        public enum MulticonnectMode
        {
            MulticonnectRoutes,
            NoMulticonnect,
            UseDefault
        }

        // NISEStatus niSE_ClearError(Val NISESession hSession)
        [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)]
        internal static extern Int32 niSE_ClearError(Int32 hSession);

        // NISEStatus niSE_CloseSession(Val NISESession hSession)
        [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)]
        internal static extern Int32 niSE_CloseSession(Int32 hSession);

        // NISEStatus niSE_Connect(Val NISESession hSession, Val string connectSpec, Val __MIDL___MIDL_itf_Nise_0115_0003 multiconnectMode, NISEBoolean waitForDebounce);
        [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)]
        internal static extern Int32 niSE_Connect(Int32 hSession, string route, MulticonnectMode multiconnectMode, bool waitForDebounce);

        // NISEStatus niSE_Disconnect(Val NISESession hSession, Val string disconnectSpec);
        [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)]
        internal static extern Int32 niSE_Disconnect(Int32 hSession, string disconnectSpec);

        // NISEStatus niSE_DisconnectAll(Val NISESession hSession);
        [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)]
        internal static extern Int32 niSE_DisconnectAll(Int32 hSession);

        // NISEStatus niSE_IsDebounced(Val NISESession hSession, Var NISEBoolean isDebounced);
        [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)]
        internal static extern Int32 niSE_IsDebounced(Int32 hSession, out bool isDebounced);

        // NISEStatus niSE_OpenSession(Val string virtualDeviceName, Val string option, Var NISESession hSession)
        [DllImport(@"C:\Windows\SysWOW64\nise.dll", CharSet = CharSet.Ansi, BestFitMapping = false)]
        internal static extern Int32 niSE_OpenSession(string virtualDeviceName, string options, out Int32 hSession);
    }
}

