/*************************************************************************\
* "$RCSfile: FW_Lib.h,v $"                                                *
***************************************************************************
* Information by CVS or VSS:                                              *
*     Last check in on: $Date: 2009-10-06 14:09:21 $                      *
*     by                $Author: schluckebier $
*     Revision        : $Revision: 1.51 $                                 *
*                                                                         *
* CVS: $Source: /Daten/Projekte/CVS/Lib/FW_Lib/src/FW_Lib.h,v $
***************************************************************************
* 31-Jan-2002                                                             *
**************************************************************************/
/*!	\file FW_Lib.h
*	\brief FW Library-Interface
*	\author (c) 2002 - 2009 IMAGO Technologies GmbH
*
*	$Revision: 1.51 $
*	$Date: 2009-10-06 14:09:21 $
**************************************************************************/

#define _FW_LIB_HID {"FW_Lib.h", __DATE__, __TIME__, _REVISION($Revision: 1.51 $)}

#ifndef __FW_LIB__
#define __FW_LIB__

#include "vision_box.h"

#define FW_MAXCAM 32  //!< Maximum number of possible cameras
#define FW_MAXNAME 20 //!< Maximum length of model name

/*************************************************************************\
* Structures                                                              *
\*************************************************************************/

/*************************************************************************/
/*! @brief FW-Camera-Structure

	All needed information of a connected camera is stored in this structure.
**************************************************************************/
typedef struct sFWCAMERA
{
	unsigned char  WWUID[8];	//!< World Wide Unique camera ID
	unsigned int   CamType;		//!< Internal ID for camera type (#eCAMERA_TYPES)
	unsigned short IsActive;	//!< Camera has been started
	unsigned short Channel;		//!< Number of isochronal channel used for this camera (0xFF = none)
	unsigned short BitsPerPixel;//!< Bits per pixel (8, 16, 24)
	unsigned short ColorCoding;	//!< Color coding (#eCCODING)
	unsigned short ImageWidth;	//!< Width
	unsigned short ImageHeight;	//!< Height
	unsigned short Packetsize;	//!< Size of one sun system packet (private)
	unsigned short Packetcount;	//!< Number of sun system packets for a frame (private)
	unsigned short CamID;		//!< Physical number of camera (private)
	         short Sat;			//!< Number of Add On Board (private)
	         char  VendorName[FW_MAXNAME];	//!< Vendor of camera
	         char  ModelName[FW_MAXNAME];	//!< Name of camera
} FWCAMERA;

//! Pointer to FWCAMERA structure
typedef FWCAMERA *PFWCAMERA;

//! FW-Camera-Info-Structure
typedef FWCAMERA FWCAMERAINFO[FW_MAXCAM];

//! FW-Feature-Element-Inquiry register
typedef union uFWFELEMENTINQ
{
	unsigned int Register;	//!< Register
	struct
	{
		unsigned int MaxValue	:12; //!< Maximum value
		unsigned int MinValue	:12; //!< Minimum value
		unsigned int ManualInq	:1;  //!< Manual Mode
		unsigned int AutoInq	:1;  //!< Auto Mode
		unsigned int OnOffInq	:1;  //!< Capability of switching feature On/Off
		unsigned int ReadOutInq :1;  //!< Capability of reading this feature
		unsigned int OnePushInq :1;  //!< One push auto mode
		unsigned int Res1		:1;  //!< Reserved
		unsigned int AbsCtrlInq :1;  //!< Capability of control with absolute value
		unsigned int PresenceInq:1;  //!< Presence of this feature
	} Bits;	//!< Bit field
} FWFELEMENTINQ;

//! FW-Feature-Element-Control register
typedef union uFWFELEMENTCTL
{
	unsigned int Register;	//!< Register
	struct
	{
		unsigned int Value		:12; //!< Value
		unsigned int Value2		:12; //!< Value 2
		unsigned int AMMode		:1;  //!< Manual/Auto mode
		unsigned int OnOff		:1;  //!< On/off feature
		unsigned int OnePush	:1;  //!< One Push start
		unsigned int Res1		:3;  //!< Reserved
		unsigned int AbsCtrl	:1;  //!< Absolute value control
		unsigned int PresenceInq:1;  //!< Presence of this feature
	} Bits;	//!< Bit field
} FWFELEMENTCTL;

