⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.h

📁 该程序实现FIRE足球机器人竞赛中的3:3比赛源码
💻 H
📖 第 1 页 / 共 4 页
字号:
  ULONG ImageInq5       :  1;   ///< Presence of test image 5
  ULONG ImageInq4       :  1;   ///< Presence of test image 4
  ULONG ImageInq3       :  1;   ///< Presence of test image 3
  ULONG ImageInq2       :  1;   ///< Presence of test image 2
  ULONG ImageInq1       :  1;   ///< Presence of test image 1
  ULONG                 :  7;
  ULONG Presence_Inq    :  1;   ///< Presence of this feature
} BcamTestImage;     

/// Shading feature
typedef struct _BCAM_SHADING_CTRL
{
  ULONG     ShadingMode;    ///< 0:Shading Correction disabled / !=0:Shading mode enabled
  BOOLEAN   Test;           ///< TRUE:Camera outputs the current shading data as an image / FALSE:Normal camera operation
  BOOLEAN   WriteEnable;    ///< TRUE: Enables write access to shading data memory / FALSE: Disable
  BOOLEAN   Completed;      ///< TRUE: Correct number of expected bytes written or more bytes written than expected / FALSE: Less bytes written than expected 
}BcamShadingCtrl;

/// Shading inquiry
typedef struct _BCAM_SHADING_INQ
{
  ULONG   ModeFlags;       ///< Presence of shading modes
  BOOLEAN Present;         ///< Presence of this feature
}
BcamShadingInq;

/// A struct describing the image layout in format 7
typedef struct _BCAM_VIDEO_FORMAT7_DESCRIPTOR
{
  ULONG nTotalPixX          ///< Width in pixels
    , nTotalPixY;           ///< Height in pixels
  ULONG nSizeIncX,          ///< Increment for the image width
    nSizeIncY;              ///< Increment for the image height
  ULONG nPosIncX,           ///< Increment for the x-position
    nPosIncY;               ///< Increment for the y-position
  ULONG ColorCodingMask[8]; ///< Bitfield describing the supported color modes
} BcamVideoFormat7Descriptor;



/// Bandwidth and buffer related data 
typedef struct _BCAM_BANDWIDTH_DESCRIPTOR
{
  ULONGLONG nBytesTotalFrameSize; ///< Image size in bytes
  ULONG nBytesPerPacketMax;       ///< Maximum packet size in bytes
  ULONG nBytesPerPacketRec;       ///< Recommended packet size in bytes
  ULONG nBytesPerPacketUnit;      ///< Increment for the packet size in bytes
  ULONG nBytesPerPacketCurrent;   ///< Current packet size in bytes
  ULONG nPacketsPerFrame;         ///< Number of packet per image
} BcamBwDesc;



/** Identifiers used to query the camera for string data */
typedef enum _BCAM_STRING_IDS
{
  String_VendorName,    ///< Specifies the camara vendor name
  String_ModelName,     ///< Specifies the camera model name
  String_CameraVersion  ///< Specifies the camera version
} BcamStringID;



/** Feature ID codes */
typedef enum _BCAM_FEATURE_IDS
{
  /* Standard DCS features */
  FeatureID_CaptureQuality = 0x0E,  ///< Specifies the image quality for format 6
  FeatureID_CaptureSize,            ///< Specifies the image size for format 6
  FeatureID_OpticalFilter = 0x1C,   ///< Specifies the optical filter control
  FeatureID_Tilt,                   ///< Specifies the tilt control
  FeatureID_Pan,                    ///< Specifies the pan control
  FeatureID_Zoom,                   ///< Specifies the zoom control
  FeatureID_Trigger = 0x33,         ///< Specifies the trigger control
  FeatureID_Temparature,            ///< Specifies the temperature control
  FeatureID_Focus,                  ///< Specifies the focus control
  FeatureID_Iris,                   ///< Specifies the iris control
  FeatureID_Gain,                   ///< Specifies the gain control
  FeatureID_Shutter,                ///< Specifies the shutter control
  FeatureID_Gamma,                  ///< Specifies the gamma control
  FeatureID_Saturation,             ///< Specifies the saturation control
  FeatureID_Hue,                    ///< Specifies the hue control
  FeatureID_WhiteBalance,           ///< Specifies the white balance control
  FeatureID_Sharpness,              ///< Specifies the sharpness control
  FeatureID_AutoExposure,           ///< Specifies the auto exposure control
  FeatureID_Brightness,             ///< Specifies the brightness control
} BcamFeatureID;

