//******************************************************************************
//  ICubeInterface.h - interface definitions                                   *
//                                                                             *
//  Copyright (c) 2017  Net GmbH                 All Rights Reserved.          *
//                                                                             *
//  Version 1.0.0.6                                                            *
//                                                                             *
//******************************************************************************

#ifndef ICubeIntH
#define ICubeIntH

#include <atlbase.h>
#include <streams.h>


// BinSkip definitions
// (used with REG_BINNING,REG_SKIPPING)

#define BIN_SKIP_OFF    	 0
#define BIN_SKIP_2ND_PIXEL	 1
#define BIN_SKIP_4TH_PIXEL	 2

// Measure field definitions
// (used with REG_MEASURE_FIELD_AE)

#define MEASUREFIELD_100	2	// 100% (full frame,default)
#define MEASUREFIELD_60		1	// 60%
#define MEASUREFIELD_30		0	// 30%

// Shutter definitions
// (used with REG_SHUTTER)

#define SHUTTER_ROLLING	        0	// all models
#define SHUTTER_GLOBAL_RESET	1	// (4133CU/BU,4133CU only)
#define SHUTTER_GLOBAL		2	// (4133CU/BU (default),4133CU (default) only)

// Trigger invert definitions
// hardware trigger will be detected on the defined edge
// (used with REG_TRIGGER_INVERT)

#define FALLING_EDGE		0	// (default)
#define RISING_EDGE		1

// Parameter ON||OFF definitions

#define MODE_OFF		0
#define MODE_ON  		1

// Properties (Camera parameters) definitions

#define REG_BRIGHTNESS		1   // write: only when REG_COLOR_PROCCESSING enabled, read: always
#define REG_CONTRAST		2   // write: only when REG_COLOR_PROCCESSING enabled, read: always
#define REG_GAMMA		3   // write: only when REG_GAMMA_ENABLE enabled, read: always
                                    // conversion: 1.0 == 64
#define REG_FLIPPED_V		4   // (ON||OFF); OFF (default)
#define REG_FLIPPED_H		5   // (ON||OFF); OFF (default)
#define REG_WHITE_BALANCE	6   // (one push)
#define REG_EXPOSURE_TIME	7   // all models
#define REG_EXPOSURE_TARGET	8   // sets the target-value for the auto exposure algorithm
#define REG_RED			9   // only for color models; RGB Gain value
#define REG_GREEN		10  // only for color models
#define REG_BLUE		11  // only for color models
#define REG_BLACKLEVEL		12  // sensor blacklevel
#define REG_SW_GAIN		13  // sensor gain
#define REG_COLOR		14  // (ON||OFF) read: color || bw model
#define REG_PLL			15  // all models
#define REG_STROBE_LENGHT	16  // length of strobe pulse output (msec)
#define REG_STROBE_DELAY	17  // delay before strobe pulse is executed (msec)
#define REG_TRIGGER_DELAY	18  // delay before hardware trigger is executed (msec)
#define REG_SATURATION		19  // only for color models, when REG_COLOR_PROCCESSING enabled
#define REG_COLOR_MACHINE	20  // obsolet
#define REG_TRIGGER_INVERT	21  // (FALLING_EDGE (default) || RISING_EDGE)

#define REG_MEASURE_FIELD_AE	23  // measure field for auto exposure
#define REG_SHUTTER		26  // (4133CU/BU,4133CU)
#define REG_TRIGGER		29

#define REG_BINNING		31
#define REG_SKIPPING		32
#define REG_ROI_HOR_POS		33
#define REG_ROI_VER_POS		34
#define REG_ROI_HOR_SIZE	35
#define REG_ROI_VER_SIZE	36
#define REG_ROI 		37

#define REG_AUTO_EXPOSURE	39
#define REG_AUTO_BLACKLEVEL	40

#define REG_SERIALNUMBER	42

#define REG_BAD_FRAME		81  // read bad frame count
#define REG_GOOD_FRAME		82  // read good frame count

#define REG_RED_OFFSET		106	// only for color models; RGB offset value
#define REG_GREEN_OFFSET	107 // only for color models
#define REG_BLUE_OFFSET		108 // only for color models

#define REG_HUE			109	// only for color models; write:
                                        // only when REG_COLOR_PROCCESSING enabled, read: always
#define REG_COLOR_CORRECTION	110 // (ON||OFF) ColorCorrection matrix; OFF (default)
#define REG_GAMMA_ENABLE	111 // (ON||OFF) en/disable gamma module to save CPU load; ON (default)

#define REG_TNR			115 // (ON||OFF)  only for color models, temporal noise reduction

#define REG_COLOR_PROCESSING	117 // (ON||OFF) en/disable color proc module module to save CPU load;  ON (default)

#define REG_RESET_CAMERA	140 // reset the camera 

#define REG_AQU_FRAMERATE	147 // (2234CU/BU) get/set the framerate

// Trigger definitions

#define TRIG_SW_START		0	// start software trigger
#define TRIG_SW_DO		1	// do a software trigger pulse
#define TRIG_HW_START       	2	// start hardware trigger
#define TRIG_STOP		3	// stop software || hardware trigger
#define TRIG_SW_START_2		4	// GlobalResetRelease shutter mode (1500CU/BU,1300CU)
#define TRIG_HW_START_2		5	// GlobalResetRelease shutter mode (1500CU/BU,1300CU)


// Region of interest

typedef struct {

	LONG nROIPosHor;
	LONG nROIPosVer;
	LONG nROISizeHor;
	LONG nROISizeVer;

} ROI_PARAMS, *PROI_PARAMS;


typedef struct {

	LONG nRed;
	LONG nGreen;
	LONG nBlue;

} RGB_PARAMS, *PRGB_PARAMS;


//---------------------------------------------------------------------------
// ICubeControlInterface

EXTERN_C const IID IID_IIPVirtCustomInterface;

#if defined(__cplusplus) && !defined(CINTERFACE)
    
 	MIDL_INTERFACE("A2A937B4-1142-4a2b-BF16-2940F178C978")

    IAMCustomInterface : public IUnknown
    {
    public:

        virtual HRESULT STDMETHODCALLTYPE SetControl( 
					long Property,
					long lValue) = 0;

        virtual HRESULT STDMETHODCALLTYPE GetControl(
                    long Property,
					long *lValue) = 0;

        virtual HRESULT STDMETHODCALLTYPE GetControlRange(
                    long Property,
					long *lMin,
                    long *lDef,
                    long *lMax
                    ) = 0;
    };


#endif

#endif