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

📄 bcam.cpp

📁 BCAM 1394 Driver
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    {
      absControl = ptrBag->ReadBool( _T( "AbsControl" ));
    }
    if ( absControl )
      Abs = ptrBag->ReadFloat( _T( "AbsValue" ) );
    else
      Raw = ptrBag->ReadLong( _T( "RawValue" ) );
  }
}


///////////////////////////////////////////////////////////////////////////////
//
// class CBcam::CWhiteBalance
//
//

//------------------------------------------------------------------------------
// CBcam::CWhiteBalance::CWhiteBalance() 
//------------------------------------------------------------------------------
// Author: 
//------------------------------------------------------------------------------
/**
 * \brief Contruct a white balance feature
 *
 */
//------------------------------------------------------------------------------
CBcam::CWhiteBalance::CWhiteBalance()
: 
  AbsControl( mAbsControl, This() ),
  AutoMode( mAutoMode, This() ),
  OnOff( mOnOff, This() )
{ 
  /* NOP */ 
}

//------------------------------------------------------------------------------
// bool CBcam::CWhiteBalance::IsSupported(Supported_t Inquiry)
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Inquire wether a feature is supported 
*
* \param     Inquiry Code of the requested feature.
* \return    
*
* Returns whether the feature is supported by the camera
* \exception BcamException The value of \c ::GetLastError() is thrown
* If the feature is not specified in DCAM then a BcamException with the
* error code BCAM_E_INVALID_INQUIRY is thrown.
* 
*/
//------------------------------------------------------------------------------
bool CBcam::CWhiteBalance::IsSupported(Supported_t Inquiry)
{
  ArgQueryDCSFeatureInq arg;
  arg.FeatId = FeatureID_WhiteBalance;
  ResQueryDCSFeatureInq res;
  This()->TryTransmit( _T( "CBcam::CWhiteBalance::IsSupported()" ),
    IOCTL_BCAM_QUERY_DCS_FEATURE_INQ, &arg, sizeof(arg), &res, sizeof(res) );
  switch ( Inquiry )
  {
  case inqPresent:
    return res.Scalar.Presence_Inq;
  case inqAbsControl:
    return res.Scalar.Abs_Control_Inq;
  case inqOnePush:
    return res.Scalar.One_Push_Inq;
  case inqReadOut:
    return res.Scalar.Read_Out_Inq;
  case inqOnOff:
    return res.Scalar.On_Off_Inq;
  case inqAuto:
    return res.Scalar.Auto_Inq;
  case inqManual:
    return res.Scalar.Manual_Inq;
  default:
    throw BcamException( BCAM_E_INVALID_INQUIRY, _T( "CBcam::WhiteBalance::IsSupported()" ), &Inquiry);
    
  }
}

//------------------------------------------------------------------------------
// void CBcam::CWhiteBalance::OnePush()
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Activate the OnePush feature.
* \exception BcamException The value of \c ::GetLastError() is thrown
*/
//------------------------------------------------------------------------------
void CBcam::CWhiteBalance::OnePush()
{
  ArgSetDCSFeatureCSR arg;
  ZeroMemory(&arg, sizeof(arg));
  arg.FeatId = FeatureID_WhiteBalance;
  arg.FeatCSRDescriptor.Scalar.One_Push = 1;
  arg.Mask = DCS_FEATURE_CSR_SET_ONE_PUSH;
  This()->TryTransmit( _T( "CBcam::CWhiteBalance::OnePush()" ), IOCTL_BCAM_SET_DCS_FEATURE_CSR, &arg, sizeof(arg) );
}

///////////////////////////////////////////////////////////////////////////////
// class CBcam::CWhiteBalance::CBoolControl

//------------------------------------------------------------------------------
// CBcam::CWhiteBalance::CBoolControl::CBoolControl( Mode_t Mode, CBcam* pBcam )
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Create a switch for a part of a DCAM feature (e.g. Auto mode of Brightness)
*
* \param     FuncId Identifies the feature
* \param     Mode   Identifies the part of the feature
* \param     pBcam  Backpointer to the communication object 
*/
//------------------------------------------------------------------------------
CBcam::CWhiteBalance::CBoolControl::CBoolControl(Mode_t mode,  CBcam* pBcam ) 
: m_pBcam( pBcam ),
  m_Mode(mode)
{
  /* NOP */ 
}

