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

📄 bcam.cpp

📁 BCAM 1394 Driver
💻 CPP
📖 第 1 页 / 共 5 页
字号:
*/
//------------------------------------------------------------------------------
unsigned long CBcam::CScalarProperty::CRawRegister::Min()
{
  ArgQueryDCSFeatureInq arg;
  arg.FeatId = m_FunctionId;
  ResQueryDCSFeatureInq res;
  m_pBcam->TryTransmit( _T( "CBcam::CScalarProperty::CRawRegister::Min()" ), IOCTL_BCAM_QUERY_DCS_FEATURE_INQ, &arg, sizeof(arg), &res, sizeof(res) );
  return res.Scalar.Min_Value;
}

//------------------------------------------------------------------------------
// unsigned long CBcam::CScalarProperty::CRawRegister::Max()
// Author: Hartmut Nebelung
//------------------------------------------------------------------------------
/**
* \brief Get the maximum of a DCAM feature synchronously.
*
* \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::CScalarProperty::CRawRegister::Max()
{
  ArgQueryDCSFeatureInq arg;
  arg.FeatId = m_FunctionId;
  ResQueryDCSFeatureInq res;
  m_pBcam->TryTransmit( _T( "CBcam::CScalarProperty::CRawRegister::Max()" ), IOCTL_BCAM_QUERY_DCS_FEATURE_INQ, &arg, sizeof(arg), &res, sizeof(res) );
  return res.Scalar.Max_Value;
}

//------------------------------------------------------------------------------
// void CBcam::CScalarProperty::CRawRegister::operator=(unsigned long Value)
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Set the value of a DCAM feature synchronously
*
* \param     Value Value to set
*
* \throw BcamException The value of ::GetLastError() is thrown
*
* \b Example
* \code
* const unsigned value=12;
* m_pBcam->Brightness.Raw = value;
* m_pBcam->Brightness.Raw.operator=( value );
* \endcode
*/
//------------------------------------------------------------------------------
void CBcam::CScalarProperty::CRawRegister::operator=(unsigned long Value)
{
  ArgSetDCSFeatureCSR arg;
  ZeroMemory(&arg, sizeof(arg));
  arg.FeatId = m_FunctionId;
  arg.FeatCSRDescriptor.Scalar.Value = Value;
  arg.Mask = DCS_FEATURE_CSR_SET_VALUE;
  m_pBcam->TryTransmit( _T( "CBcam::CScalarProperty::CRawRegister::operator=()" ), IOCTL_BCAM_SET_DCS_FEATURE_CSR, &arg, sizeof(arg) );
}

//------------------------------------------------------------------------------
// unsigned long CBcam::CScalarProperty::CRawRegister::operator()()
// Author: A.Happe
//------------------------------------------------------------------------------
/**
* \brief Get the value of a DCAM feature synchronously.
*
* \return    
*
* Returns the current value.
*
* \throw BcamException The value of \c ::GetLastError() is thrown
*
* \b Example
* \code
* unsigned value;
* value = m_pBcam->Brightness.Raw();
* value = m_pBcam->Brightness.Raw.operator()();
* \endcode
*/
//------------------------------------------------------------------------------
unsigned long CBcam::CScalarProperty::CRawRegister::operator()()
{
  ArgGetDCSFeatureCSR arg;
  ZeroMemory(&arg, sizeof(arg));
  arg.FeatId = m_FunctionId;
  ResGetDCSFeatureCSR res;
  m_pBcam->TryTransmit( _T( "CBcam::CScalarProperty::CRawRegister::Operator()()" ), IOCTL_BCAM_GET_DCS_FEATURE_CSR, &arg, sizeof(arg), &res, sizeof(res) );
  return res.Scalar.Value;
}