//! FW-Feature-Trigger-Inquiry register
typedef union uFWTRIGGERINQ
{
	unsigned int Register;	//!< Register
	struct
	{
		unsigned int TriggerMode15Inq:1;	//!< Presence of Trigger Mode 15
		unsigned int TriggerMode14Inq:1;	//!< Presence of Trigger Mode 14
		unsigned int Res3		:8;			//!< Reserved
		unsigned int TriggerModeNInq:6;		//!< Presence of Trigger Mode 0-5
		unsigned int SoftwareTriggerInq:1;	//!< Presence of Software Trigger
		unsigned int Res2		:3;			//!< Reserved
		unsigned int TriggerSourceNInq:4;	//!< Presence of Trigger Source 0-3
		unsigned int ValueReadInq:1;		//!< Capability of reading raw trigger input
		unsigned int PolarityInq:1;			//!< Capability of changing polarity of the trigger input
		unsigned int OnOffInq	:1;			//!< Capability of switching feature On/Off
		unsigned int ReadOutInq :1;			//!< Capability of reading this feature
		unsigned int Res1		:2;			//!< Reserved
		unsigned int AbsCtrlInq :1;			//!< Capability of control with absolute value
		unsigned int PresenceInq:1;			//!< Presence of this feature
	} Bits;	//!< Bit field
} FWTRIGGERINQ;

//! FW-Feature-Trigger-Control register
typedef union uFWTRIGGERCTL
{
	unsigned int Register;	//!< Register
	struct
	{
		unsigned int Parameter	:12; //!< Parameter for trigger function
		unsigned int Res2		:4;  //!< Reserved
		unsigned int TriggerMode:4;  //!< Trigger mode (0..15)
		unsigned int TriggerValue:1; //!< Trigger Input raw signal value
		unsigned int TriggerSource:3;//!< Select trigger source
		unsigned int TriggerPolarity:1;  //!< Select trigger polarity
		unsigned int OnOff		:1;  //!< On/off feature
		unsigned int Res1		:4;  //!< Reserved
		unsigned int AbsCtrl	:1;  //!< Absolute value control
		unsigned int PresenceInq:1;  //!< Presence of this feature
	} Bits;	//!< Bit field
} FWTRIGGERCTL;

/*************************************************************************/
/*! @brief FW-Feature-Structure

	This structure contains the presence, modes, value for controlling,
	maximum and minimum value for a feature.
**************************************************************************/
typedef struct sFWFEATURE
{
	int Value; //!< Current value of feature
	FWFELEMENTINQ Feature; //!< Value of inquiry register for feature element
} FWFEATURE;

/*************************************************************************/
/*! @brief FW-Features-Structure

	This structure contains a list of features provided by a camera. Every
	type of IEEE 1394 camera has different modes, minimum and maximum values
	for each available feature. This data is stored in the #FWFEATURES
	structure.\n
	To check the presence of a feature, use the \p PresenceInq field of the
	#FWFELEMENTINQ structure or the FW_FeaturePresence() function.
	@par Example:
	@code
FWFEATURES Feature;

FW_GetFeatures(CamNo, &Feature);
if (FW_FeaturePresence(&Feature.Gain)) ...
	@endcode
**************************************************************************/
typedef struct sFWFEATURES
{
	FWFEATURE Brightness;	//!< Feature: Brightness
	FWFEATURE WB_U;			//!< Feature: White balance U
	FWFEATURE WB_V;			//!< Feature: White balance V
	FWFEATURE Gamma;		//!< Feature: Gamma
	FWFEATURE Shutter;		//!< Feature: Shutter
	FWFEATURE Gain;			//!< Feature: Gain
	FWFEATURE Iris;			//!< Feature: Iris
	FWFEATURE Focus;		//!< Feature: Focus
	FWFEATURE Trigger;		//!< Feature: External trigger
	FWFEATURE Zoom;			//!< Feature: Zoom
	FWFEATURE Sharpness;	//!< Feature: Sharpness
	FWFEATURE Hue;			//!< Feature: Hue
	FWFEATURE Saturation;	//!< Feature: Saturation
	int bAutoWhiteBal;		//!< Auto white balance enabled
	int bInit;				//!< Structure is initialized
} FWFEATURES;