/** Feature flag bit shift values */
typedef enum _FEATURE_FLAG_BIT_SHIFT_VALUES
{
  FeatBshift_Present = 0,                       ///< Specifies the feature presence bit
  FeatBshift_AbsControl,                        ///< Specifies the absolute value control
  FeatBshift_OnePush = 3,                       ///< Specifies the one-push automatic control
  FeatBshift_ReadOut,                           ///< Specifies the readout capability
  FeatBshift_OnOff,                             ///< Specifies the on/off control
  FeatBshift_Auto,                              ///< Specifies the automatic mode control
  FeatBshift_TriggerPolarity = FeatBshift_Auto, ///< Specifies the trigger input polatity control
  FeatBshift_Manual                             ///< Specifies the manual mode control
};

/*
* All features are equal, but some are more equal than others, so we have
* to deal with a few special cases here. That's why there is that union.
*/
/// Descriptor used for inquiring the subfeatures of a DCAM feature
typedef union _BCAM_FEATURE_INQ_DESCRIPTOR
{
  struct
  {
    ULONG Max_Value       : 12;   ///< Maximum value for this feature
    ULONG Min_Value       : 12;   ///< Minimum value for this feature
    ULONG Manual_Inq      :  1;   ///< Availability of manual mode
    ULONG Auto_Inq        :  1;   ///< Availability of automatic mode
    ULONG On_Off_Inq      :  1;   ///< Availability of swithing this feature on and off
    ULONG Read_Out_Inq    :  1;   ///< Capability of reading the value of this feature
    ULONG One_Push_Inq    :  1;   ///< Availability of one push automatic mode
    ULONG                 :  1;
    ULONG Abs_Control_Inq :  1;   ///< Availability of absolute control
    ULONG Presence_Inq    :  1;   ///< Presence of this feature
  } Scalar;       ///< a scalar feature

  struct
  {
    ULONG                   : 12;
    ULONG Trigger_Mode3_Inq :  1; ///< Presence of Trigger mode 3
    ULONG Trigger_Mode2_Inq :  1; ///< Presence of Trigger mode 2
    ULONG Trigger_Mode1_Inq :  1; ///< Presence of Trigger mode 1
    ULONG Trigger_Mode0_Inq :  1; ///< Presence of Trigger mode 0
    ULONG                   :  9;
    ULONG Polarity_Inq      :  1; ///< Capability of changing the polarity of the trigger input
    ULONG On_Off_Inq        :  1; ///< Availability of switching this feature on and off
    ULONG Read_Out_Inq      :  1; ///< Capability of reading the value of this feature
    ULONG                   :  2; 
    ULONG Abs_Control_Inq   :  1; ///< Availability of abolute control
    ULONG Presence_Inq      :  1; ///< Presence of this feature
  } Trigger;      ///< trigger feature
} BcamFeatureInqDescriptor;


/** Write mask for setting DCS feature CSR */
#define DCS_FEATURE_CSR_SET_VALUE               0x0001    ///< Specifies the value control
#define DCS_FEATURE_CSR_SET_A_M_MODE            0x0002    ///< Specifies the automatic/manual mode control
#define DCS_FEATURE_CSR_SET_TRIGGER_POLARITY    0x0004    ///< Specifies the trigger input polarity control
#define DCS_FEATURE_CSR_SET_ON_OFF              0x0008    ///< Specifies the on/off control
#define DCS_FEATURE_CSR_SET_ONE_PUSH            0x0010    ///< Specifies the one-push automatic mode control
#define DCS_FEATURE_CSR_SET_ABS_CONTROL         0x0020    ///< Specifies the absolute value control
#define DCS_FEATURE_CSR_SET_UB_VALUE            0x0040    ///< Specifies the white balance U/B value
#define DCS_FEATURE_CSR_SET_VR_VALUE            0x0080    ///< Specifies the white balance V/R value
#define DCS_FEATURE_CSR_SET_TARGET_TEMPERATURE  0x0100    ///< Specifies the target temperature
#define DCS_FEATURE_CSR_SET_TRIGGER_MODE        0x0200    ///< Specifies the trigger mode
#define DCS_FEATURE_CSR_SET_PARAMETER           0x0400    ///< Specifies the trigger parameter
#define DCS_FEATURE_CSR_SET_VALID_FLAGS         0x07ff    ///< Specifies the set of valid flag bits

