#pragma once
#ifndef DLL_API
#define DLL_API extern "C" _declspec(dllimport)
#endif
#define WIN_API __stdcall
DLL_API WORD WINAPI dsoHTSearchDevice(short* pDevInfo);   //获取1-32个端口是否存在USB设备

DLL_API WORD WINAPI dsoHTDeviceConnect(WORD nDeviceIndex);    //测试设备是否存在

DLL_API WORD WINAPI dsoHTSetCHDirectLeverPos(WORD nDeviceIndex,WORD nPos,WORD nCH); 
//设置采样率
DLL_API WORD WINAPI dsoHTSetSampleRate(WORD nDeviceIndex,  double *fTimeDiv); 

DLL_API WORD WINAPI dsoHTStartCollectData(WORD nDeviceIndex,WORD nStartControl);

DLL_API WORD WINAPI dsoHTGetState(WORD nDeviceIndex,PUCHAR pdate);

DLL_API WORD WINAPI dsoHTCollectDataWave(WORD nDeviceIndex, WORD* pCH1Data, WORD* pCH2Data, WORD* pCH3Data, WORD* pCH4Data, ULONG nReadLen=0);
DLL_API WORD WINAPI dsoHTCollectSegment(WORD nDeviceIndex, WORD* pCH1Data, WORD* pCH2Data, WORD* pCH3Data, WORD* pCH4Data, long nSegmentNum, SegmentTime *pTIME);
DLL_API WORD WINAPI dsoHTCollectSegmentHead(WORD nDeviceIndex, long *nStart, long *nEnd, SegmentTime *pTIME);
DLL_API WORD WINAPI dsoHTCollectDataModeFluo(WORD DeviceIndex, PUCHAR pData);

DLL_API WORD WINAPI dsoHTGetData(WORD nDeviceIndex,WORD* pCH1Data,WORD* pCH2Data,WORD* pCH3Data,WORD* pCH4Data,PCONTROLDATA pControl/*,ULONG* p1,ULONG* p2,ULONG* p3*/);

DLL_API WORD WINAPI dsoHTGetScanData(WORD nDeviceIndex, WORD* pCH1Data, WORD* pCH2Data, WORD* pCH3Data, WORD* pCH4Data, char bPre);

DLL_API WORD WINAPI dsoHTReadCalibrationData(WORD nDeviceIndex,WORD* pLevel);

DLL_API WORD WINAPI dsoHTWriteCalibrationData(WORD nDeviceIndex,WORD* pLevel);

DLL_API WORD WINAPI dsoHTGetRollData(WORD nDeviceIndex, WORD* pCH1Data, WORD* pCH2Data, WORD* pCH3Data, WORD* pCH4Data);

DLL_API WORD WINAPI dsoHTGetHardFC(WORD nDeviceIndex,PULONG pFreq,PULONG pCount);

DLL_API WORD WINAPI dsoHTSetHardFC(WORD nDeviceIndex, WORD nCountSet,ULONG nTime=0);

DLL_API WORD WINAPI dsoHTResetCnter(WORD nDeviceIndex);

DLL_API WORD WINAPI dsoHTStartRoll(WORD nDeviceIndex);

DLL_API WORD WINAPI dsoGetFPGAVersion(WORD DeviceIndex);

DLL_API BOOL WINAPI dsoSetUSBBus(WORD DeviceIndex);

DLL_API BOOL WINAPI dsoSetSPIBus(WORD DeviceIndex);

DLL_API BOOL WINAPI dsoSetHardInfo(WORD DeviceIndex,UCHAR* pBuffer);

DLL_API BOOL WINAPI dsoGetHardInfo(WORD DeviceIndex,UCHAR* pBuffer);

DLL_API BOOL WINAPI dsoWriteFlash(WORD DeviceIndex,char* filename=NULL);

DLL_API BOOL WINAPI dsoReadFlash(WORD DeviceIndex,UCHAR* pBuffer);

DLL_API BOOL WINAPI dsoGetDeviceName(WORD DeviceIndex,UCHAR* pBuffer);
DLL_API BOOL WINAPI dsoGetDeviceSN(WORD DeviceIndex,UCHAR* pBuffer);
DLL_API BOOL WINAPI dsoGetPCBVersion(WORD DeviceIndex,UCHAR* pBuffer);

