using NIDAQmxConst;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NIDAQmx.Internal
{
    /// Return Type: int32->int
    ///taskHandle: TaskHandle->void*
    ///everyNsamplesEventType: int32->int
    ///nSamples: uInt32->unsigned int
    ///callbackData: void*
    [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.Cdecl)]
    public delegate int DAQmxEveryNSamplesEventCallbackPtr(System.IntPtr taskHandle, EveryNsamplesEventType everyNsamplesEventType, uint nSamples, System.IntPtr callbackData);

    /// Return Type: int32->int
    ///taskHandle: TaskHandle->void*
    ///status: int32->int
    ///callbackData: void*
    [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.Cdecl)]
    public delegate int DAQmxDoneEventCallbackPtr(System.IntPtr taskHandle, int status, System.IntPtr callbackData);

    /// Return Type: int32->int
    ///taskHandle: TaskHandle->void*
    ///signalID: int32->int
    ///callbackData: void*
    [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.Cdecl)]
    public delegate int DAQmxSignalEventCallbackPtr(System.IntPtr taskHandle, int signalID, System.IntPtr callbackData);
    internal class Task
    {/// Return Type: int32->int
     ///taskName: char*
     ///taskHandle: TaskHandle*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxLoadTask([System.Runtime.InteropServices.InAttribute()][System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string taskName, ref System.IntPtr taskHandle);


        /// Return Type: int32->int
        ///taskName: char*
        ///taskHandle: TaskHandle*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxCreateTask([System.Runtime.InteropServices.InAttribute()][System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string taskName, ref System.IntPtr taskHandle);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///channelNames: char*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxAddGlobalChansToTask(System.IntPtr taskHandle, [System.Runtime.InteropServices.InAttribute()][System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string channelNames);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxStartTask(System.IntPtr taskHandle);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxStopTask(System.IntPtr taskHandle);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxClearTask(System.IntPtr taskHandle);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///timeToWait: float64->double
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxWaitUntilTaskDone(System.IntPtr taskHandle, double timeToWait);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///timestampEvent: int32->int
        ///timeout: float64->double
        ///timestamp: CVIAbsoluteTime*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxWaitForValidTimestamp(System.IntPtr taskHandle, int timestampEvent, double timeout, ref CVIAbsoluteTime timestamp);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///isTaskDone: bool32*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxIsTaskDone(System.IntPtr taskHandle, ref uint isTaskDone);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///action: int32->int
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxTaskControl(System.IntPtr taskHandle, TaskControl action);

        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///index: uInt32->unsigned int
        ///buffer: char*
        ///bufferSize: int32->int
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxGetNthTaskChannel(System.IntPtr taskHandle, uint index, StringBuilder buffer, int bufferSize);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///index: uInt32->unsigned int
        ///buffer: char*
        ///bufferSize: int32->int
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxGetNthTaskDevice(System.IntPtr taskHandle, uint index, StringBuilder buffer, int bufferSize);

        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///data: char*
        ///bufferSize: uInt32->unsigned int
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxGetTaskName(System.IntPtr taskHandle, IntPtr data, uint bufferSize);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///data: char*
        ///bufferSize: uInt32->unsigned int
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxGetTaskChannels(System.IntPtr taskHandle, IntPtr data, uint bufferSize);

        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///data: uInt32*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxGetTaskNumChans(System.IntPtr taskHandle, ref uint data);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///data: char*
        ///bufferSize: uInt32->unsigned int
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxGetTaskDevices(System.IntPtr taskHandle, ref byte data, uint bufferSize);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///data: uInt32*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxGetTaskNumDevices(System.IntPtr taskHandle, ref uint data);


        /// Return Type: int32->int
        ///taskHandle: TaskHandle->void*
        ///data: bool32*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public delegate NIDAQmx.DAQmxEnum.Result DAQmxGetTaskComplete(System.IntPtr taskHandle, ref uint data);

        /// Return Type: int32->int
        ///task: TaskHandle->void*
        ///everyNsamplesEventType: int32->int
        ///nSamples: uInt32->unsigned int
        ///options: uInt32->unsigned int
        ///callbackFunction: DAQmxEveryNSamplesEventCallbackPtr
        ///callbackData: void*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public unsafe delegate NIDAQmx.DAQmxEnum.Result DAQmxRegisterEveryNSamplesEvent(System.IntPtr task, EveryNsamplesEventType everyNsamplesEventType, uint nSamples, uint options, DAQmxEveryNSamplesEventCallbackPtr callbackFunction, void* callbackData);


        /// Return Type: int32->int
        ///task: TaskHandle->void*
        ///options: uInt32->unsigned int
        ///callbackFunction: DAQmxDoneEventCallbackPtr
        ///callbackData: void*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public unsafe delegate NIDAQmx.DAQmxEnum.Result DAQmxRegisterDoneEvent(System.IntPtr task, uint options, DAQmxDoneEventCallbackPtr callbackFunction, void* callbackData);


        /// Return Type: int32->int
        ///task: TaskHandle->void*
        ///signalID: int32->int
        ///options: uInt32->unsigned int
        ///callbackFunction: DAQmxSignalEventCallbackPtr
        ///callbackData: void*
        [System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
        public unsafe delegate NIDAQmx.DAQmxEnum.Result DAQmxRegisterSignalEvent(System.IntPtr task, int signalID, uint options, DAQmxSignalEventCallbackPtr callbackFunction, void* callbackData);


    }
}