//! Available video formats
typedef struct sFWVIDEOFORMATS
{
	int Num;				//!< Number of video formats
	int Formats[8];			//!< List of video formats
} FWVIDEOFORMATS;

//! Available video modes for a particular video format
typedef struct sFWVIDEOMODES
{
	int Num0;				//!< Number of video modes, format 0
	int Num1;				//!< Number of video modes, format 1
	int Num2;				//!< Number of video modes, format 2
	int Num7;				//!< Number of video modes, format 7
	int Modes0[8];			//!< List of video modes, format 0
	int Modes1[8];			//!< List of video modes, format 1
	int Modes2[8];			//!< List of video modes, format 2
	int Modes7[8];			//!< List of video modes, format 7
} FWVIDEOMODES;

//! Available frame rates for a particular video mode
typedef struct sFWFRAMERATES
{
	int Num;				//!< Number of frame rates
	int FRates[8];			//!< List of frame rates
} FWFRAMERATES;

/*************************************************************************\
* Global variables                                                        *
\*************************************************************************/

extern far FWCAMERAINFO FW_CInfo;
extern far int FW_CCount;
extern far int FW_Delay;
extern far int FW_SPI_Wait;
extern far int FW_Error;

extern far char *FW_LibName;
extern far char *FW_LibVersion;
extern far char *FW_LibDate;

/*************************************************************************/
/*! @brief Color coding

	For converting the raw camera images, use the functions from the VIB
	library or GUI library.
**************************************************************************/
enum eCCODING
{
	FW_NOCOLOR  =  0,
	FW_MONO8    = 10, //!< Monochrome, 8 bit per pixel
	FW_MONO16   = 11, //!< Monochrome, 16 bit per pixel
	FW_YUV8411  = 20, //!< YUV
	FW_YUV8422  = 21, //!< YUV, 16 bit per pixel (default color)
	FW_YUV8444  = 22, //!< YUV
	FW_RGB8     = 30, //!< RGB, 8 bit per color, 24 bit per pixel
	FW_RGB16    = 31, //!< RGB, 16 bit per color
	FW_BAYER    = 40, //!< Camera uses Bayer pattern
	FW_UNKNOWNC = 99  //!< Camera uses unknown color coding
};

/*** Video modes *********************************************************/
//! Video format 0 (Up to VGA)
enum eFORMAT_0
{
	YUV444_160X120 = 0,
	YUV422_320X240,
	YUV411_640X480,
	YUV422_640X480,
	RGB24_640X480,
	Y8_640X480,
	Y16_640X480
};

//! Video format 1 (SVGA to XGA)
enum eFORMAT_1
{
	YUV422_800X600 = 0,
	RGB24_800X600,
	Y8_800X600,
	YUV422_1024X768,
	RGB24_1024X768,
	Y8_1024X768,
	Y16_800X600,
	Y16_1024X768
};

//! Video format 2 (SXGA to UXGA)
enum eFORMAT_2
{
	YUV422_1280X960 = 0,
	RGB24_1280X960,
	Y8_1280X960,
	YUV422_1600X1200,
	RGB24_1600X1200,
	Y8_1600X1200,
	Y16_1280X960,
	Y16_1600X1200
};

//! Frame rates
enum eFRAMERATE
{
	FPS_1_87 = 0,
	FPS_3_75,
	FPS_7_5,
	FPS_15,
	FPS_30,
	FPS_60,
	FPS_120,
	FPS_240
};