/** Write mask for setting shading advanced feature CSR */
#define BCAM_SHADING_CTRL_TEST                  0x0001    ///< Specifies the value Test
#define BCAM_SHADING_CTRL_SHADINGMODE           0x0002    ///< Specifies the value ShadingMode
#define BCAM_SHADING_CTRL_WRITEENABLE           0x0004    ///< Specifies the value ShadingMode
#define BCAM_SHADING_CTRL_VALID_FLAGS           0x0007    ///< Specifies the set of valid flag bits


/*
* All features are equal, but some are more equal than others, so we have
* to deal with a few special cases here. That's why there is that union.
*/
/// Descriptor for controlling a DCAM feature
typedef union _BCAM_FEATURE_CSR_DESCRIPTOR
{
  struct
  {
    ULONG Value             : 12; ///< Value of this feature
    ULONG                   : 12; 
    ULONG A_M_Mode          :  1; ///< Automatic mode - manual mode switch
    ULONG ON_OFF            :  1; ///< Switch to turn this feature on or off, off is 0, on is 1
    ULONG One_Push          :  1; ///< One push automatic mode, off is 0, on is 1
    ULONG                   :  3;
    ULONG Abs_Control       :  1; ///< Absolute value control
    ULONG Presence_Inq      :  1; ///< Presence of this feature
  } Scalar; ///< a scalar feature
  struct
  {
    ULONG Parameter         : 12; ///< Parameter of the trigger function
    ULONG                   :  4;
    ULONG Trigger_Mode      :  4; ///< Trigger mode 0-15
    ULONG                   :  4;
    ULONG Trigger_Polarity  :  1; ///< Trigger polarity, high active is 1, low active is 0
    ULONG ON_OFF            :  1; ///< Switch to turn this feature on or off, off is 0, on is 1
    ULONG One_Push          :  1; ///< One push automatic mode, off is 0, on is 1
    ULONG                   :  3;
    ULONG Abs_Control       :  1; ///< Absolute value control
    ULONG Presence_Inq      :  1; ///< Presence of this feature
  } Trigger; ///< Trigger feature

  struct
  {
    ULONG V_R               : 12; ///< V value or R value
    ULONG U_B               : 12; ///< U value or B value
    ULONG A_M_Mode          :  1; ///< Automatic mode - manual mode switch
    ULONG ON_OFF            :  1; ///< Switch to turn this feature on or off, off is0, on is 1
    ULONG One_Push          :  1; ///< One push automatic mode, off is 0, on is 1
    ULONG                   :  3;
    ULONG Abs_Control       :  1; ///< Absolute value control
    ULONG Presence_Inq      :  1; ///< Presence of this feature
  } WhiteBalance; ///< White balance feature

  struct
  {
    ULONG Temperature       : 12; ///< Current value
    ULONG Target_Temperature: 12; ///< Aimed value
    ULONG A_M_Mode          :  1; ///< Automatic mode - manual mode switch
    ULONG ON_OFF            :  1; ///< Switch to turn this feature on or off, off is0, on is 1
    ULONG One_Push          :  1; ///< One push automatic mode, off is 0, on is 1
    ULONG                   :  3;
    ULONG Abs_Control       :  1; ///< Absolute value control
    ULONG Presence_Inq      :  1; ///< Presence of this feature
  } Temperature; ///< Temperature feature
} BcamFeatureCSRDescriptor;

/** Macro to test whether a particular feature supports a given operation */
#define BcamFeatureTest(desc, shft) ((desc)->Flags & (0x1UL << shft) != 0)


/** Commands for grabbing \see DCAM, ISO_EN, SINGLESHOT, MULTISHOT */
typedef enum _BCAM_CAMERA_COMMANDS
{
  CamCmd_Stop,        ///< Turns ISO_EN off
  CamCmd_Start,       ///< Turns ISO_EN on
  CamCmd_SingleGrab,  ///< Starts a single grab
  CamCmd_MultiGrab    ///< Starts a sequence of grabs
} BcamCameraCommand;


