/*---------------------------------------------------------------------------*/
/*                                                                           */
/* FILE:    jeti_core.h														 */
/* VERSION:	2.3.3															 */
/*                                                                           */
/* PURPOSE: This is the header file for jeti_core.dll. It is used by the	 */
/*          calling project to gain access to the library functions			 */
/*																			 */
/*			It is not allowed to change or add code here!					 */
/*                                                                           */
/*			Copyright(c)2012 by JETI Technische Instrumente GmbH			 */
/*---------------------------------------------------------------------------*/

/* DLL-Function Prototypes */

typedef void (__stdcall *vCallbackFunction) (void); 


#if !defined _USRDLL
#if defined __cplusplus
extern "C" {
#endif
#endif

DWORD __stdcall JETI_GetNumDevices (DWORD *dwNumDevices);
DWORD __stdcall JETI_GetSerialDevice (DWORD dwDeviceNum, DWORD *dwSerial1, DWORD *dwSerial2);
DWORD __stdcall JETI_OpenDevice (DWORD dwDeviceNum, DWORD *dwDevice);
DWORD __stdcall JETI_OpenCOMDevice (DWORD dwComPort, DWORD dwBaudrate, DWORD *dwDevice);
DWORD __stdcall JETI_CloseDevice (DWORD dwDevice);
DWORD __stdcall JETI_Reset (DWORD dwDevice);
DWORD __stdcall JETI_HardReset (DWORD dwDevice);
DWORD __stdcall JETI_Break (DWORD dwDevice);
DWORD __stdcall JETI_InitMeasure (DWORD dwDevice);
DWORD __stdcall JETI_MeasureStatusCore (DWORD dwDevice, BOOL *boStatus);
DWORD __stdcall JETI_ReadCalib (DWORD dwDevice, DWORD dwCalibNr, char *cMode, char *cRemark, DWORD *dwBegin, DWORD *dwEnd, DWORD *dwStep, DWORD *dwTint, double *dValue);
DWORD __stdcall JETI_GetCalibRange (DWORD dwDevice, DWORD *dwBegin, DWORD *dwEnd, DWORD *dwStep);
DWORD __stdcall JETI_SetCalib (DWORD dwDevice, BYTE bCalibNr);
DWORD __stdcall JETI_GetCalib (DWORD dwDevice, BYTE *bCalibNr);
DWORD __stdcall JETI_MeasCompDark (DWORD dwDevice);
DWORD __stdcall JETI_SetComSearch (DWORD dwComPort);
DWORD __stdcall JETI_GetComPortHandle (DWORD dwDevice, HANDLE* hComPortHandle);
DWORD __stdcall JETI_MeasureADC1 (DWORD dwDevice, WORD *wADC1);
DWORD __stdcall JETI_MeasureADC2 (DWORD dwDevice, WORD *wADC2);
DWORD __stdcall JETI_ReadUserData64 (DWORD dwDevice, BYTE *bData, DWORD dwStart, DWORD dwEnd);
DWORD __stdcall JETI_WriteUserData64 (DWORD dwDevice, BYTE *bData, DWORD dwBlock);
DWORD __stdcall JETI_GetCoreDLLVersion (WORD *wMajorVersion, WORD *wMinorVersion, WORD *wBuildNumber);
DWORD __stdcall JETI_GetFirmwareVersion (DWORD dwDevice, char *cVersionString);
DWORD __stdcall JETI_GetDeviceType (DWORD dwDevice, BYTE *bDeviceType);
DWORD __stdcall JETI_GetLastError (DWORD dwDevice, DWORD *dwErrorCode);

// Parameter functions (jeti_param.c)
DWORD __stdcall JETI_GetPixel (DWORD dwDevice, DWORD *dwPixel);
DWORD __stdcall JETI_GetFit (DWORD dwDevice, FLOAT *fFit);
DWORD __stdcall JETI_GetSDelay (DWORD dwDevice, DWORD *dwSDelay);
DWORD __stdcall JETI_GetTint (DWORD dwDevice, DWORD *dwTint);
DWORD __stdcall JETI_GetADCRes (DWORD dwDevice, BYTE *bADCRes);
DWORD __stdcall JETI_GetSplitTime (DWORD dwDevice, DWORD *dwSplitTime);
DWORD __stdcall JETI_GetBorder (DWORD dwDevice, BYTE *bBorderMin, BYTE *bBorderMax);
DWORD __stdcall JETI_GetDistance (DWORD dwDevice, DWORD *dwDistance);
DWORD __stdcall JETI_SetDistance (DWORD dwDevice, DWORD dwDistance);
DWORD __stdcall JETI_GetParamBlock (DWORD dwDevice, BYTE *bParam);
DWORD __stdcall JETI_SetParamBlock (DWORD dwDevice, BYTE *bParam);
DWORD __stdcall JETI_GetOptTrigg (DWORD dwDevice, BOOL *boOptTrigg);

// Control functions (jeti_contr.c)
DWORD __stdcall JETI_GetLaserStat (DWORD dwDevice, BOOL *boLaserStat);
DWORD __stdcall JETI_SetLaserStat (DWORD dwDevice, BOOL boLaserStat);
DWORD __stdcall JETI_GetShutterStat (DWORD dwDevice, BOOL *boShutterStat);
DWORD __stdcall JETI_SetShutterStat (DWORD dwDevice, BOOL boShutterStat);
DWORD __stdcall JETI_GetMeasHead (DWORD dwDevice, BYTE *bMeasHead);
DWORD __stdcall JETI_GetAux1Stat (DWORD dwDevice, BOOL *boAuxStat);
DWORD __stdcall JETI_SetAux1Stat (DWORD dwDevice, BOOL boAuxStat);
DWORD __stdcall JETI_GetAux2Stat (DWORD dwDevice, BOOL *boAuxStat);
DWORD __stdcall JETI_SetAux2Stat (DWORD dwDevice, BOOL boAuxStat);
DWORD __stdcall JETI_AuxOut1 (DWORD dwDevice, BOOL boAux1);
DWORD __stdcall JETI_AuxOut1Stat (DWORD dwDevice, BOOL *boAux1Stat);
DWORD __stdcall JETI_AuxOut2 (DWORD dwDevice, BOOL boAux2);
DWORD __stdcall JETI_AuxOut2Stat (DWORD dwDevice, BOOL *boAux2Stat);
DWORD __stdcall JETI_AuxOut3 (DWORD dwDevice, BOOL boAux3);
DWORD __stdcall JETI_AuxOut3Stat (DWORD dwDevice, BOOL *boAux3Stat);
DWORD __stdcall JETI_AuxOut4 (DWORD dwDevice, BOOL boAux4);
DWORD __stdcall JETI_AuxOut4Stat (DWORD dwDevice, BOOL *boAux4Stat);
DWORD __stdcall JETI_AuxOut5 (DWORD dwDevice, BOOL boAux5);
DWORD __stdcall JETI_AuxOut5Stat (DWORD dwDevice, BOOL *boAux5Stat);
DWORD __stdcall JETI_AuxIn1Stat (DWORD dwDevice, BOOL *boAuxIn1Stat);
DWORD __stdcall JETI_AuxIn2Stat (DWORD dwDevice, BOOL *boAuxIn2Stat);
DWORD __stdcall JETI_GetCycTime (DWORD dwDevice, DWORD *dwCycTime);

// Configuration functions (jeti_conf.c)
DWORD __stdcall JETI_GetDarkmodeConf (DWORD dwDevice, BYTE *bDarkmode);
DWORD __stdcall JETI_SetDarkmodeConf (DWORD dwDevice, BYTE bDarkmode);
DWORD __stdcall JETI_GetExposureConf (DWORD dwDevice, BYTE *bExpmode);
DWORD __stdcall JETI_SetExposureConf (DWORD dwDevice, BYTE bExpmode);
DWORD __stdcall JETI_GetFunctionConf (DWORD dwDevice, BYTE *bPrevFunc, BYTE *bConfFunc);
DWORD __stdcall JETI_SetFunctionConf (DWORD dwDevice, BYTE bFunction);
DWORD __stdcall JETI_GetFormatConf (DWORD dwDevice, BYTE *bPrevForm, BYTE *bConfForm);
DWORD __stdcall JETI_SetFormatConf (DWORD dwDevice, BYTE bFormat);
DWORD __stdcall JETI_GetTintConf (DWORD dwDevice, DWORD *dwPrevTint, DWORD *dwConfTint);
DWORD __stdcall JETI_SetTintConf (DWORD dwDevice, DWORD dwTint);
DWORD __stdcall JETI_GetMaxTintConf (DWORD dwDevice, DWORD *dwMaxTint);
DWORD __stdcall JETI_SetMaxTintConf (DWORD dwDevice, DWORD dwMaxTint);
DWORD __stdcall JETI_GetMinTintConf (DWORD dwDevice, DWORD *dwMinTint);
DWORD __stdcall JETI_GetAverConf (DWORD dwDevice, WORD *wAver);
DWORD __stdcall JETI_SetAverConf (DWORD dwDevice, WORD wAver);
DWORD __stdcall JETI_GetAdaptConf (DWORD dwDevice, BYTE *bAdaptmode);
DWORD __stdcall JETI_SetAdaptConf (DWORD dwDevice, BYTE bAdaptmode);
DWORD __stdcall JETI_GetWranConf (DWORD dwDevice, DWORD *dwBeg, DWORD *dwEnd, DWORD *dwStep);
DWORD __stdcall JETI_SetWranConf (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, DWORD dwStep);
DWORD __stdcall JETI_GetPDARowConf (DWORD dwDevice, DWORD *dwPDARow, DWORD *dwRowNumber);
DWORD __stdcall JETI_SetPDARowConf (DWORD dwDevice, DWORD dwPDARow, DWORD dwRowNumber);
DWORD __stdcall JETI_GetCycModeConf (DWORD dwDevice, BYTE *bCycMode);
DWORD __stdcall JETI_SetCycModeConf (DWORD dwDevice, BYTE bCycMode);
DWORD __stdcall JETI_GetCycTimeConf (DWORD dwDevice, DWORD *dwCycTime);
DWORD __stdcall JETI_SetCycTimeConf (DWORD dwDevice, DWORD dwCycTime);
DWORD __stdcall JETI_SetDefault (DWORD dwDevice);
DWORD __stdcall JETI_GetLevel (DWORD dwDevice, DWORD *dwLevelCounts, DWORD *dwLevelPercent);


// Fetch functions (jeti_fetch.c)
DWORD __stdcall JETI_FetchDark (DWORD dwDevice, DWORD *dwDark);
DWORD __stdcall JETI_FetchLight (DWORD dwDevice, DWORD *dwLight);
DWORD __stdcall JETI_FetchRefer (DWORD dwDevice, DWORD *dwRefer);
DWORD __stdcall JETI_FetchTransRefl (DWORD dwDevice, DWORD *dwTransRefl);
DWORD __stdcall JETI_FetchSprad (DWORD dwDevice, FLOAT *fSprad);
DWORD __stdcall JETI_FetchRadio (DWORD dwDevice, FLOAT *fRadio);
DWORD __stdcall JETI_FetchPhoto (DWORD dwDevice, FLOAT *fPhoto);
DWORD __stdcall JETI_FetchChromxy (DWORD dwDevice, FLOAT *fChromx, FLOAT *Chromy);
DWORD __stdcall JETI_FetchChromuv (DWORD dwDevice, FLOAT *fChromu, FLOAT *fChromv);
DWORD __stdcall JETI_FetchDWLPE (DWORD dwDevice, FLOAT *fDWL, FLOAT *fPE);
DWORD __stdcall JETI_FetchCCT (DWORD dwDevice, DWORD *dwCCT);
DWORD __stdcall JETI_FetchDuv (DWORD dwDevice, FLOAT *fDuv);
DWORD __stdcall JETI_FetchCRI (DWORD dwDevice, FLOAT *fCRI);
DWORD __stdcall JETI_FetchXYZ (DWORD dwDevice, FLOAT *fX, FLOAT *fY, FLOAT *fZ);

// Calculation functions (jeti_calc.c)
DWORD __stdcall JETI_CalcLintDark (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT fStep, FLOAT *fDark);
DWORD __stdcall JETI_CalcSplinDark (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT fStep, FLOAT *fDark);
DWORD __stdcall JETI_CalcLintLight (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT fStep, FLOAT *fLight);
DWORD __stdcall JETI_CalcSplinLight (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT fStep, FLOAT *fLight);
DWORD __stdcall JETI_CalcLintRefer (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT fStep, FLOAT *fRefer);
DWORD __stdcall JETI_CalcSplinRefer (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT fStep, FLOAT *fRefer);
DWORD __stdcall JETI_CalcLintTransRefl (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT fStep, FLOAT *fTransRefl);
DWORD __stdcall JETI_CalcSplinTransRefl (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT fStep, FLOAT *fTransRefl);
DWORD __stdcall JETI_CalcRadio (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT *fRadio);
DWORD __stdcall JETI_CalcPhoto (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT *fPhoto);
DWORD __stdcall JETI_CalcChromxy (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT *fChromx, FLOAT *fChromy);
DWORD __stdcall JETI_CalcChromxy10 (DWORD dwDevice, FLOAT *fChromx, FLOAT *fChromy);
DWORD __stdcall JETI_CalcChromuv (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT *fChromu, FLOAT *fChromv);
DWORD __stdcall JETI_CalcDWLPE (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT *fDWL, FLOAT *fPE);
DWORD __stdcall JETI_CalcCCT (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, DWORD *dwCCT);
DWORD __stdcall JETI_CalcDuv (DWORD dwDevice, FLOAT *fDuv);
DWORD __stdcall JETI_CalcCRI (DWORD dwDevice, DWORD dwCCT, FLOAT *fCRI);
DWORD __stdcall JETI_CalcXYZ (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT *fX, FLOAT *fY, FLOAT *fZ);
DWORD __stdcall JETI_CalcAllValue (DWORD dwDevice, DWORD dwBeg, DWORD dwEnd, FLOAT *fRadio, FLOAT *fPhoto, FLOAT *fChromx, FLOAT *fChromy, FLOAT *fChromu, FLOAT *fChromv, FLOAT *fDWL, FLOAT *fPE);

#if !defined _USRDLL
#if defined __cplusplus
}
#endif
#endif