//------------------------------------------------------------------------------
// void CBcam::CWhiteBalance::CBoolControl::operator=(bool Value)
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Set the value of the feature synchronously.
*
* \param     Value  The value to set, true means on and false off.
* 
* \exception BcamException The value of \c ::GetLastError() is thrown
*
* \b Example 
* \code
* m_pBcam->WhiteBalance.AutoMode = true;
* m_pBcam->WhiteBalance.AutoMode.operator =( true );
* \endcode
*/
//------------------------------------------------------------------------------
void CBcam::CWhiteBalance::CBoolControl::operator=(bool Value)
{
  ArgSetDCSFeatureCSR arg;
  ZeroMemory(&arg, sizeof(arg));
  arg.FeatId = FeatureID_WhiteBalance;
  switch ( m_Mode )
  {
  case mOnOff:
    arg.FeatCSRDescriptor.WhiteBalance.ON_OFF = Value;
    arg.Mask = DCS_FEATURE_CSR_SET_ON_OFF;
    break;
  case mAutoMode:
    arg.FeatCSRDescriptor.WhiteBalance.A_M_Mode = Value;
    arg.Mask = DCS_FEATURE_CSR_SET_A_M_MODE;
    break;
  case mAbsControl:
    arg.FeatCSRDescriptor.WhiteBalance.Abs_Control = Value;
    arg.Mask = DCS_FEATURE_CSR_SET_ABS_CONTROL;
    break;
  default:
    assert(false);
  }
  m_pBcam->TryTransmit( _T( "CBcam::CWhiteBalance::CBoolControl::operator=()" ), IOCTL_BCAM_SET_DCS_FEATURE_CSR, &arg, sizeof(arg) );
}


//------------------------------------------------------------------------------
// bool CBcam::CWhiteBalance::CBoolControl::operator()()
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Get the value of the feature synchronously.
*
* \return    
*
* Returns the current value. True means on and false off.
* 
* \exception BcamException The value of \c ::GetLastError() is thrown
*
* \b Example
* \code
* bool IsOn;
* IsOn = m_pBcam->WhiteBalance.AutoMode();
* IsOn = m_pBcam->WhiteBalance.AutoMode.operator()();
* \endcode
*/
//------------------------------------------------------------------------------
bool CBcam::CWhiteBalance::CBoolControl::operator()()
{
  bool retVal = false;
  ArgGetDCSFeatureCSR arg;
  ZeroMemory(&arg, sizeof(arg));
  arg.FeatId = FeatureID_WhiteBalance;
  ResGetDCSFeatureCSR res;
  m_pBcam->TryTransmit( _T( "CBcam::CWhiteBalance::CBoolControl::Operator()()" ), IOCTL_BCAM_GET_DCS_FEATURE_CSR, &arg, sizeof(arg), &res, sizeof(res) );
  switch ( m_Mode )
  {
  case mOnOff:
    retVal = res.WhiteBalance.ON_OFF;
    break;
  case mAutoMode:
    retVal = res.WhiteBalance.A_M_Mode;
    break;
  case mAbsControl:
    retVal = res.WhiteBalance.Abs_Control;
    break;
  default:
    assert(false);
  }
  return retVal;
}

///////////////////////////////////////////////////////////////////////////////
// class CBcam::CWhiteBalance::CRawRegister

//------------------------------------------------------------------------------
// CBcam::CWhiteBalance::CRawRegister::CRawRegister( ): 
// Author: 
//------------------------------------------------------------------------------
/**
 * default constructor
 */
//------------------------------------------------------------------------------
CBcam::CWhiteBalance::CRawRegister::CRawRegister( )
: UBValue(vUB, This()->This()),
  VRValue(vVR, This()->This())
{
  /* NOP */
}
  
//------------------------------------------------------------------------------
// unsigned long CBcam::CWhiteBalance::CRawRegister::Min()
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Get the minimum of the white balance values
*
* \return    
*
* Returns the minimum value.
* 
* \throw BcamException The value of \c::GetLastError() is thrown
*
* \b Example
* \code
* unsigned long value;
* value = m_pBcam->WhiteBalance.Raw.Min();
* \endcode
*/
//------------------------------------------------------------------------------
unsigned long CBcam::CWhiteBalance::CRawRegister::Min()
{
  ArgQueryDCSFeatureInq arg;
  arg.FeatId = FeatureID_WhiteBalance;
  ResQueryDCSFeatureInq res;
  This()->This()->TryTransmit( _T( "CBcam::CWhiteBalance::CRawRegister::Min()" ), IOCTL_BCAM_QUERY_DCS_FEATURE_INQ, &arg, sizeof(arg), &res, sizeof(res) );
  return res.Scalar.Min_Value;
}

