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

📄 bcam.h

📁 该程序实现FIRE足球机器人竞赛中的3:3比赛源码
💻 H
📖 第 1 页 / 共 3 页
字号:
  // Is the driver open
  bool IsOpen();

  // Opens the driver
  void Open( CString DeviceName, HWND hWndNotify = NULL );

  bool Authorize(const CString& Name,const CString& Id);

  // Closes the driver and frees all resources (esp. OVERLAPPED structures from cancelled driver calls)
  void Close();

  // Initialize camera
  void Initialize(); 

  // Query whether the video mode is supported
  bool IsVideoModeSupported( DCSVideoFormat VideoFormat, DCSVideoMode VideoMode = DCS_IgnoreVideoMode, DCSVideoFrameRate VideoFramerate = DCS_IgnoreFrameRate );
  // Query the current video mode settings
  void GetVideoMode( DCSVideoFormat *VideoFormat, DCSVideoMode *VideoMode, DCSVideoFrameRate *VideoFramerate );
  // Set new video mode
  void SetVideoMode( DCSVideoFormat VideoFormat, DCSVideoMode VideoMode, DCSVideoFrameRate VideoFramerate = DCS_IgnoreFrameRate );

  // Save current settings to a file
  void SaveSettingsToFile(const CString& FileName);
  // Save current settings to the registry
  void SaveSettingsToRegistry(const CString& KeyName);
  // save the current settings to a PropertyBag
  void SaveSettings(const CPropertyBagPtr ptrBag);

  // Restore settings from a file
  void RestoreSettingsFromFile(const CString& FileName);
  // Restore settings from the registry
  void RestoreSettingsFromRegistry(const CString& KeyName);
  // Restore settings from a property bag
  void RestoreSettings(const CPropertyBagPtr ptrBag);
  // Set the thread priority of the current thread
  void SetCurrentThreadPriority(unsigned long priority);
  // Set the priority of the driver's queue server thread
  unsigned long SetQueueServerPriority(unsigned long priority);
  // Get the priority of the driver's queue server thread
  unsigned long GetQueueServerPriority();


  /// Inquire, get and set all scalar properties.
  class CScalarProperty
  {
    const BcamFeatureID m_FunctionId; ///< Identifies the feature
    CBcam * const m_pBcam;            ///< Backpointer for data exchange
    /// Different modes for CSR 
    enum Mode_t
    {
      mOnOff,
      mAutoMode,
      mAbsControl
    };

  public:

    CScalarProperty( FunctionCode_t AsyncFuncCodeRaw, FunctionCode_t AsyncFuncCodeAbs, 
      BcamFeatureID FuncId, CBcam* pBcam );

    bool IsSupported(Supported_t Inquiry = inqPresent);

    /// Get and set boolean controls
    class CBoolControl
    {
      CBcam * const m_pBcam;
      const BcamFeatureID m_FunctionId;
      Mode_t m_Mode;

    public:
      CBoolControl( BcamFeatureID FuncId, Mode_t Mode, CBcam* pBcam ); 

      void operator=(bool Value);
      bool operator()();    
    };  // CBoolControl 

    /// Set feature with absolute value
    CBoolControl AbsControl;

    /// Control feature automatically
    CBoolControl AutoMode;

    /// Switch feature on/off
    CBoolControl OnOff;

    /// Control feauture automatically once
    void OnePush();

    /// Access property via raw register
    class CRawRegister
    {
    private:
      CBcam * const m_pBcam;                ///< Backpointer for data exchange
      const BcamFeatureID m_FunctionId;     ///< Feature identifier
      const FunctionCode_t m_FunctionCode;  ///< Function code used for asynchronous calls
    public:
      CRawRegister( FunctionCode_t FuncCode, BcamFeatureID FuncId, CBcam* pBcam );

      unsigned long Min();
      unsigned long Max();
      void operator=(unsigned long Value);
      unsigned long operator()();   
      void SetAsync(unsigned long Value, void *pContext = NULL);
    } Raw; ///< Raw register of the feature

    /// Access property via absolute register
    class CAbsValue
    {
    private:
      const CBcam* m_pBcam;                ///< Backpointer to the camera object
      const BcamFeatureID m_FunctionId;    ///< Feature identifier
      const FunctionCode_t m_FunctionCode; ///< Function code for asynchronous calls
    public:
      CAbsValue( FunctionCode_t FuncCode, BcamFeatureID FuncId, CBcam* pBcam ); 

      double Min();
      double Max();
      void operator=(double Value);
      double operator()();    
      void SetAsync(double Value, void *pContext = NULL);
    } Abs; ///< Absolute register of a feature

    protected:
      void Save(const CPropertyBagPtr ptrBag);
      void Restore(const CPropertyBagPtr ptrBag);
      friend class CBcam;
 
    friend class CBoolControl;

  };  // CScalarProperty
  friend class CScalarProperty;
  friend class CScalarProperty::CBoolControl;
  friend class CScalarProperty::CRawRegister;

  CScalarProperty Shutter;          ///< Shutter feature
  CScalarProperty Gain;             ///< Gain feature
  CScalarProperty Brightness;       ///< Brightness (offset) feature
  CScalarProperty Hue;              ///< Hue feature
  CScalarProperty Saturation;       ///< Saturation feature
  CScalarProperty Gamma;            ///< Gamma correction feature


  /// Inquire, get and set properties of whitebalance feature
  class CWhiteBalance
  {
    IMPLEMENT_THIS(CBcam, WhiteBalance);

   

    /// Different modes for CSR 
    enum Mode_t
    {
      mOnOff,
      mAutoMode,
      mAbsControl
    };

    enum Value_t
    {
      vUB,    // U / B value
      vVR     // V / R value
    };

  public:

    CWhiteBalance();

    bool IsSupported(Supported_t Inquiry = inqPresent);

    /// Get and set boolean controls
    class CBoolControl
    {
      CBcam * const m_pBcam;
      Mode_t m_Mode;

    public:
      CBoolControl(Mode_t Mode, CBcam* pBcam ); 

      void operator=(bool Value);
      bool operator()();    
    };  // CBoolControl 

    /// Set feature with absolute value
    CBoolControl AbsControl;

    /// Control feature automatically
    CBoolControl AutoMode;

    /// Switch feature on/off
    CBoolControl OnOff;

    /// Control feauture automatically once
    void OnePush();

    /// Access property via raw register
    class CRawRegister
    {
      IMPLEMENT_THIS(CWhiteBalance, Raw);

    public:

      CRawRegister();

      unsigned long Min();
      unsigned long Max();

      /// Access whitebalance property via raw register
      class CWhiteBalanceRawValue
      {
        const Value_t m_vt;                   ///< Do we represent U/B or V/R value?
        CBcam * const m_pBcam;                ///< Backpointer for data exchange
      public: 
        CWhiteBalanceRawValue(Value_t vt, CBcam* pBcam);

        void operator=(unsigned long Value);
        unsigned long operator()();   
        void SetAsync(unsigned long Value, void *pContext = NULL);
      };
      CWhiteBalanceRawValue UBValue; ///< U or B value
      CWhiteBalanceRawValue VRValue; ///< V or R value
    } Raw; ///< Raw register value control

    /// Access property via absolute register
    class CAbsValue
    {
      IMPLEMENT_THIS(CWhiteBalance, Abs);
    public:

      CAbsValue();

      double Min();
      double Max();

      /// Access whitebalance property via absolute register
      class CWhiteBalanceAbsValue
      {
        const Value_t m_vt;                   ///< Do we represent U/B or V/R value?
        CBcam * const m_pBcam;                ///< Backpointer for data exchange
      public: 
        CWhiteBalanceAbsValue(Value_t vt, CBcam* pBcam);

        void operator=(double Value);
        double operator()();   
        void SetAsync(double Value, void *pContext = NULL);
      };
      CWhiteBalanceAbsValue UBValue;          ///< U or B value
      CWhiteBalanceAbsValue VRValue;          ///< V or R value
    } Abs;  ///< Absolute value control

    protected:
      void Save(const CPropertyBagPtr ptrBag);
      void Restore(const CPropertyBagPtr ptrBag);

    friend class CBcam;
    friend class CBoolControl;
    friend class CRawRegister;
    friend class CRawRegister::CWhiteBalanceRawValue;
    friend class CAbsValue;
    friend class CAbsValue::CWhiteBalanceAbsValue;

  } WhiteBalance; ///< WhiteBalance feature 

  friend class CWhiteBalance;
  friend class CWhiteBalance::CBoolControl;
  friend class CWhiteBalance::CRawRegister;
  friend class CWhiteBalance::CRawRegister::CWhiteBalanceRawValue;



  /// Inquire, get and set the test image feature from advanced feature set.
  class CTestImage
  {
    IMPLEMENT_THIS(CBcam, TestImage);
  public:
    
    bool IsSupported(Supported_t Inquiry = inqPresent);
    void operator=(ImageOnMode Value); 
    ImageOnMode operator()();  
  protected:
    void Save(const CPropertyBagPtr ptrBag);
    void Restore(const CPropertyBagPtr ptrBag);
    friend class CBcam;

  } TestImage; ///< Test image feature
  friend class CTestImage;

  /// Pointer to a callback function, called during image upload
  typedef bool (*BcamProgressCallbackFunc) (int, void*);

  /// Inquire, get and set the shading correction feature from advanced feature set
  class CShadingCorrection
  {
    IMPLEMENT_THIS(CBcam, ShadingCorrection);
  public:
    bool IsSupported( Supported_t Inquiry = inqPresent);
    void SetImage( void* pBuffer, size_t BufferSize, Timespan timeout=INFINITE, 
                   BcamProgressCallbackFunc pCallback = NULL , int BlockSize = 0,  void* pContext = NULL ); 
    SCMode_t operator()();
    void operator=(SCMode_t Value);
  } ShadingCorrection; ///< Shading correction feature
  
  friend class CShadingCorrection;

  /// Inquire, get and set the external trigger feature
  class CTrigger
  {
    IMPLEMENT_THIS(CBcam, Trigger); ///< This() retruns a pointer to outer class

  public:
    CTrigger( FunctionCode_t AsyncFuncCodeRaw, FunctionCode_t AsyncFuncCodeAbs, CBcam* pBcam );

    bool IsSupported(Supported_t Inquiry = inqPresent);
    bool IsModeSupported(DCSTriggerMode TriggerMode);

    ///Get and set boolean controls
    class CBoolControl
    {
      virtual CTrigger * This() = 0;

    public:
      
      void operator=(bool Value);
      bool operator()();    
    protected:
      /// Mode of a switch
      enum Mode_t
      {
        mOnOff,      ///< specifies the OnOff control of the feature
        mAbsControl, ///< specifies the absolute control of the feature
      } m_Mode; ///< mode used by this instance


      friend class CBoolControlAbs;
      friend class CBoolControlOnOff;
    };  // CBoolControl 

    friend class CBoolControl;
    /// Get and set absolute control feature
    class CBoolControlAbs: public CBoolControl
    {
      IMPLEMENT_THIS(CTrigger, AbsControl); ///< This() retruns a pointer to outer class
    public:
      /// Constructor
      CBoolControlAbs(){m_Mode = mAbsControl;};
      /// Set the new value
      void operator=(bool Value) { CBoolControl::operator=(Value); }
    } AbsControl; ///< Absolute control feature

    /// Get and set absolute control feature
    class CBoolControlOnOff: public CBoolControl
    {
      IMPLEMENT_THIS(CTrigger, OnOff); ///< This() retruns a pointer to outer class
    public:
      /// Constructor
      CBoolControlOnOff(){m_Mode = mOnOff;};
      /// Set the new Value
      void operator=(bool Value) { CBoolControl::operator=(Value); }
    } OnOff; ///< On/Off feature

    /// Get and set trigger polarity
    class CPolarity
    {
      IMPLEMENT_THIS( CTrigger, Polarity ); ///< This() returns pointer to outer class
    public:
      /// Set polarity
      void operator=(Polarity_t Value);
      /// Get polarity
      Polarity_t operator()();    
    } Polarity; ///< Trigger polarity feature
    friend class CPolarity;

 
    /// Get and set mode
    class CMode

⌨️ 快捷键说明

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