﻿//==============================================================================================
//	API-ZM(WDM) Definition File																	
//==============================================================================================
//================================================================
/// @name Parameter Macro Definition
//@{
//================================================================
//----------------------------------------
// Frequency
//----------------------------------------
#define	ZM_FREQUENCY_120HZ						0						// Frequency : 120Hz
#define	ZM_FREQUENCY_1kHZ						1						// Frequency : 1kHz
//----------------------------------------
// Signal Level
//----------------------------------------
#define	ZM_LEVEL_500mV							0						// Level : 0.5V
#define	ZM_LEVEL_1V								1						// Level : 1V
//----------------------------------------
// Measurement Speed
//----------------------------------------
#define	ZM_SPEED_FAST							0						// Measurement speed : FAST
#define	ZM_SPEED_NORMAL							1						// Measurement speed : NORMAL
#define	ZM_SPEED_SLOW							2						// Measurement speed : SLOW
//----------------------------------------
// Equivalent Circuit Mode
//----------------------------------------
#define	ZM_CIRCUIT_AUTO							0						// Equivalent circuit mode : AUTO
#define	ZM_CIRCUIT_SERIAL						1						// Equivalent circuit mode : SERIAL
#define	ZM_CIRCUIT_PARALLEL						2						// Equivalent circuit mode : PARALLEL
//----------------------------------------
// Range
//----------------------------------------
#define	ZM_RANGE_4nF							3						// Range : 4nF
#define	ZM_RANGE_40nF							4						// Range : 40nF
#define	ZM_RANGE_400nF							5						// Range : 400nF
#define	ZM_RANGE_4uF							6						// Range : 4uF
#define	ZM_RANGE_40uF							7						// Range : 40uF
#define	ZM_RANGE_400uF							8						// Range : 400uF
#define	ZM_RANGE_1400uF							9						// Range : 1.4mF
//----------------------------------------
// Correction
//----------------------------------------
#define	ZM_CORRECTION_TYPE_OPEN					0						// Correction type : OPEN
#define	ZM_CORRECTION_TYPE_SHORT				1						// Correction type : SHORT
#define	ZM_CORRECTION_FORMAT_OPEN_GB			1						// Correction format of open : GB
#define	ZM_CORRECTION_FORMAT_SHORT_RX			1						// Correction format of short : RX
//----------------------------------------
// Contact Check
//----------------------------------------
#define	ZM_CONTACTCHECK_DISABLE					0						// Contact check : Disabled
#define	ZM_CONTACTCHECK_BEFORE					1						// Contact check : Before measurement
#define	ZM_CONTACTCHECK_AFTER					2						// Contact check : After measurement
#define	ZM_CONTACTCHECK_BOTH					3						// Contact check : Before and after measurement
//----------------------------------------
// Enable/Disable
//----------------------------------------
#define	ZM_DISABLE								0						// Disable
#define	ZM_ENABLE								1						// Enable
//@}
//================================================================
/// @name Error Code
//@{
//================================================================
//----------------------------------------
// Initialization Error Code
//----------------------------------------
#define	ZM_ERR_SUCCESS						0						// Normality completion
#define	ZM_ERR_INI_RESOURCE					1						// Failed in the acquisition of the resource
#define	ZM_ERR_INI_INTERRUPT				2						// Failed in the registration of the interruption routine
#define	ZM_ERR_INI_MEMORY					3						// Failed in the allocation of the memory. This error would hardly occur. If this error occurred, please extend the memory
#define	ZM_ERR_INI_REGISTRY					4						// Failed in the access of registry
#define	ZM_ERR_SYS_RECOVERED_FROM_STANDBY	7						// Execute ZmResetDevice function because the device has recovered from standby mode
#define	ZM_ERR_INI_NOT_FOUND_SYS_FILE		8						// Initialization failed because czm.sys is not found
#define	ZM_ERR_INI_DLL_FILE_VERSION			9						// Initialization failed because the file version of czm.dll cannot be acquired
#define	ZM_ERR_INI_SYS_FILE_VERSION			10						// Initialization failed because the file version of czm.sys cannot be acquired
#define	ZM_ERR_INI_NO_MATCH_DRV_VERSION		11						// Initialization failed because the file version of czm.dll is not same as czm.sys
//----------------------------------------
// DLL Error Code
//----------------------------------------
#define	ZM_ERR_DLL_DEVICE_NAME				10000					// The device name which wasn't registered by a device manager was specified
#define	ZM_ERR_DLL_INVALID_ID				10001					// Invalid ID was specified. Please confirm whether the initialization function has completed normally. And confirm the scope of variable that stores ID
#define	ZM_ERR_DLL_CALL_DRIVER				10002					// Driver can't be called
#define	ZM_ERR_DLL_CREATE_FILE				10003					// Failed in the creation of the file
#define	ZM_ERR_DLL_CLOSE_FILE				10004					// Failed in the closing of the file
#define	ZM_ERR_DLL_CREATE_THREAD			10005					// Failed in the creation of the thread
#define	ZM_ERR_INFO_INVALID_DEVICE			10050					// Specified device name is not found. Please check spelling
#define	ZM_ERR_INFO_NOT_FIND_DEVICE			10051					// No more device
#define	ZM_ERR_INFO_INVALID_INFOTYPE		10052					// Information type is invalid
#define	ZM_ERR_INFO_NOT_FOUND_DEVINFO		10053					// Not found device information
#define	ZM_ERR_DLL_BUFF_ADDRESS				10100					// Invalid data buffer address
//----------------------------------------
// Driver Error Code
//----------------------------------------
#define	ZM_ERR_SYS_MEMORY					20000					// Failed in the allocation of the memory. This error would hardly occur. If this error occurred, please extend the memory
#define	ZM_ERR_SYS_NOT_SUPPORTED			20001					// This function can't be used by this device
#define	ZM_ERR_SYS_BOARD_EXECUTING			20002					// Can not use while by another device works
#define	ZM_ERR_SYS_USING_OTHER_PROCESS		20003					// Can not use because another process is using the device
#define	ZM_ERR_SYS_NOT_FOUND_PROCESS_DATA	20004					// Process information is not found
#define	ZM_ERR_SYS_CHANNEL_NO				20100					// Channel No is out of the settable range
#define	ZM_ERR_SYS_FREQUENCY				20101					// Frequency is out of the settable range
#define	ZM_ERR_SYS_LEVEL					20102					// Level is out of the settable range
#define	ZM_ERR_SYS_SPEED					20103					// Speed is out of the settable range
#define	ZM_ERR_SYS_AVERAGE_COUNT			20104					// AverageCount is out of the settable range
#define	ZM_ERR_SYS_CIRCUIT					20105					// Circuit is out of the settable range
#define	ZM_ERR_SYS_RANGE					20106					// Range is out of the settable range
#define	ZM_ERR_SYS_TRIGGER					20107					// Trigger is out of the settable range
#define	ZM_ERR_SYS_TYPE						20108					// Type is out of the settable range
#define	ZM_ERR_SYS_ENABLE					20109					// Enable is out of the settable range
#define	ZM_ERR_SYS_MODE						20110					// Mode is out of the settable range
#define	ZM_ERR_SYS_BIN_NO					20111					// BinNo is out of the settable range
#define	ZM_ERR_SYS_TIME						20112					// Time is out of the settable range
#define	ZM_ERR_SYS_FORMAT					20113					// Format is out of the settable range
#define	ZM_ERR_SYS_TIMEOUT					20114					// Timeout is out of the settable range
#define	ZM_ERR_SYS_CONTACTCHECK				20115					// ContactCheck is out of the settable range
#define	ZM_ERR_SYS_MEASURE_STOP				20116					// Measurement stopped
#define	ZM_ERR_SYS_MEASURE_TIMEOUT			20117					// Measurement time out
#define	ZM_ERR_SYS_CONTACTCHECK_ENABLE		20118					// This setting is not possible because the contact check function is enabled