//------------------------------------------------------------------------------
// void CBcam::CScalarProperty::CRawRegister::SetAsync(unsigned long Value, void *pContext)
// Author: A.Happe
//------------------------------------------------------------------------------
/**
* \brief Set the value of a DCAM feature asynchronously.
*
* \param     Value     Value to set
* \param     *pContext Context that will be returned. (optional)
* \throw BcamException The value of \c ::GetLastError() is thrown
*
* \b Example
* \code
* const unsigned long newVal=12;
* m_pBcam->Brightness.Raw.SetAsync( newVal );
* m_pBcam->Brightness.Raw.SetAsync( newVal, &aInfoBlock );
* \endcode
*/
//------------------------------------------------------------------------------
void CBcam::CScalarProperty::CRawRegister::SetAsync(unsigned long Value, void *pContext)
{
  TRACE( _T( "BCAMApi: CBcam::CScalarProperty::CRawRegister::SetAsync(%lu, 0x%p)\n" ), Value, pContext);
  
  BcamOL *pOL = GetNewBcamOL(m_FunctionCode, pContext );
  ArgSetDCSFeatureCSR arg;
  ZeroMemory( &arg, sizeof arg );
  arg.FeatId = m_FunctionId;
  arg.FeatCSRDescriptor.Scalar.Value = Value;
  arg.Mask = DCS_FEATURE_CSR_SET_VALUE;
  if (! m_pBcam->Transmit( IOCTL_BCAM_SET_DCS_FEATURE_CSR, &arg, sizeof arg, pOL ))
  {
    DWORD error = ::GetLastError();
    if (error != ERROR_IO_PENDING)
      throw BcamException( ::GetLastError(), _T( "CBcam::CScalarProperty::CRawRegister::SetAsync()" ) );
  }
}

///////////////////////////////////////////////////////////////////////////////
// class CBcam::CScalarProperty::CAbsValue

//------------------------------------------------------------------------------
// CBcam::CScalarProperty::CAbsValue::CAbsValue( FunctionCode_t FuncCode, BcamFeatureID FuncId, CBcam* pBcam ) : m_pBcam( pBcam ), m_FunctionId( FuncId), m_FunctionCode( FuncCode ){  /* NOP */}double CBcam::CScalarProperty::CAbsValue::Min()
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Create an absolute register object
*
* for accessing a DCAM feature using absolute values (e.g. Gain in dB).
*
* \param     FuncCode  Function code used for asynchronous calls
* \param     FuncId    Feature identifier
* \param     pBcam     Backpointer to the communication object
*/
//------------------------------------------------------------------------------
CBcam::CScalarProperty::CAbsValue::CAbsValue( FunctionCode_t FuncCode, BcamFeatureID FuncId, CBcam* pBcam ) 
: m_pBcam( pBcam ),
m_FunctionId( FuncId),
m_FunctionCode( FuncCode )
{ 
  /* NOP */
}

//------------------------------------------------------------------------------
// double CBcam::CScalarProperty::CAbsValue::Min()
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Get the minimum of a DCAM feature synchronously.
*
* \return    
*
* Returns the minimum value. 
* 
* \throw BcamException the value of ::GetLastError() is thrown.
*
* \b Example
* \code 
* double value;
* value = m_pBcam->Gain.Abs.Min();
* \endcode
*/
//------------------------------------------------------------------------------
double CBcam::CScalarProperty::CAbsValue::Min()
{
  throw BcamException(Bvc::ErrorNumber( E_NOTIMPL ), _T( "CBcam::CScalarProperty::CAbsValue::Min()" ) );
}

//------------------------------------------------------------------------------
// double CBcam::CScalarProperty::CAbsValue::Max()
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Get the maximum of a DCAM feature synchronously.
*
* \return    
*
* Returns the maximum value.
* 
* \throw BcamException The value of ::GetLastError() is thrown.
* 
* \b Example
* \code
* double value;
* value = m_pBcam->Gain.Abs.Max();
* \endcode
*/
//------------------------------------------------------------------------------
double CBcam::CScalarProperty::CAbsValue::Max()
{
  throw BcamException(Bvc::ErrorNumber( E_NOTIMPL ), _T( "CBcam::CScalarProperty::CAbsValue::Max()" ) );
}

//------------------------------------------------------------------------------
// void CBcam::CScalarProperty::CAbsValue::operator=(double Value)
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Set the value of a DCAM feature synchronously.
*
* \param     Value Value to set
* \throw BcamException The value of ::GetLastError() is thrown
* 
* \b Example
* \code
* const double value = 3.5; // dB
* m_pBcam->Gain.Abs = value;
* m_pBcam->Gain.Abs.operatator=( value );

* \endcode
*/
//------------------------------------------------------------------------------
void CBcam::CScalarProperty::CAbsValue::operator=(double /*Value*/)
{
  throw BcamException( Bvc::ErrorNumber( E_NOTIMPL ), _T( "CBcam::CScalarProperty::CAbsValue::operator=()" ) );
}

//------------------------------------------------------------------------------
// double CBcam::CScalarProperty::CAbsValue::operator()()
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Get the value of a DCAM feature synchronously.
*
* \return    
*
* Returns the current value
* 
* \throw BcamException The value of \c ::GetLastError() is thrown
* 
*  \b Example
* \code
* double value;
* value = m_pBcam->Gain.Abs()
* value = m_pBcam->Gain.Abs.operator()();
* \endcode
*/
//------------------------------------------------------------------------------
double CBcam::CScalarProperty::CAbsValue::operator()()
{
  throw BcamException( Bvc::ErrorNumber( E_NOTIMPL ), _T( "CBcam::CScalarProperty::CAbsValue::operator()()" ) );
}

//------------------------------------------------------------------------------
// void CBcam::CScalarProperty::CAbsValue::SetAsync(double Value, void *pContext)
// Author: 
//------------------------------------------------------------------------------
/**
* \brief Set the value of a DCAM feature asynchronously.
*
* \param     Value
* \param     *pContext
* \throw BcamException The value of ::GetLastError() is thrown.
*
* \b Example
* \code
* const double value = 3.5; // dB
* m_pBcam->Gain.Abs.SetAsync( value );
* m_pBcam->Gain.Abs.SetAsync( value, &InfoBlock );
* \endcode
*/
//------------------------------------------------------------------------------
void CBcam::CScalarProperty::CAbsValue::SetAsync(double /*Value*/, void * /*pContext*/)
{
  //  BcamOL *pOL = GetNewBcamOL( m_FunctionCode, pContext );
  //  ArgSetDCSFeatureCSR arg;
  //  ZeroMemory( &arg, sizeof arg );
  //  arg.FeatId = m_FunctionId;
  //  arg.FeatCSRDescriptor. = Value;
  //  arg.Mask = DCS_FEATURE_SET_ABS_CONTROL;
  //  if (! m_pBcam->Transmit( IOCTL_BCAM_SET_DCS_FEATURE_CSR, &arg, sizeof arg, pOL ))
  //    throw BcamException( ::GetLastError(), "CBcam::CScalarProperty::CAbsRegister::SetAsync()" );
  throw BcamException( Bvc::ErrorNumber( E_NOTIMPL ), _T( "CBcam::CScalarProperty::CAbsValue::SetAsync()" ) );

}

//------------------------------------------------------------------------------
// void CBcam::CScalarProperty::Save(const CPropertyBagPtr ptrBag)
// Author: 
// Date: 04.09.2002
//------------------------------------------------------------------------------
/**
 * Save settings to a property bag
 *
 * \param     ptrBag The property Bag
 */
//------------------------------------------------------------------------------
void CBcam::CScalarProperty::Save(const CPropertyBagPtr ptrBag)
{
  if ( IsSupported(inqOnOff) )
  {
    bool onOff = OnOff();
    ptrBag->WriteBool( _T( "OnOff" ), onOff);
    if ( ! onOff )
      return;  // feature is disabled, nothing left to save
  }

  if ( IsSupported(inqAuto) )
  {
    bool autoMode = AutoMode();
    ptrBag->WriteBool( _T( "AutoMode" ), autoMode);
    if ( autoMode )
      return; // feature is in auto mode, nothing left to save
  }

  if ( IsSupported(inqManual) && IsSupported(inqReadOut) )
  {
    bool absControl = false;
    if ( IsSupported(inqAbsControl) )
    {
      absControl = AbsControl();
      ptrBag->WriteBool( _T( "AbsControl" ), absControl);
    }
    if ( absControl )
      ptrBag->WriteFloat( _T( "AbsValue" ), (float) Abs());
    else
      ptrBag->WriteLong( _T( "RawValue" ), Raw());
  }

}

//------------------------------------------------------------------------------
// void CBcam::CScalarProperty::Restore(const CPropertyBagPtr ptrBag)
// Author: 
// Date: 04.09.2002
//------------------------------------------------------------------------------
/**
 * Restore settings from a property bag
 *
 * \param     ptrBag The property bag
 */
//------------------------------------------------------------------------------
void CBcam::CScalarProperty::Restore(const CPropertyBagPtr ptrBag)
{
  if ( IsSupported(inqOnOff) )
  {
    bool onOff = ptrBag->ReadBool( _T( "OnOff" ));
    OnOff = onOff;
    if ( ! onOff )
      return;  // feature is disabled, nothing to restore
  }

  if ( IsSupported(inqAuto) )
  {
    bool autoMode = ptrBag->ReadBool( _T( "AutoMode" ) );
    AutoMode = autoMode;
    if ( autoMode )
      return; // feature is in auto mode, noting to restore
  }

  if ( IsSupported(inqManual) && IsSupported(inqReadOut) )
  {
    bool absControl = false;
    if ( IsSupported(inqAbsControl) )

⌨️ 快捷键说明

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