DLL_API WORD WINAPI dsoGetDriverVersion(WORD DeviceIndex,UCHAR* pBuffer);
DLL_API WORD WINAPI dsoWriteIIC(WORD DeviceIndex,PUCHAR pBuffer,ULONG nLenUpdateFileLen);
//-----------DDS--------------
DLL_API ULONG WINAPI ddsSetOnOff(WORD DeviceIndex,short nOnOff);
DLL_API ULONG WINAPI ddsSetFrequency(WORD DeviceIndex,double dbFre,WORD* pWaveNum,WORD* pPeriodNum);
DLL_API ULONG WINAPI ddsDownload(WORD DeviceIndex,WORD iWaveNum, WORD* pData);
DLL_API ULONG WINAPI ddsSetCmd(WORD DeviceIndex, USHORT nControl);
DLL_API ULONG WINAPI ddsEmitSingle(WORD DeviceIndex);  //zhang 
DLL_API WORD WINAPI ddsSetFAOC(WORD DeviceIndex, double dFre,WORD nAmpVolt,SHORT nOffsetVolt,ULONG nPeriodNum,double fAMDepth,double dbFMMAXOffset);
DLL_API ULONG WINAPI ddsSetSweep(WORD DeviceIndex, WORD nControl);
DLL_API ULONG WINAPI ddsSetAMFMFreq(WORD DeviceIndex,double dbFre);
DLL_API WORD  WINAPI dsoReadIIC(WORD DeviceIndex,UCHAR* pBuffer,ULONG nLen);

DLL_API WORD WINAPI dsoHTWRAmpCali(WORD nDeviceIndex, float* level);//写入幅度校准信息
DLL_API WORD WINAPI dsoHTRDAmpCali(WORD nDeviceIndex, float* level);//读取幅度校准信息
DLL_API WORD WINAPI dsoInitHard(WORD DeviceIndex);
DLL_API WORD WINAPI dsoHTADCCHModGain(WORD DeviceIndex,WORD nCHMod);
DLL_API WORD WINAPI dsoHTSetVideoTriger(WORD m_nDeviceIndex,USHORT nStand,USHORT nVedioSyncSelect,USHORT nVideoHsyncNumOption,USHORT nVideoPositive,WORD nLevel,WORD nLogicTriggerSource);
DLL_API WORD WINAPI dsoHTSetPulseTriger(WORD m_nDeviceIndex,ULONG nPW,WORD nPWCondition);

DLL_API BOOL WINAPI dsoSetDDSCali(WORD DeviceIndex,WORD* level,WORD length);
DLL_API BOOL WINAPI dsoGetDDSCali(WORD DeviceIndex,WORD* level,WORD length);

DLL_API WORD WINAPI dsoGetInBufferWithoutOpen(HANDLE hInDevice,UINT m_nSize,PUCHAR pBuffer);
DLL_API WORD WINAPI dsoGetInBuffer(WORD DeviceIndex,UINT m_nSize,PUCHAR pBuffer);
DLL_API WORD WINAPI dsoSendOutBuffer(WORD DeviceIndex,UINT m_nSize,PUCHAR pBuffer);

//DLL_API BOOL WINAPI dsoSetFluo(WORD DeviceIndex, PDEVICE_CONTROL pControl,bool bSet=true);

//////////////////////////////////////状态获取设置////////////////////////////////////
DLL_API WORD WINAPI dsoHTStatusCHMode(WORD DeviceIndex);
DLL_API ULONG WINAPI dsoHTStatusMaxSegmentNum(WORD nDeviceIndex);
DLL_API double WINAPI dsoHTStatusSampleRate(WORD DeviceIndex);
DLL_API double WINAPI dsoHTStatusInterpolation(WORD DeviceIndex,char bIgnoreEts=0);
DLL_API WORD WINAPI dsoHTSetSampleRateDiv(WORD nDeviceIndex, WORD nTimeDIV);