/**
* \brief IOCTL_BCAM_INIT_CAMERA
* Initialize the camera.
* Reset camera to factory defaults. 
* This function neither has any arguments nor results.
*
*/
#define IOCTL_BCAM_INIT_CAMERA \
  _CTL_CODE(FILE_DEVICE_BCAM_1394, OrdInitCamera, METHOD_NEITHER, FILE_ANY_ACCESS)



/**
* \brief IOCTL_BCAM_GET_VIDEO_FORMAT_MASK
*  Query supported video formats.
* \return ResGetVideoFormatMask Return a mask word that has a bit set for every video format supported by the camera.
* 
*/
#define IOCTL_BCAM_GET_VIDEO_FORMAT_MASK \
  _CTL_CODE(FILE_DEVICE_BCAM_1394, OrdGetVideoFormatMask, METHOD_BUFFERED, FILE_ANY_ACCESS)
/// Mask with video mode
typedef struct _BCAM_GET_VIDEO_FORMAT_MASK_OUT
{
  ULONG VideoFormatMask; ///< Mask with the supported video formats
} ResGetVideoFormatMask;



/**
* \brief IOCTL_BCAM_GET_VIDEO_MODE_MASK
* Query supported video modes.
* \param arg : ArgGetVideoModeMask; Specifies the video format
* \return ResGetVideoModeMask A mask word that has a bit set for every video mode supported by the camera
* for a given video format.
*/
#define IOCTL_BCAM_GET_VIDEO_MODE_MASK \
  _CTL_CODE(FILE_DEVICE_BCAM_1394, OrdGetVideoModeMask, METHOD_BUFFERED, FILE_ANY_ACCESS)
/// Argument for the GetVideoModeMask function
typedef struct _BCAM_GET_VIDEO_MODE_MASK_IN
{
  ULONG VideoFormat;  ///< Specifies the video format
} ArgGetVideoModeMask;
/// Result of the GetVideoModeMask function
typedef struct _BCAM_GET_VIDEO_MODE_MASK_OUT
{
  ULONG VideoMode;    ///< Mask with the supported video modes
} ResGetVideoModeMask;



/**
* \brief IOCTL_BCAM_GET_FRAME_RATE_MASK
* Query supported frame rates
* \param arg : ArgGetFrameRateMask, Specifies video format and mode
* \return ResGetFrameRateMask a mask word that has a bit set for every FPS (frames per second) value supported
* by the camera for a particular format/mode combination.
*/
#define IOCTL_BCAM_GET_FRAME_RATE_MASK \
  _CTL_CODE(FILE_DEVICE_BCAM_1394, OrdGetFrameRateMask, METHOD_BUFFERED, FILE_ANY_ACCESS)
/// Argument for the GetFrameRateMask function
typedef struct _BCAM_GET_FRAME_RATE_MASK_IN
{
  ULONG VideoFormat,    ///< Specifies the video format
    VideoMode;          ///< Specifies the video mode
} ArgGetFrameRateMask;
/// Result of the GetFrameRateMask function
typedef struct _BCAM_GET_FRAME_RATE_MASK_OUT
{
  ULONG FrameRateMask;  ///< Mask with the supported frame rates
} ResGetFrameRateMask;



/**
* \brief IOCTL_BCAM_SET_VIDEO_FORMAT_MODE_FRAME_RATE
* Set the camera to use a particular video format/mode combination.
* If format is 7, FrameRate is ignored.
* \param arg : ArgSetVideoFormatModeFrameRate
*/
#define IOCTL_BCAM_SET_VIDEO_FORMAT_MODE_FRAME_RATE \
  _CTL_CODE(FILE_DEVICE_BCAM_1394, OrdSetVideoFormatModeFrameRate, METHOD_BUFFERED, FILE_ANY_ACCESS)
/// Argument of the SetVideoFormatModeFrameRate function
typedef struct _BCAM_SET_VIDEO_FORMAT_MODE_FRAME_RATE_IN
{
  ULONG VideoFormat,  ///< Specifies the video format

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -