/* **************************************************************** * dcamapi.h 2.1.2.00 [Sep. 25,2001] 2.1.2.01 [Oct. 29,2001] 2.1.2.02 [Oct. 30,2001] 2.1.2.03 [Oct. 31,2001] 2.1.2.04 [Jan. 10,2002] binning 2.1.3.00 [Jan. 26,2002] 1. Add dcam_firetrigger() function 2. Add DCAM_QUERYCAPABILITY_EVENTS 3. Add DCAM_EVENT_VVALIDBEGIN 4. Add DCAM_TRIGMODE_SOFTWARE 2.1.3.01 [Jan. 29,2002] 1. Add DCAM_CAPABILITY_TRIGGER_SOFTWARE 2.1.3.02 [Feb. 19,2002] 1. Add DCAM_CAPABILITY_TRIGGER_FASTREPETITION 2. Add DCAM_TRIGMODE_FASTREPETITION 2.1.3.03 [March 7,2002] 1. Fixed DCAM_CAPABILITY_ALL to correct value 2.1.3.04 [Nov 7,2002] 1. Add DCAM_CAPABILITY_TRIGGER_TDI 2. Add DCAM_TRIGMODE_TDI * **************************************************************** */ #ifndef _INCLUDE_DCAMAPI_H_ /* **************************************************************** * language absorber * **************************************************************** */ #ifdef __cplusplus /* C++ */ #define BEGIN_DECLARE_ENUM( c ) typedef enum c #define END_DECLARE_ENUM( c ) ; #define BEGIN_DECLARE_STRUCT( c ) typedef struct c #define END_DECLARE_STRUCT( c ) ; #define OPTION = 0 extern "C" { #else /* C */ #define BEGIN_DECLARE_ENUM( c ) typedef enum #define END_DECLARE_ENUM( c ) c; #define BEGIN_DECLARE_STRUCT( c ) typedef struct #define END_DECLARE_STRUCT( c ) c; #define OPTION #endif /* **************************************************************** * platform absorber * **************************************************************** */ #ifdef WIN32 /* Win32 platform */ #ifndef DCAMAPI /* API based on PASCAL calling */ #define DCAMAPI PASCAL #endif #else /* WIN32 */ /* Current support only Windows and MacOS */ #ifndef DCAMAPI #define DCAMAPI #endif #include #include typedef Boolean BOOL; typedef unsigned char BYTE; typedef unsigned short WORD; typedef unsigned long DWORD; typedef unsigned long UINT; typedef const char* LPCSTR; typedef void* LPVOID; typedef Handle HINSTANCE; typedef Size SIZE; typedef Handle HANDLE; typedef WindowPtr HWND; #endif /* WIN32 */ /* include standard constants, declare types, define global constant */ #include "ccDefine.h" typedef struct tag_dcam* HDCAM; #ifndef DCAMAPI_VER #define DCAMAPI_VER 2200 #endif /* **************************************************************** * constant declaration * **************************************************************** */ BEGIN_DECLARE_ENUM( DCAMERR ) { DCAMERR_SUCCESS = 1, /* P: */ DCAMERR_NONE = 0, /* no error */ DCAMERR_BUSY = 0x80000101, /* busy, cannot process */ DCAMERR_ABORT = 0x80000102, /* abort process */ DCAMERR_NOTREADY = 0x80000103, /* not ready state */ DCAMERR_NOTSTABLE = 0x80000104, /* not stable state */ DCAMERR_UNSTABLE = 0x80000105, /* O: now unstable state */ DCAMERR_TIMEOUT = 0x80000106, /* timeout */ DCAMERR_NOTBUSY = 0x80000107, /* O: not busy state */ DCAMERR_NORESOURCE = 0x80000201, /* O: not enough resource except memory */ DCAMERR_NOMEMORY = 0x80000203, /* not enough memory */ DCAMERR_NOMODULE = 0x80000204, /* no sub module */ DCAMERR_NODRIVER = 0x80000205, /* P: no driver */ DCAMERR_NOCAMERA = 0x80000206, /* no camera */ DCAMERR_NOGRABBER = 0x80000207, /* no grabber */ // DCAMERR_NOCOMBINATION = 0x80000208, /* 2.2: no combination on registry */ DCAMERR_INVALIDMODULE = 0x80000211, /* 2.2: dcam_init() found invalid module */ DCAMERR_INVALIDCOMMPORT = 0x80000212, /* invalid serial port */ DCAMERR_LOSTFRAME = 0x80000301, /* frame data is lost */ DCAMERR_COOLINGTROUBLE = 0x80000302, /* something happens near cooler */ DCAMERR_INVALIDCAMERA = 0x80000806, /* invalid camera */ DCAMERR_INVALIDHANDLE = 0x80000807, /* invalid camera handle*/ DCAMERR_INVALIDPARAM = 0x80000808, /* invalid parameter */ DCAMERR_INVALIDVALUE = 0x80000821, /* invalid property value */ /* backward compatibility */ DCAMERR_UNKNOWNMSGID = 0x80000801, /* P: unknown message id */ DCAMERR_UNKNOWNSTRID = 0x80000802, /* unknown string id */ DCAMERR_UNKNOWNPARAMID = 0x80000803, /* unkown parameter id */ DCAMERR_UNKNOWNBITSTYPE = 0x80000804, /* O: unknown bitmap bits type */ DCAMERR_UNKNOWNDATATYPE = 0x80000805, /* unknown frame data type */ DCAMERR_FAILOPENBUS = 0x81001001, /* O: */ DCAMERR_FAILOPENCAMERA = 0x82001001, /* */ /* internal error */ DCAMERR_UNREACH = 0x80000f01, /* internal error */ DCAMERR_NOTIMPLEMENT = 0x80000f02, /* P: not yet implementation */ DCAMERR_NOTSUPPORT = 0x80000f03, /* function is not supported */ DCAMERR_UNLOADED = 0x80000f04, /* calling after process terminated */ DCAMERR_THRUADAPTER = 0x80000f05, /* calling after process terminated */ DCAMERR_FAILREADCAMERA = 0x83001002, /* P: */ DCAMERR_FAILWRITECAMERA = 0x83001003, /* P: */ _end_of_dcam_error } END_DECLARE_ENUM( DCAMERR ) /* ---------------------------------------------------------------- */ BEGIN_DECLARE_ENUM( DCAM_DATATYPE ) { /**/ DCAM_DATATYPE_NONE = 0, /**/ DCAM_DATATYPE_UINT8 = 0x00000001, /* bit 0 */ /**/ DCAM_DATATYPE_UINT16 = 0x00000002, /* bit 1 */ /**/ DCAM_DATATYPE_UINT32 = 0x00000008, /* bit 2 */ /**/ DCAM_DATATYPE_INT8 = 0x00000010, /* bit 4 */ /**/ DCAM_DATATYPE_INT16 = 0x00000020, /* bit 5 */ /**/ DCAM_DATATYPE_INT32 = 0x00000080, /* bit 7 */ /*-- DCAM_DATATYPE_REAL32 = 0x00000100, /-* bit 8 */ /*-- DCAM_DATATYPE_REAL64 = 0x00000200, /-* bit 9 */ /*-- DCAM_DATATYPE_INDEX8 = 0x00010000, /-* bit 16 */ /*-- DCAM_DATATYPE_RGB16 = 0x00020000, /-* bit 17 */ /*-- DCAM_DATATYPE_RGB32 = 0x00080000, /-* bit 19, */ /**/ DCAM_DATATYPE_BGR24 = 0x00000400, /* bit 10, 8bit*3, [ b0, g0, r0], [b1, g1, r1] */ /**/ DCAM_DATATYPE_BGR48 = 0x00001000, /* bit 12, 16bit*3, [ b0, g0, r0], [b1, g1, r1] */ /**/ DCAM_DATATYPE_RGB24 = 0x00040000, /* bit 18, 8bit*3, [ r0, g0, b0], [r1, g1, b1] */ /**/ DCAM_DATATYPE_RGB48 = 0x00100000, /* bit 20, 16bit*3, [ r0, g0, b0], [r1, g1, b1] */ /* just like 1394 format, Y is unsigned, U and V are signed. */ /* about U and V, signal level is from -128 to 128, data value is from 0x00 to 0xFF */ /**/ DCAM_DATATYPE_YUV411 = 0x01000000, /* 8bit, [ u0, y0, y1, v0, y2, y3 ], [u4, y4, y5, v4, v6, y7], */ /**/ DCAM_DATATYPE_YUV422 = 0x02000000, /* 8bit, [ u0, y0, v0, y1 ], [u2, y2, v2, v3 ], */ /**/ DCAM_DATATYPE_YUV444 = 0x04000000, /* 8bit, [ u0, y0, v0 ], [ u1, y1, v1 ], */ _end_of_dcam_datatype } END_DECLARE_ENUM( DCAM_DATATYPE ) /* ---------------- */ BEGIN_DECLARE_ENUM( DCAM_BITSTYPE ) { /**/ DCAM_BITSTYPE_NONE = 0x00000000, /**/ DCAM_BITSTYPE_INDEX8 = 0x00000001, /**/ DCAM_BITSTYPE_RGB16 = 0x00000002, /**/ DCAM_BITSTYPE_RGB24 = 0x00000004, /* 8bit, [ b0, g0, r0] */ /**/ DCAM_BITSTYPE_RGB32 = 0x00000008, _end_of_dcam_bitstype } END_DECLARE_ENUM( DCAM_BITSTYPE ) /* ---------------------------------------------------------------- */ /*** --- camera capability --- ***/ enum { DCAM_QUERYCAPABILITY_FUNCTIONS = 0, DCAM_QUERYCAPABILITY_DATATYPE = 1, DCAM_QUERYCAPABILITY_BITSTYPE = 2, DCAM_QUERYCAPABILITY_EVENTS = 3, DCAM_QUERYCAPABILITY_AREA = 4 }; enum { DCAM_CAPABILITY_BINNING2 = 0x00000002, DCAM_CAPABILITY_BINNING4 = 0x00000004, DCAM_CAPABILITY_BINNING8 = 0x00000008, DCAM_CAPABILITY_BINNING16 = 0x00000010, DCAM_CAPABILITY_BINNING32 = 0x00000020, DCAM_CAPABILITY_TRIGGER_EDGE = 0x00000100, DCAM_CAPABILITY_TRIGGER_LEVEL = 0x00000200, DCAM_CAPABILITY_TRIGGER_MULTISHOT_SENSITIVE = 0x00000400, DCAM_CAPABILITY_TRIGGER_CYCLE_DELAY = 0x00000800, DCAM_CAPABILITY_TRIGGER_SOFTWARE = 0x00001000, DCAM_CAPABILITY_TRIGGER_FASTREPETITION = 0x00002000, DCAM_CAPABILITY_TRIGGER_TDI = 0x00004000, DCAM_CAPABILITY_TRIGGER_TDIINTERNAL = 0x00008000, DCAM_CAPABILITY_TRIGGER_POSI = 0x00010000, DCAM_CAPABILITY_TRIGGER_NEGA = 0x00020000, DCAM_CAPABILITY_TRIGGER_START = 0x00040000, /* reserved = 0x00080000, */ /* reserved = 0x00400000, */ /*** --- from 2.1.2 --- ***/ DCAM_CAPABILITY_USERMEMORY = 0x00100000, DCAM_CAPABILITY_RAWDATA = 0x00200000, DCAM_CAPABILITY_ALL = 0x0037FF3E }; /*** --- status --- ***/ enum { DCAM_STATUS_ERROR = 0x0000, DCAM_STATUS_BUSY = 0x0001, DCAM_STATUS_READY = 0x0002, DCAM_STATUS_STABLE = 0x0003, DCAM_STATUS_UNSTABLE = 0x0004 }; enum { DCAM_EVENT_FRAMESTART = 0x0001, DCAM_EVENT_FRAMEEND = 0x0002, /* all modules support */ DCAM_EVENT_CYCLEEND = 0x0004, /* all modules support */ DCAM_EVENT_VVALIDBEGIN = 0x0008 }; /*** --- update --- ***/ enum { DCAM_UPDATE_RESOLUTION = 0x0001, DCAM_UPDATE_AREA = 0x0002, DCAM_UPDATE_DATATYPE = 0x0004, DCAM_UPDATE_BITSTYPE = 0x0008, DCAM_UPDATE_EXPOSURE = 0x0010, DCAM_UPDATE_TRIGGER = 0x0020, DCAM_UPDATE_DATARANGE = 0x0040, DCAM_UPDATE_DATAFRAMEBYTES = 0x0080, DCAM_UPDATE_PROPERTY = 0x0100, DCAM_UPDATE_ALL = 0x01ff }; /*** --- trigger mode --- ***/ enum { DCAM_TRIGMODE_INTERNAL = 0x0001, DCAM_TRIGMODE_EDGE = 0x0002, DCAM_TRIGMODE_LEVEL = 0x0004, DCAM_TRIGMODE_MULTISHOT_SENSITIVE = 0x0008, DCAM_TRIGMODE_CYCLE_DELAY = 0x0010, DCAM_TRIGMODE_SOFTWARE = 0x0020, DCAM_TRIGMODE_FASTREPETITION = 0x0040, DCAM_TRIGMODE_TDI = 0x0080, DCAM_TRIGMODE_TDIINTERNAL = 0x0100, DCAM_TRIGMODE_START = 0x0200 }; /*** --- trigger polarity --- ***/ enum { DCAM_TRIGPOL_NEGATIVE = 0x0000, DCAM_TRIGPOL_POSITIVE = 0x0001 }; /*** --- string id --- ***/ #define DCAM_IDSTR_BUS 0x04000101 #define DCAM_IDSTR_CAMERAID 0x04000102 #define DCAM_IDSTR_VENDOR 0x04000103 #define DCAM_IDSTR_MODEL 0x04000104 #define DCAM_IDSTR_CAMERAVERSION 0x04000105 #define DCAM_IDSTR_DRIVERVERSION 0x04000106 #define DCAM_IDSTR_MODULEVERSION 0x04000107 #define DCAM_IDSTR_DCAMAPIVERSION 0x04000108 /* **************************************************************** * functions * **************************************************************** */ /*** --- error function --- ***/ long DCAMAPI dcam_getlasterror ( HDCAM h, char* buf OPTION, DWORD bytesize OPTION); /*** --- initialize and finalize --- ***/ BOOL DCAMAPI dcam_init ( HINSTANCE hInst, long* pCount OPTION, LPCSTR reserved OPTION ); BOOL DCAMAPI dcam_uninit ( HINSTANCE hInst, LPCSTR reserved OPTION ); BOOL DCAMAPI dcam_getmodelinfo ( long index, long dwStringID, char* buf, DWORD bytesize ); BOOL DCAMAPI dcam_open ( HDCAM* ph, long index, LPCSTR reserved OPTION ); BOOL DCAMAPI dcam_close ( HDCAM h); /*** --- camera infomation --- ***/ BOOL DCAMAPI dcam_getstring ( HDCAM h, long dwStringID, char* buf, DWORD bytesize ); BOOL DCAMAPI dcam_getcapability ( HDCAM h, DWORD* pCapability, DWORD dwCapTypeID ); BOOL DCAMAPI dcam_getdatatype ( HDCAM h, ccDatatype* pType ); BOOL DCAMAPI dcam_getbitstype ( HDCAM h, ccBitstype* pType ); BOOL DCAMAPI dcam_setdatatype ( HDCAM h, ccDatatype type ); BOOL DCAMAPI dcam_setbitstype ( HDCAM h, ccBitstype type ); BOOL DCAMAPI dcam_getdatasize ( HDCAM h, SIZE* pSize ); BOOL DCAMAPI dcam_getbitssize ( HDCAM h, SIZE* pSize ); /*** --- parameters --- ***/ BOOL DCAMAPI dcam_queryupdate ( HDCAM h, DWORD* pFlag, DWORD dwReserved OPTION ); BOOL DCAMAPI dcam_getbinning ( HDCAM h, long* pBinning ); BOOL DCAMAPI dcam_getexposuretime ( HDCAM h, double* pSec ); BOOL DCAMAPI dcam_gettriggermode ( HDCAM h, long* pMode ); BOOL DCAMAPI dcam_gettriggerpolarity ( HDCAM h, long* pPolarity ); BOOL DCAMAPI dcam_setbinning ( HDCAM h, long binning ); BOOL DCAMAPI dcam_setexposuretime ( HDCAM h, double sec ); BOOL DCAMAPI dcam_settriggermode ( HDCAM h, long mode ); BOOL DCAMAPI dcam_settriggerpolarity ( HDCAM h, long polarity ); /*** --- capturing --- ***/ BOOL DCAMAPI dcam_precapture ( HDCAM h, ccCaptureMode mode ); BOOL DCAMAPI dcam_getdatarange ( HDCAM h, long* pMax, long* pMin); BOOL DCAMAPI dcam_getdataframebytes ( HDCAM h, DWORD* pSize); BOOL DCAMAPI dcam_allocframe ( HDCAM h, long frame ); BOOL DCAMAPI dcam_getframecount ( HDCAM h, long* pFrame ); BOOL DCAMAPI dcam_capture ( HDCAM h ); BOOL DCAMAPI dcam_idle ( HDCAM h ); BOOL DCAMAPI dcam_wait ( HDCAM h, DWORD* pCode, DWORD timeout OPTION, HANDLE event OPTION ); BOOL DCAMAPI dcam_getstatus ( HDCAM h, DWORD* pStatus ); BOOL DCAMAPI dcam_gettransferinfo ( HDCAM h, long* pNewestFrameIndex, long* pFrameCount ); BOOL DCAMAPI dcam_freeframe ( HDCAM h ); /*** --- user memory support --- ***/ BOOL DCAMAPI dcam_attachbuffer ( HDCAM h, void** pTop, DWORD size); BOOL DCAMAPI dcam_releasebuffer ( HDCAM h); /*** --- data transfer --- ***/ BOOL DCAMAPI dcam_lockdata ( HDCAM h, void** pTop, long* pRowbytes, long frame ); BOOL DCAMAPI dcam_lockbits ( HDCAM h, BYTE** pTop, long* pRowbytes, long frame ); BOOL DCAMAPI dcam_unlockdata ( HDCAM h ); BOOL DCAMAPI dcam_unlockbits ( HDCAM h ); /*** --- LUT --- ***/ BOOL DCAMAPI dcam_setbitsinputlutrange ( HDCAM h, long inMax, long inMin OPTION ); BOOL DCAMAPI dcam_setbitsoutputlutrange ( HDCAM h, BYTE outMax, BYTE outMin OPTION ); /*** --- Control Panel --- ***/ BOOL DCAMAPI dcam_showpanel ( HDCAM h, HWND hWnd, DWORD reserved OPTION ); /*** --- extended --- ***/ BOOL DCAMAPI dcam_extended ( HDCAM h, UINT iCmd, LPVOID param, DWORD size ); /*** --- software trigger --- ***/ BOOL DCAMAPI dcam_firetrigger ( HDCAM h ); /* **************************************************************** * for extended function * **************************************************************** */ /*** -- iCmd parameter of dcam_extended() -- ***/ enum { DCAM_IDMSG_QUERYPARAMCOUNT = 0x0200, /* DWORD* param, bytesize = sizeof( DWORD ); */ DCAM_IDMSG_SETPARAM = 0x0201, /* const DCAM_HDR_PARAM* param, bytesize = sizeof( parameters); */ DCAM_IDMSG_GETPARAM = 0x0202, /* DCAM_HDR_PARAM* param, bytesize = sizeof( parameters); */ DCAM_IDMSG_QUERYPARAMID = 0x0204 /* DWORD param[], bytesize = sizeof( param); */ }; /*** -- parameter header -- ***/ typedef struct _DCAM_HDR_PARAM { DWORD cbSize; /* size of whole structure */ DWORD id; /* specify the kind of this structure */ DWORD iFlag; /* specify the member to be set or requested by application */ DWORD oFlag; /* specify the member to be set or gotten by module */ } DCAM_HDR_PARAM; /* **************************************************************** */ #ifdef __cplusplus /* end of extern "C" */ } /*** C++ utility ***/ inline BOOL failed( DCAMERR err ) { return (int)err < 0; } #endif /* ================================================================ * for backward compatibilities * ---------------------------------------------------------------- */ /*** following values may be removed in DCAM-API 3.0 or later ***/ #define DCAM_CAPABILITY_TRIGGER_PIV DCAM_CAPABILITY_TRIGGER_FASTREPETITION #define DCAM_TRIGMODE_PIV DCAM_TRIGMODE_FASTREPETITION #define DCAM_IDSTR_SPECIFICATIONVERSION DCAM_IDSTR_DCAMAPIVERSION #define _INCLUDE_DCAMAPI_H_ #endif