#ifndef _SDK6212DLL_H_
#define _SDK6212DLL_H_

#define DLL_API extern "C" __declspec (dllimport) 

struct PictureRange
{
    WORD Width;
    WORD Hight;
    WORD Left;
    WORD Right;
    WORD Top;
    WORD Bottom;
};

struct ControlStruct
{
    WORD TriggerSource;
    WORD ChannelSelect;
    WORD TIMEBASE;
    WORD TriggerAddress;
    WORD DataLength;
    WORD BufferSize;
    WORD IsAlt;
};

struct LineColor
{
	WORD R;
	WORD G;
	WORD B;
};

struct AutosetStruct
{
	WORD WhichChannel;
	WORD Ch2Voltage;
	WORD Ch1Voltage;
	WORD Ch2Timebase;
	WORD Ch1Timebase;
	WORD Ch2InGND;
	WORD Ch1InGND;
	WORD Ch2Enabled;
	WORD Ch1Enabled;
};

struct StateStruct
{
	WORD Ch2Filt;
	WORD Ch1Filt;
	WORD TriggerFilt;
	WORD TriggerMode;
	WORD TriggerSlope;
};

struct LeversStruct
{
    WORD Ch2Lever;
    WORD Ch1Lever;
    WORD Ch2TrigLever;
    WORD Ch1TrigLever;
    WORD ExtTrigLever;
};

struct TimeStruct{
	double Timer;
	double Time;
	double ScrollTime;
	double ScrollStart;
};

//Function For Hardware
DLL_API WORD WINAPI sdSearchDevice(WORD DeviceIndex);
DLL_API WORD WINAPI sdGetLevel(WORD DeviceIndex, WORD* pZeroLevel);
DLL_API long WINAPI sdSetTriggerAndSampleRate(WORD DeviceIndex, WORD Trigger_Slope, WORD ETS, struct ControlStruct* Control_Data1, WORD PulseTrigger, WORD PulseTriggerMode, long PulseWidth);
DLL_API WORD WINAPI sdSetVoltageAndCoupling(WORD DeviceIndex, WORD Ch2_Att, WORD Ch1_Att, WORD Ch2_ACDC, WORD Ch1_ACDC,struct ControlStruct* Control_Data1);
DLL_API long WINAPI sdSetFilt(WORD DeviceIndex, struct StateStruct *FiltAndTrigger);
DLL_API bool WINAPI sdSetOffset(WORD DeviceIndex, struct LeversStruct* Levers, WORD Ch2_Att, WORD Ch1_Att,WORD TriggerSource, WORD* level);
DLL_API WORD WINAPI sdCaptureStart(WORD DeviceIndex);
DLL_API WORD WINAPI sdForceTrigger(WORD DeviceIndex);
DLL_API long WINAPI sdTriggerEnabled(WORD DeviceIndex, WORD Timebase);
DLL_API WORD WINAPI sdGetData(WORD DeviceIndex, WORD Ch2_Att, WORD Ch1_Att, WORD* ch2_data, WORD* ch1_data,struct ControlStruct* Control_Data1,struct StateStruct* FiltAndTrigger,struct LeversStruct* levers,WORD* level, int StartCapture, WORD PulseTrigger, WORD PulseTriggerMode, long PulseWidth);


//Functions For Softwear
DLL_API WORD WINAPI sdGetDataSleep(struct ControlStruct* Control_Data1);
DLL_API WORD WINAPI sdMainPanelDrawGrid(HDC hdc, struct PictureRange* view_data);
DLL_API WORD WINAPI sdGetScrollData(WORD DeviceIndex, struct ControlStruct* Control_Data1, struct LeversStruct* levers, struct TimeStruct* TimeState, WORD Ch2_Att, WORD Ch1_Att, WORD* Ch2ScrollData, WORD* Ch1ScrollData, WORD* Ch2DisplayData, WORD* Ch1DisplayData, WORD TriggerPosition, bool Ch2InGND, bool Ch1InGND);
DLL_API double WINAPI sdDisplaySampling(bool Ch1Enabled, bool Ch2Enabled, WORD ETS, WORD TriggerSource, WORD Timebase, WORD BufferSize, double* Time);
DLL_API WORD WINAPI sdGetDisplayData(struct ControlStruct* Control_Data1, WORD* Ch_DisplayData, WORD* ch_HardData);
DLL_API WORD WINAPI sdDisplayData(HDC hdc,struct PictureRange* view_data, WORD isLine, WORD* ch_data, struct LineColor* ch_color);
DLL_API WORD WINAPI sdChannelDataBuffer(struct ControlStruct* Control_Data1, WORD InterpolationLineMode, WORD* ch_BufferData, WORD* ch_HardData);
DLL_API WORD WINAPI sdAutoset(WORD DeviceIndex, struct ControlStruct* Control_Data1, struct AutosetStruct* AutosetData, struct StateStruct* FiltAndTrigger, struct LeversStruct* levers, WORD* level);
DLL_API WORD WINAPI sdChannelInGND(WORD ChPosition, WORD* Ch_data);
DLL_API WORD WINAPI sdSoftFindTriggerPoint(WORD nHTriggerPosition,WORD TIMEBASE,WORD TriggerLever,WORD TriggerSlope,WORD *BufferData);
DLL_API WORD WINAPI sdSoftFindTriggerPointCopy(short nHTriggerPosition,USHORT TriggerPoint,WORD *BufferData);
DLL_API WORD WINAPI sdDisplayDataXYMode(HDC hdc, struct PictureRange * view_data, WORD isLine, WORD * ch1_data, WORD * ch2_data);
#endif