/*** Camera types ********************************************************/
//! Supported camera types
enum eCAMERA_TYPES
{
	NO_CAM				=  0,
//=== Sony 1 - 99 ===
	SONY_XCD_X700		=  1,	//!< 1024 * 768, Y, 7.5 fps
	SONY_XCD_SX900		=  2,	//!< 1280 * 1024, Y, 3.75 fps
	SONY_DFW_X700		=  3,	//!< 1024 * 768, YUV, 15 fps
	SONY_DFW_SX900		=  4,	//!< 1280 * 1024, YUV, 7.5 fps
	SONY_DFW_VL500		=  5,	//!< 640 * 480, YUV, 30 fps
	SONY_DFW_V500		=  6,	//!< ---
	SONY_XCD_X710		= 11,	//!< 1024 * 768, Y, 30 fps
	SONY_XCD_SX910,				//!< 1280 * 1024, Y, 15 fps
	SONY_DFW_X710,				//!< 1024 * 768, YUV, 15 fps
	SONY_DFW_SX910,				//!< 1280 * 1024, YUV, 7.5 fps
	SONY_XCD_X710CR,			//!< 1024 * 768, Y (Bayer), 30 fps
	SONY_XCD_SX910CR,			//!< 1280 * 1024, Y (Bayer), 15 fps
	SONY_XCD_V50,				//!< 640 * 480, Y, 60 fps
	SONY_XCD_V50CR,				//!< 640 * 480, Y (Bayer), 60 fps
	SONY_XCD_V60,				//!< 640 * 480, Y, 60 fps
	SONY_XCD_V60CR,				//!< 640 * 480, Y (Bayer), 60 fps
	SONY_XCD_SX90,				//!< 1280 * 1024, Y, 15(30) fps
	SONY_XCD_SX90CR,			//!< 1280 * 1024, Y (Bayer), 15(30) fps
	SONY_XCD_U100,				//!< 1600 * 1200, Y, 15 fps
	SONY_XCD_U100CR,			//!< 1600 * 1200, Y (Bayer), 15 fps
//=== Basler 101 - 199 ===
	BASLER_A101F 		= 101,	//!< 1280 * 960, Y, 7.5 fps
	BASLER_A101FC,
	BASLER_A102F,				//!< 1280 * 960, Y, 15 fps
	BASLER_A102FC,				//!< 1280 * 960, YUV, 7.5 fps
	BASLER_A301F,				//!< 640 * 480, Y, 15 fps
	BASLER_A301FC,				//!< 640 * 480, Y (Bayer), 15 fps
	BASLER_A302F,				//!< 782 * 582, Y, 15 fps
	BASLER_A302FC,				//!< 782 * 582, YUV, 15 fps
	BASLER_A601F,				//!< 640 * 480, Y, 60 fps
	BASLER_A601FC,				//!< 640 * 480, YUV, 15 fps
	BASLER_A601HDR,				//!< 640 * 480, Y, 60 fps
	BASLER_A602F,				//!< 640 * 480, Y, 15 fps
	BASLER_A602FC,				//!< 640 * 480, Y (Bayer), 100 fps
//=== unibrain 201 - 299 ===
	UNIBRAIN_FI400		= 201,	//!< 640 * 480, YUV, 15 fp
	UNIBRAIN_FI,				//!< 640 * 480, YUV, 15 fp
//=== JVC 301 - 399 ===
	JVC_KY1030U			= 301,	//!< 1280 * 960, YUV, 3,75 fps
	JVC_KYF75U,					//!< 1280 * 960, RGB, 7.5 fps
//=== Imagine Source 401-499 ===
	IMSO_DFK21F04		= 401,	//!< 640 * 480, YUV, 15 fps
	IMSO_DMx21F04,				//!< 640 * 480, Y, 30 fps
//=== Allied 501-599 ===
	ALLIED_MF080C		= 501,	//!< Marlin F080C, 1024 * 768, YUV, 15 fps
	ALLIED_MF080B,				//!< Marlin F080B, ---
	ALLIED_MF033C,				//!< Marlin F033C, 640 * 480, YUV, 30 fps
	ALLIED_MF033B,				//!< Marlin F033B, ---
	ALLIED_MF131C,				//!< Marlin F131C, 1280 * 960, YUV4:2:2, 7.5 fps
	ALLIED_MF131B,				//!< Marlin F131B, 1280 * 960, Y, 7.5 fps
	ALLIED_OF510C,				//!< Oscar F510C, 2560 * 1920, YUV
	ALLIED_OF810C,				//!< Oscar F810C, ---
	ALLIED_DF145C,				//!< Dolphin F145C, 1280 * 960, YUV4:2:2, 7.5 fps
	ALLIED_DF145B,				//!< Dolphin F145B, 1280 * 960, Y, 15 fps
	ALLIED_DF201C,				//!< Dolphin F201C, ---
	ALLIED_DF201B,				//!< Dolphin F201B, ---
	ALLIED_PF032C,				//!< Pike F032C, 640 * 480, YUV, 30 fps
	ALLIED_PF032B,				//!< Pike F032B, 640 * 480, Y, 30 fps
	ALLIED_PF145C,				//!< Pike F145C, 1024 * 768, YUV, 15 fps
	ALLIED_PF145B,				//!< Pike F145B, 1024 * 768, Y, 15 fps
	ALLIED_SF033C,				//!< Stingray F033C, 640 * 480, YUV, 30 fps
	ALLIED_SF033B,				//!< Stingray F033B, 640 * 480, Y, 30 fps
	ALLIED_SF080C,				//!< Stingray F080C, 1024 * 768, YUV, 15 fps
	ALLIED_SF080B,				//!< Stingray F080B, 1024 * 758, Y, 15 fps
	ALLIED_SF145C,				//!< Stingray F145C, 1280 * 960, YUV, 7.5 fps
	ALLIED_SF145B,				//!< Stingray F145B, 1280 * 960, Y, 15 fps
	ALLIED_SF201C,				//!< Stingray F201C, 1600 * 1200, YUV, 7.5 fps
	ALLIED_SF201B,				//!< Stingray F201B, 1600 * 1200, Y, 15 fps

//=== AGLAIA 601-699 ===
	AGLAIA_NCAM104		= 601,	//!<  640 * 480, Y, 30 fps
//=== ACC 701-799 ===
	ACC_OSIRIS			= 701,	//!<  640 * 480, Y, 15 fps
	ACC_OSIRISC,
//=== Indigo Omega (FLIR) 801-899 ===
	INDIGO_OMEGA		= 801,	//!< 164 * 129, Y, 15 fps
//=== Baumer Optronics 901-999 ===
	BAUMER_TXD03C		= 901,	//!< 640 * 480, Y
	BAUMER_TXD08C,				//!< 1024 * 768, YUV
//===
	UNKNOWN_CAM = 9999
};

