// VTK-RELAY-01 API V1.1 2020/01/02

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Runtime.InteropServices;

namespace VTK_RELAY_01_Utility
{
    class VTK_RELAY_01
    {
        private const string DLL_PATH = "VTK_RELAY_01.dll";

        [DllImport(DLL_PATH)]
        public static extern void ExIO_Get_DLL_Version(ref int pnMajorVersion, ref int pnMinorVersion);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_Connect(int nSerialPortNum);

        [DllImport(DLL_PATH)]
        public static extern void ExIO_Disconnect();

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetMCUVersion(ref int pnMCUVersion);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetDTPVersion(ref int pnDTPVersion);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetBLVersion(ref int pnBLVersion);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetDTPType(ref int pnDTPType);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetIgnitionStatus(ref int pnIgnitionStatus);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetSupplyVoltage(ref int pnSupplyVoltage);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_SetFlashUpdate();

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetExtGPILevel(ref int pnGPI12, ref int pnGPI34);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetExtGPOPullUp(ref int pnGPI12, ref int pnGPI34);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetExtGPIStatus(ref int pnGPI1, ref int pnGPI2, ref int pnGPI3, ref int pnGPI4);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetExtGPOStatus(ref int pnGPO1, ref int pnGPO2, ref int pnGPO3, ref int pnGPO4);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetRelayStatus(ref int pnRelay1, ref int pnRelay2, ref int pnRelay3, ref int pnRelay4);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetInputCurrent(ref int pnInputCurrent);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetInputVoltage(ref int pnInputVoltage);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_GetInputFrequency(ref int pnInputFrequency);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_SetExtGPILevelControl(int nGPI12, int nGPI34);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_SetExtGPOPullUpControl(int nGPO12, int nGPO34);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_SetExtGPOControl(int nGPO1, int nGPO2, int nGPO3, int nGPO4);

        [DllImport(DLL_PATH)]
        public static extern int ExIO_SetRelayControl(int nRelay1, int nRelay2, int nRelay3, int nRelay4);
    }
}
