#ifndef __IC_USER_DEFS_H__
#define __IC_USER_DEFS_H__


/////// Grabe Mode /////////////////////////////////////
typedef enum _IC_GRAB_MODE
{
	GRAB_IN_CONTINUOUS_MODE = 1,              // Default
	GRAB_IN_SOFTWARE_TRIGGER_MODE,
	GRAB_IN_HARDWARE_TRIGGER_MODE,
	GRAB_IN_SYNC_CONTINUOUS_MODE,
	GRAB_IN_SYNC_SOFTWARE_TRIGGER_MODE,

}IC_GRAB_MODE, *PIC_GRAB_MODE;

typedef enum _IC_PARAM_TYPE
{
	CAMERA_OPENED_COUNT,
	CAMERA_SUB_WINDOW,
	CAMERA_IMAGE_FLIP,

	CAMERA_SHOW_WND_HANDLE,

	CALLBACK_FUNCTION_ON_RAW_OK,
	CALLBACK_CONTEXT_ON_RAW_OK,
	CALLBACK_FUNCTION_ON_RGB_OK,
	CALLBACK_CONTEXT_ON_RGB_OK,

	CAMERA_SPEED_LEVEL,
	CAMERA_EXPOSURE_TIME,
	CAMERA_GLOBAL_GAIN,
	CAMERA_HORIZONTAL_BLANKING,
	CAMERA_VERTICAL_BLANKING,
	CAMERA_ROWS_INTEGRATION,
	CAMERA_TRIGGER_DELAY,
	PROJECTOR_RAM_DATA,
	PROJECTOR_BRIGHTNESS,
	CHECK_IMAGE_HEADER,
	SENSOR_READ_WRITE_MODE,

	// ...

	IC_PARAM_RESERVE_1,                  // end of basic param


	CURRENT_IMAGE_TO_FILE = 500,         // operator
	IMAGE_BY_TRIGGER_SYN,
	IMAGE_BY_TRIGGER_ASYN,
	IMAGE_COUNT_PER_SEC,

	CAMERA_FIXED_SERIAL,   // char[20]
	BITMAP_FILE_INFO_HEADER,
	CAMERA_USER_SET_ID,
	CLOSE_CAMERA_FOR_REMOVE,
	USB_VENRDOR_CONTROL,
	PROJECTOR_CONTROL_CMD,
	CAMERA_USER_SET_EEPROM,
	CAMERA_SENSOR_REG,

	// ...

	GIGE_DEV_IP = 1000,                  // fix setting
	GIGE_DEV_MASK,
	GIGE_DEV_GATE,

	MAX_WIDTH_OF_IMAGE,
	MAX_HEIGHT_OF_IMAGE,

	// ... 

}IC_PARAM_TYPE, *PIC_PARAM_TYPE;



typedef enum _IC_STATUS
{
	IC_STATUS_OK,
	IC_STATUS_ERROR,
	IC_STATUS_INVALID_INDEX,
	IC_STATUS_NEED_STOP_GRAB,
	IC_INVALIDE_DEVICE_ID,
	IC_STATUS_WRITE_DEVICE_ERROR,
	IC_STATUS_NOT_SPPORT,
	IC_STATUS_TIME_OUT,

	IC_STATUS_INVALID_PARAM_X,   // 参数组合错误，单独无误
	IC_STATUS_INVALID_PARAM_0,
	IC_STATUS_INVALID_PARAM_1,
	IC_STATUS_INVALID_PARAM_2,
	IC_STATUS_INVALID_PARAM_3,
	IC_STATUS_INVALID_PARAM_4,
	IC_STATUS_INVALID_PARAM_5,
	IC_STATUS_INVALID_PARAM_6,
	IC_STATUS_INVALID_PARAM_7,
	IC_STATUS_INVALID_PARAM_8,

	// ...

}IC_STATUS, *PIC_STATUS;


//////////////////   STRUCT  //////////////////////

typedef struct _IC_CAMERA_SUB_WINDOW
{
	SHORT XOff;
	SHORT YOff;
	SHORT Width;
	SHORT Height;
}
IC_CAMERA_SUB_WINDOW, *PIC_CAMERA_SUB_WINDOW;


typedef struct _IC_USB_VENDOR_CONTROL
{
	USHORT Val;
	USHORT Idx;
	UCHAR  Req;
	UCHAR  Ret;
	USHORT Size;
	UCHAR  Data[8];
}IC_USB_VENDOR_CONTROL, *PIC_USB_VENDOR_CONTROL;


typedef struct _IC_PROJECTOR_RAM_DATA
{
	UCHAR nouse;
	UCHAR param_size;
	UCHAR gmin;
	UCHAR gmax;

	ULONG reserve;

	struct 
	{
		ULONG x0;
		ULONG step;
	}group[1];

}IC_PROJECTOR_RAM_DATA, *PIC_PROJECTOR_RAM_DATA;


typedef struct _IC_PRJ_CONTROL_PARAM
{
	UCHAR prjEnable;
	UCHAR prjImaeMode;
	UCHAR prjTrig;
	UCHAR prjResSel;
	UCHAR prjTimes;
	UCHAR prjFast;
	UCHAR prjPolar;
	UCHAR reserved;

}IC_PRJ_CONTROL_PARAM, *PIC_PRJ_CONTROL_PARAM;

typedef struct _IC_EEPROM_ADDR_SIZE_DATA
{
	USHORT addr;
	USHORT size;
	UCHAR  data[4];
}IC_EEPROM_ADDR_SIZE_DATA, *PIC_EEPROM_ADDR_SIZE_DATA;

typedef struct _IC_SENSOR_ADDR_SIZE_DATA
{
	USHORT addr;
	USHORT data;
}IC_SENSOR_ADDR_SIZE_DATA, *PIC_SENSOR_ADDR_SIZE_DATA;
///////////////// call back function  ////////////////

typedef void WINAPI IC_ON_IMAGE_OK(PUCHAR pImgData, PVOID pContext);
typedef IC_ON_IMAGE_OK *PIC_ON_IMAGE_OK;



////////////////     Interface     ////////////////////

#define USB_DEV_BASE_IDX   0
#define GIGE_DEV_BASE_IDX  1000

extern "C" 
{
	IC_STATUS IC_Start(IC_GRAB_MODE mode, LONG idx);
	IC_STATUS IC_Stop(LONG idx);

	IC_STATUS IC_Get(IC_PARAM_TYPE Type, PVOID pVal, LONG idx);
	IC_STATUS IC_Set(IC_PARAM_TYPE Type, PVOID pVal, LONG idx);
};



#endif