/*** DCAM_SetValue *******************************************************/
//! Supported DCAM features
enum eDCAM_FEATURE
{
	CAM_BRIGHTNESS = 0,
	CAM_EXPOSURE,
	CAM_SHARPNESS,
	CAM_WHITE_BALANCE,
	CAM_HUE,
	CAM_SATURATION,
	CAM_GAMMA,
	CAM_SHUTTER,
	CAM_GAIN,
	CAM_IRIS,
	CAM_FOCUS,
	CAM_TEMPERATURE,
	CAM_TRIGGER,
	CAM_ZOOM,
	CAM_PAN,
	CAM_TILT,
	CAM_OPTICAL_FILTER,
	CAM_CAPTURE_SIZE,
	CAM_CAPTURE_QUALITY
};

/*** DCAM Error ***********************************************************/
//! Error codes
enum eDCAM_ERROR
{
	DCAM_ERROR_OK = 0,
	DCAM_ERROR_ILLEGAL_FORMAT,
	DCAM_ERROR_ILLEGAL_MODE,
	DCAM_ERROR_ILLEGAL_FRATE,
	DCAM_ERROR_ILLEGAL_FEATURE,
	DCAM_ERROR_FEATURE_NOT_AVAIL,
	DCAM_ERROR_FEATURE_NOT_PRESENT,
	DCAM_ERROR_FEATURE_OFF,
	DCAM_ERROR_ILLEGAL_FUNCTION,
	DCAM_ERROR_ILLEGAL_VALUE,
	DCAM_ERROR_NO_MEMCHAN,
	DCAM_ERROR_ILLEGAL_MEMCHAN,
	DCAM_ERROR_TRANSPORT_FAILURE,
	DCAM_ERROR_NO_CAMERA = 29,
	DCAM_ERROR_TIMEOUT = 255
};

