74
delete [] prop_array[pr].stringArray;\
}
//------------------------------------------------------------------------------
// scanning the property list props for a property with name property_name
MVProperty
*
GetProperty( MVProperty
*
props, unsigned int property_count, char
*
property_name )
//------------------------------------------------------------------------------
{
for( unsigned int pr = 0; pr < property_count && props != 0; pr++ )
{
// please feel free to replace standard c string handling to Standard C++ Library strings
if( strcmp( props[pr].propertyName, property_name ) == 0 )
{
return &props[pr];
}
}
return 0;
}
//------------------------------------------------------------------------------
// asking the ds-interface for the property list
unsigned long ScanAllProperties( IAMStreamConfig
*
pvsc, MVProperty
*
props, unsigned int property_count )
//------------------------------------------------------------------------------
{
IKsPropertySet
*
ksProp;
unsigned long propCnt = 0;
// try to get the ikspropertyset pointer
HRESULT hr = pvsc->QueryInterface( IID_IKsPropertySet, ( void
**
)&ksProp );
if( SUCCEEDED( hr ) )
{
DWORD cbReturned;
ZeroMemory( props, property_count
*
sizeof( MVProperty ) );
// asking for the MATRIX VISION property interface. If one could be found then fill the propertylist
props
hr = ksProp->Get( DIRECT_SHOW_ACQUIRE_PROPERTYSET, MVPropIDReadProperties, NULL, 0,
props, property_count
*
sizeof( MVProperty ), &cbReturned );
//if successful returned then our list shows something like this
//props[0x0] {propertyName="IOSubSystem/DigitalInputThreshold" value={s= "2V" }...
//props[0x1] {propertyName="IOSubSystem/DigitalInputs" value={s= "Off" }...
//props[0x2] {propertyName="IOSubSystem/DigitalOutputs" value={s= "Off" }...
//props[0x3] {propertyName="IOSubSystem/HardwareRealTimeController/HRTCtrl_0/Filename" value={s=
"default.rtp" }...
//props[0x4] {propertyName="IOSubSystem/HardwareRealTimeController/HRTCtrl_0/Mode" value={s=
"Stop" } ...
//props[0x5] {propertyName="IOSubSystem/HardwareRealTimeController/HRTCtrl_0/ProgramSize"
value={i=0x5 }...
//...
//props[0x40] {propertyName="ImagingSubsystem/Setting/Base/Camera/AutoExposeControl" value={s=
"Off" } ...
//props[0x41] {propertyName="ImagingSubsystem/Setting/Base/Camera/AutoGainControl" value={s= "Off"
} ...
//props[0x42] {propertyName="ImagingSubsystem/Setting/Base/Camera/BinningMode" value={s= "Off" }
...
//props[0x43] {propertyName="ImagingSubsystem/Setting/Base/Camera/ExposeMode" value={s= "Standard"
} ...
//props[0x44] {propertyName="ImagingSubsystem/Setting/Base/Camera/Expose_us" value={i=0xea60 } ...
//props[0x45] {propertyName="ImagingSubsystem/Setting/Base/Camera/FlashMode" value={s= "Off" } ...
//props[0x46] {propertyName="ImagingSubsystem/Setting/Base/Camera/FrameDelay_us" value={i=0x0 }
...
//props[0x47] {propertyName="ImagingSubsystem/Setting/Base/Camera/Gain_dB" value={ f=0.0 } ...
propCnt = cbReturned / sizeof( MVProperty );
for( DWORD pr = 0; pr < propCnt; pr++ )
{
//asking for the actual values of all properties
hr = ksProp->Get( DIRECT_SHOW_ACQUIRE_PROPERTYSET, MVPropIDRead, NULL, 0, &props[pr], sizeof(
props[pr] ), &cbReturned );
//if stringArraySize is greater than 0 this property is from type stringarray.
if( props[pr].stringArraySize > 0 )
{
//allocate some buffer for the stringArray
props[pr].stringArray = new const char
*
[props[pr].stringArraySize];
//fill the allocate stringArray with references to the pointers from the internal
properties,
//do not change or free these pointers
hr = ksProp->Get( DIRECT_SHOW_ACQUIRE_PROPERTYSET, MVPropIDReadStringArray, NULL, 0,
&props[pr], sizeof( props[pr] ), &cbReturned );
}
}
ksProp->Release();
}
return propCnt;
}
//------------------------------------------------------------------------------
unsigned long functionXY( ..., bool bBayerOFF, double gain )
//------------------------------------------------------------------------------
{
// ...
IKsPropertySet
*
ks_prop;
hr = gcap.pVSC->QueryInterface( IID_IKsPropertySet, ( void
**
)&ks_prop );
MATRIX VISION GmbH