DLL_API void WINAPI dsoHTAttribsCHVolt(WORD nDeviceIndex, char nCH, float *fVolt,char bGet,char nOption=0);
DLL_API void WINAPI dsoHTAttribsCHPos(WORD nDeviceIndex, char nCH, WORD *nPos, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsWaveVector(WORD nDeviceIndex, char *bVector, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsGridType(WORD nDeviceIndex, char *nType, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsGridintensity(WORD nDeviceIndex, char *nIntesity, char bGet=1);
DLL_API void WINAPI dsoHTAttribsWaveintensity(WORD nDeviceIndex, char *nIntesity, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsBKColor(WORD nDeviceIndex, COLORREF *nBKColor, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsCHColor(WORD m_nDeviceIndex, char nCH, COLORREF *nCHColor,char bGet=1);
DLL_API void WINAPI dsoHTAttribsColorTemperature(WORD m_nDeviceIndex, char *bColorTemperature, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsPersisTime(WORD nDeviceIndex, double *PersisiTime, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsAcquireMode(WORD nDeviceIndex, char *nAcquireType, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsInsertType(WORD nDeviceIndex, char *nInsertType, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsAcqOption(WORD nDeviceIndex, char *nOption, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsDelayed(WORD nDeviceIndex, char *bDelayed, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsDelayedColor(WORD nDeviceIndex, COLORREF *nColor, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsCHDelay(WORD nDeviceIndex, char nCH, int *nDelay, char bGet=1);
DLL_API void WINAPI dsoHTAttribsBufferLength(WORD nDeviceIndex, ULONG *nBufferLength, char bGet=1);
DLL_API void WINAPI dsoHTAttribsSegmentNum(WORD nDeviceIndex, ULONG *nSegmentNum, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsCHEnable(WORD nDeviceIndex, char nCH, char *bEnable, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsHTriggerPos(WORD nDeviceIndex, char *nPos, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsTriggerSource(WORD nDeviceIndex, char *nTriggerSource, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsTriggerMode(WORD nDeviceIndex, char *nTriggerMode, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsTriggerSlop(WORD nDeviceIndex, char *nTriggerSlop, char bGet=1);
DLL_API void WINAPI dsoHTAttribsTriggerSweep(WORD nDeviceIndex, char *nTriggerSweep, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsPulseCondition(WORD nDeviceIndex, char *nCondition, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsPulseWidth(WORD nDeviceIndex, ULONG *nPW, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsVideoNum(WORD nDeviceIndex, ULONG *nNum, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsVideoPositive(WORD nDeviceIndex, char *bPositive, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsVideoStandard(WORD nDeviceIndex, char *nStandard, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsVideoSync(WORD nDeviceIndex, char *Sync, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsCHCouple(WORD nDeviceIndex, UCHAR nCH, CHAR * nCHCouple, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsCHInvert(WORD nDeviceIndex, UCHAR nCH, char * bInvert, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsCurCH(WORD nDeviceIndex, CHAR * nCurCH, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsZeroCali(WORD nDeviceIndex, CHAR * bCali, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsAmpCali(WORD nDeviceIndex, CHAR * bCali, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsVTriggerPos(WORD nDeviceIndex, WORD nCH, char bGet, WORD *nPos1, WORD *nPos2=NULL);
DLL_API void WINAPI dsoHTAttribsBW(WORD nDeviceIndex, char nCH, char * bBW, char bGet = 1);
DLL_API void WINAPI dsoHTAttribsHardCheckOption(WORD nDeviceIndex, WORD  *Option, char bGet = 1);
DLL_API void WINAPI dsoHTSetInputDeviceIndex(WORD nDeviceIndex, WORD  nAddr, int nDate);


DLL_API void WINAPI dsoHTAttribsDeviceBW(WORD nDeviceIndex, WORD  *Option, char bGet = 1);











/*
DLL_API WORD WINAPI dsoHTSetCHAndTrigger(WORD nDeviceIndex,PRELAYCONTROL pRelayControl,WORD nTimeDIV);

DLL_API WORD WINAPI dsoHTSetCHAndTriggerVB(WORD nDeviceIndex,WORD* pCHEnable,WORD* pCHVoltDIV,WORD* pCHCoupling,WORD* pCHBWLimit,WORD nTriggerSource,WORD nTriggerFilt,WORD nALT,WORD nTimeDIV);

DLL_API WORD WINAPI dsoHTSetHTriggerLength(WORD nDeviceIndex,PCONTROLDATA pControl,WORD nCHMod);
DLL_API WORD WINAPI dsoHTSetAmpCalibrate(WORD nDeviceIndex,WORD nCHSet,WORD nTimeDIV,WORD *pLevel,WORD *nVoltDiv,WORD *pCHPos);
DLL_API WORD WINAPI dsoHTSetTriggerAndSyncOutput(WORD nDeviceIndex,PCONTROLDATA pControl,WORD nTriggerMode,WORD nTriggerSlope,WORD nPWCondition,
ULONG nPW,USHORT nVideoStandard,USHORT nVedioSyncSelect,USHORT nVideoHsyncNumOption,WORD nSync);

DLL_API WORD WINAPI dsoHTSetRamAndTrigerControl(WORD DeviceIndex,WORD nTimeDiv,WORD nCHset,WORD nTrigerSource,WORD nPeak);//设置触发源
DLL_API WORD WINAPI dsoHTSetTrigerMode(WORD m_nDeviceIndex,WORD nTriggerMode,WORD nTriggerSlop,WORD nTriggerCouple);

*/