/**************************************************************************/
//! \name Camera Inquiry Registers
//\{
#define BRIGHTNESS_INQ		0xF0F00500 //!< Brightness inquiry register
#define AUTO_EXPOSURE_INQ	0xF0F00504 //!< Auto exposure inquiry register
#define SHARPNESS_INQ		0xF0F00508 //!< Sharpness inquiry register
#define WHITE_BAL_INQ		0xF0F0050C //!< White balance inquiry register
#define HUE_INQ				0xF0F00510 //!< Hue inquiry register
#define SATURATION_INQ		0xF0F00514 //!< Saturation inquiry register
#define GAMMA_INQ			0xF0F00518 //!< Gamma inquiry register
#define SHUTTER_INQ			0xF0F0051C //!< Shutter inquiry register
#define GAIN_INQ			0xF0F00520 //!< Gain inquiry register
#define IRIS_INQ			0xF0F00524 //!< Iris inquiry register
#define FOCUS_INQ			0xF0F00528 //!< Focus inquiry register
#define TEMPERATURE_INQ		0xF0F0052C //!< Temperature inquiry register
#define TRIGGER_INQ			0xF0F00530 //!< Trigger inquiry register
#define TRIGGER_DLY_INQ		0xF0F00534 //!< Trigger delay inquiry register
#define WHITE_SHD_INQ		0xF0F00538 //!< White shading compensation inquiry register
#define FRAME_RATE_INQ		0xF0F0053C //!< Frame rate prioritize inquiry register
#define ZOOM_INQ			0xF0F00580 //!< Zoom inquiry register
#define PAN_INQ				0xF0F00584 //!< Pan inquiry register
#define TILT_INQ			0xF0F00588 //!< Tilt inquiry register
#define OPTICAL_FILTER_INQ	0xF0F0058C //!< Optical filter inquiry register
#define CAPTURE_SIZE_INQ	0xF0F005C0 //!< Capture size inquiry register
#define CAPTURE_QUALITY_INQ	0xF0F005C4 //!< Capture quality inquiry register
//\}

//! \name Camera Control Registers
//\{
#define BRIGHTNESS_CTL		0xF0F00800 //!< Brightness control register
#define AUTO_EXPOSURE_CTL	0xF0F00804 //!< Auto exposure control register
#define SHARPNESS_CTL		0xF0F00808 //!< Sharpness control register
#define WHITE_BAL_CTL		0xF0F0080C //!< White balance control register
#define HUE_CTL				0xF0F00810 //!< Hue control register
#define SATURATION_CTL		0xF0F00814 //!< Saturation control register
#define GAMMA_CTL			0xF0F00818 //!< Gamma control register
#define SHUTTER_CTL			0xF0F0081C //!< Shutter control register
#define GAIN_CTL			0xF0F00820 //!< Gain control register
#define IRIS_CTL			0xF0F00824 //!< Iris control register
#define FOCUS_CTL			0xF0F00828 //!< Focus control register
#define TEMPERATURE_CTL		0xF0F0082C //!< Temperature control register
#define TRIGGER_CTL			0xF0F00830 //!< Trigger control register
#define TRIGGER_DLY_CTL		0xF0F00834 //!< Trigger delay control register
#define WHITE_SHD_CTL		0xF0F00838 //!< White shading compensation control register
#define FRAME_RATE_CTL		0xF0F0083C //!< Frame rate prioritize control register
#define ZOOM_CTL			0xF0F00880 //!< Zoom control register
#define PAN_CTL				0xF0F00884 //!< Pan control register
#define TILT_CTL			0xF0F00888 //!< Tilt control register
#define OPTICAL_FILTER_CTL	0xF0F0088C //!< Optical filter control register
#define CAPTURE_SIZE_CTL	0xF0F008C0 //!< Capture size control register
#define CAPTURE_QUALITY_CTL	0xF0F008C4 //!< Capture quality control register
//\}

//! \name Camera Advanced Feature Registers
//\{
#define	ADV_TIMEBASE		0xF1000208 //!< Multiplier for shutter register
#define ADV_IO_INP_CTRL1	0xF1000300 //!< I/O input 1 control register
#define ADV_IO_INP_CTRL2	0xF1000304 //!< I/O input 2 control register
#define ADV_TRIGGER_DELAY	0xF1000400 //!< Delayed start of integration
//\}