//------------------------------------------------------------------------------
// unsigned long CBcam::CWhiteBalance::CRawRegister::Max()
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Get the maximum of the white balance values 
*
* \return    
*
* Returns the maximum value.
* 
* \throw BcamException The value of \c ::GetLastError() is thrown.
*
* \b Example
* \code
* unsigned long value;
* value = m_pBcam->Brightness.Raw.Max();
* \endcode
*/
//------------------------------------------------------------------------------
unsigned long CBcam::CWhiteBalance::CRawRegister::Max()
{
  ArgQueryDCSFeatureInq arg;
  arg.FeatId = FeatureID_WhiteBalance;
  ResQueryDCSFeatureInq res;
  This()->This()->TryTransmit( _T( "CBcam::CWhiteBalance::CRawRegister::Max()" ), IOCTL_BCAM_QUERY_DCS_FEATURE_INQ, &arg, sizeof(arg), &res, sizeof(res) );
  return res.Scalar.Max_Value;
}


///////////////////////////////////////////////////////////////////////////////
// class CBcam::CWhiteBalance::CRawRegister::CWhiteBalanceRawValue

//------------------------------------------------------------------------------
// CBcam::CWhiteBalance::CRawRegister::CWhiteBalanceRawValue::CWhiteBalanceRawValue(Value_t vt, CBcam* pBcam )
// Author: 
//------------------------------------------------------------------------------
/**
 * constructor
 *
 * \param     vt      Either vUB or vVR
 * \param     pBcam   Backpointer to the communication object 
 * \return    
 *
 * 
 */
//------------------------------------------------------------------------------
CBcam::CWhiteBalance::CRawRegister::CWhiteBalanceRawValue::CWhiteBalanceRawValue(Value_t vt, CBcam* pBcam )
: m_vt(vt),
  m_pBcam(pBcam) 
{
  /* NOP */
}

//------------------------------------------------------------------------------
// void CBcam::CWhiteBalance::CRawRegister::CWhiteBalanceRawValue::operator=(unsigned long Value)
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Set the value of the white balance feature (either U/B or V/R value )
*
* \param     Value Value to set
*
* \exception BcamException The value of \c ::GetLastError() is thrown
*
* \b Example
* \code
* const unsigned value=12;
* m_pBcam->WhiteBalance.Raw.UBValue = value;
* m_pBcam->WhiteBalance.Raw.UBValue.operator=( value );
* \endcode
*/
//------------------------------------------------------------------------------
void CBcam::CWhiteBalance::CRawRegister::CWhiteBalanceRawValue::operator=(unsigned long Value)
{
  ArgSetDCSFeatureCSR arg;
  ZeroMemory(&arg, sizeof(arg));
  arg.FeatId = FeatureID_WhiteBalance;
  if ( m_vt == vUB )
  {
    arg.FeatCSRDescriptor.WhiteBalance.U_B = Value;
    arg.Mask = DCS_FEATURE_CSR_SET_UB_VALUE;
  }
  else
  {
    arg.FeatCSRDescriptor.WhiteBalance.V_R = Value;
    arg.Mask = DCS_FEATURE_CSR_SET_VR_VALUE;
  }
  m_pBcam->TryTransmit( _T( "CBcam::CWhiteBalance::CRawRegister::CWhiteBalanceRawValue::operator=()" ), IOCTL_BCAM_SET_DCS_FEATURE_CSR, &arg, sizeof(arg) );
}

//------------------------------------------------------------------------------
// unsigned long CBcam::CWhiteBalance::CRawRegister::CWhiteBalanceRawValue::operator()()
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Get the value of either the white balance U/B or V/R value 
*
* \return    
*
* Returns the current value.
*
* \exception BcamException The value of \c ::GetLastError() is thrown
*
* \b Example
* \code
* unsigned value;
* value = m_pBcam->WhiteBalance.Raw.UBValue();
* value = m_pBcam->WhiteBalance.Raw.UBValue.operator()();
* \endcode
*/
//------------------------------------------------------------------------------
unsigned long CBcam::CWhiteBalance::CRawRegister::CWhiteBa

⌨️ 快捷键说明

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