/*  DLL error codes  */

#define	JETI_SUCCESS				0x00000000		// no error occured
#define JETI_ERROR_OPEN_PORT		0x00000002		// could not open COM-port
#define JETI_ERROR_PORT_SETTING		0x00000003		// could not set COM-port settings
#define JETI_ERROR_BUFFER_SIZE		0x00000004		// could not set buffer size of COM-port
#define JETI_ERROR_PURGE			0x00000005		// could not purge buffers of COM-port
#define JETI_ERROR_TIMEOUT_SETTING	0x00000006		// could not set COM-port timeout
#define JETI_ERROR_SEND				0x00000007		// could not send to device
#define JETI_TIMEOUT				0x00000008		// timeout error
#define JETI_ERROR_RECEIVE			0x0000000A		// could not receive from device
#define JETI_ERROR_NAK				0x0000000B		// command not supported or invalid argument
#define JETI_ERROR_CONVERT			0x0000000C		// could not convert received data
#define JETI_ERROR_PARAMETER		0x0000000D		// invalid argument
#define JETI_BUSY					0x0000000E		// device busy
#define JETI_CHECKSUM_ERROR			0x00000011		// invalid checksum of received data
#define JETI_INVALID_STEPWIDTH		0x00000012		// invalid stepwidth
#define JETI_INVALID_NUMBER			0x00000013		// invalid device number
#define JETI_NOT_CONNECTED			0x00000014		// device not connected
#define JETI_INVALID_HANDLE			0x00000015		// invalid device handle
#define JETI_INVALID_CALIB			0x00000016		// invalid calibration file number
#define JETI_CALIB_NOT_READ			0x00000017		// calibration data not read
#define JETI_MEASURE_FAIL			0x00000020		// measurement failed
#define JETI_DLL_ERROR				0x00000080		// internal DLL error
#define JETI_FATAL_ERROR			0x000000FF		// fatal communication error