/*************************************************************************\
* Prototypes                                                              *
\*************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

//! \name FW Functions
//\{
int  FW_GetLibVersion(int *pMajor, int *pMinor);
int  FW_InitCameras(int Sat);
void FW_InitCameraInfo(void);
int  FW_GetFeatureValue(int Camera, unsigned int Addr, FWFELEMENTINQ Feature);
void FW_GetFeatures(int Camera, FWFEATURES *pFeature);
void FW_SetFeatures(int Camera, FWFEATURES *pFeature);
unsigned int FW_ReadRegister(int Camera, int Addr);
void FW_WriteRegister(int Camera, int Addr, int Value);
int FW_InqFormats(int Camera, FWVIDEOFORMATS *pFormats);
int FW_InqModes(int Camera, FWVIDEOMODES *pModes);
int FW_InqFRates(int Camera, int Format, int Mode, FWFRAMERATES *pFRates);

int FW_StartGrab(void *pData, int Channel, int Camera, int Wait);
int FW_StartGrabFrames(void *pData, int Channel, int Camera, int Frames, int Wait);
int FW_GrabWait2(int Channel, unsigned int usTimeout);

//=== Start cameras ===
int  FW_StartCamera(int Camera, int Channel);
void FW_StopCamera(int Camera);
void FW_ErrorText(char *pText, int nTextSize, int nError);
int  FW_StartDefault(int Camera, int Channel, int Format, int Mode, int FRate);
//\}

inline int FW_FeaturePresence(FWFEATURE *pFeature)
	{ return pFeature->Feature.Bits.PresenceInq; }
inline int FW_FeatureMin(FWFEATURE *pFeature)
	{ return pFeature->Feature.Bits.MinValue; }
inline int FW_FeatureMax(FWFEATURE *pFeature)
	{ return pFeature->Feature.Bits.MaxValue; }
inline int FW_GrabWait(int Channel)
	{ return FW_GrabWait2(Channel, 2500000); }

//! \name DCAM Functions
//\{
int DCAM_Init(int *pCameraCount);
int DCAM_Info(int Camera, unsigned char *WWUID);
int DCAM_Reset(int Camera);
int DCAM_InqFormats(int Camera, int *pFormats);
int DCAM_InqModes(int Camera, int Format, int *pModes);
int DCAM_InqFRates(int Camera, int Format, int Mode, int *pFRates);
int DCAM_InqBasic(int Camera, int *pBasicFunc);
int DCAM_SetVideo(int Camera, int Format, int Mode, int Frate);
int DCAM_SetIso(int Camera, int Channel, int Speed);
int DCAM_Power(int Camera, int OnOff);
int DCAM_Start(int Camera);
int DCAM_Stop(int Camera);
int DCAM_SavePrefs(int Camera, int MemChan);
int DCAM_LoadPrefs(int Camera, int MemChan);
int DCAM_OnePush(int Camera, int Feature);
int DCAM_FeatureOnOff(int Camera, int Feature, int OnOff);
int DCAM_AutoOnOff(int Camera, int Feature, int OnOff);
int DCAM_SetValue(int Camera, int Feature, int Value);
int DCAM_SetWhitebal(int Camera, int UB_Value, int VR_Value);
int DCAM_SetTrig(int Camera, int Mode, int Polarity);
int DCAM_F7InqMaxSize(int Camera, int *pWidth, int *pHeight);
int DCAM_F7InqColcode(int Camera, int *pColCodings);
int DCAM_F7SetWindow(int Camera, int Top, int Left, int Width, int Height);
int DCAM_F7SetColcode(int Camera, int ColCode);
int DCAM_F7SetBytePerPacket(int Camera, int NumBytes);
int DCAM_OneShot(int Camera);
int DCAM_MultiShot(int Camera, int Count);
int DCAM_Read(int Camera, unsigned int AdrLow, unsigned int *pValue);
int DCAM_Write(int Camera, unsigned int AdrLow, unsigned int Value);
int DCAM_StartIsoTransfer(int Camera);
//\}

#ifdef __cplusplus
}
#endif

#endif

/*************************************************************************/