//================================================================
// Prototype Declaration
//================================================================
#ifdef __cplusplus
extern "C"{
#endif
//----------------------------------------
// Common Function
//----------------------------------------
long WINAPI ZmInit(char *DeviceName, short *Id);
long WINAPI ZmExit(short Id);
long WINAPI ZmResetDevice(short Id);
long WINAPI ZmGetErrorString(long ErrorCode , char *ErrorString);
//----------------------------------------
// Information Acquisition Function
//----------------------------------------
long WINAPI ZmQueryDeviceName(short Index, char *DeviceName, char *Device);
long WINAPI ZmGetMaxChannels(short Id, unsigned short *MaxChannels);
//----------------------------------------
// Measurement Condition Function
//----------------------------------------
long WINAPI ZmSetFrequency(short Id, unsigned short Channel, unsigned short Frequency);
long WINAPI ZmGetFrequency(short Id, unsigned short Channel, unsigned short *Frequency);
long WINAPI ZmSetLevel(short Id, unsigned short Channel, unsigned short Level);
long WINAPI ZmGetLevel(short Id, unsigned short Channel, unsigned short *Level);
long WINAPI ZmSetSpeed(short Id, unsigned short Channel, unsigned short Speed, unsigned long AverageCount);
long WINAPI ZmGetSpeed(short Id, unsigned short Channel, unsigned short *Speed, unsigned long *AverageCount);
long WINAPI ZmSetCircuit(short Id, unsigned short Channel, unsigned short Circuit);
long WINAPI ZmGetCircuit(short Id, unsigned short Channel, unsigned short *Circuit);
long WINAPI ZmSetRange(short Id, unsigned short Channel, unsigned short Range);
long WINAPI ZmGetRange(short Id, unsigned short Channel, unsigned short *Range);
long WINAPI ZmCorrection(short Id, unsigned short Channel, unsigned short Type);
long WINAPI ZmSetCorrectionEnable(short Id, unsigned short Channel, unsigned short Type, unsigned short Enable);
long WINAPI ZmGetCorrectionEnable(short Id, unsigned short Channel, unsigned short Type, unsigned short *Enable);
long WINAPI ZmSetCorrectionValue(short Id, unsigned short Channel, unsigned short Type, float correction_value_1, float correction_value_2, unsigned short format);
long WINAPI ZmGetCorrectionValue(short Id, unsigned short Channel, unsigned short Type, float *correction_value_1, float *correction_value_2, unsigned short format);
long WINAPI ZmSetStartDelay(short Id, unsigned short Channel, float Time);
long WINAPI ZmGetStartDelay(short Id, unsigned short Channel, float *Time);
long WINAPI ZmSetSignalOutputDelay(short Id, unsigned short Channel, float Time);
long WINAPI ZmGetSignalOutputDelay(short Id, unsigned short Channel, float *Time);
long WINAPI ZmSetTriggerSyncEnable(short Id, unsigned short Channel, unsigned short Enable);
long WINAPI ZmGetTriggerSyncEnable(short Id, unsigned short Channel, unsigned short *Enable);
long WINAPI ZmSetContactCheck(short Id, unsigned short Channel, unsigned short ContactCheck);
long WINAPI ZmGetContactCheck(short Id, unsigned short Channel, unsigned short *ContactCheck);
//----------------------------------------
// Measurement Operation Function
//----------------------------------------
long WINAPI ZmSingleCMeasure(short Id, unsigned short Channel, float* CValue, float* DValue, unsigned long *Status);

#ifdef __cplusplus
};
#endif

//================================================================
// Definition Value
//================================================================
#define	CZM_MAX_PROCESS			16						///< Maximum number of process
#define CZM_MAX_DEVICE			256						///< Maximum number of device


//================================================================
// Struct
//================================================================
