Impact Acquire SDK C
Bind Features Of An Unknown Type

If the type is unclear for a particular feature some more complex code is needed:

//-----------------------------------------------------------------------------
// This function will try to obtain the handle to a certain driver feature list
HOBJ getDriverList( HDRV hDrv, const char* pName, const char* pAddListName, TDMR_ListType type )
//-----------------------------------------------------------------------------
{
TDMR_ERROR dmrResult;
HOBJ hObj = INVALID_ID;
HLIST baseList;
// try to locate the base list for these property
if( ( dmrResult = DMR_FindList( hDrv, pAddListName, type, 0, &baseList ) ) == DMR_NO_ERROR )
{
// try to locate the property
if( ( objResult = OBJ_GetHandleEx( baseList, pName, &hObj, smIgnoreProperties | smIgnoreMethods, 0 ) ) != PROPHANDLING_NO_ERROR )
{
printf( "OBJ_GetHandle for %s failed: %d Handle: %d. This list might not be supported by this device\n", pName, objResult, hObj );
}
}
else
{
printf( "DMR_FindList failed: %d. Lists of type %d are not available for this device\n", dmrResult, type );
}
return hObj;
}
//-----------------------------------------------------------------------------
HOBJ getSettingProp( HDRV hDrv, const char* pSettingName, const char* pPropName )
//-----------------------------------------------------------------------------
{
return getDriverProperty( hDrv, pPropName, pSettingName, dmltSetting );
}
//-----------------------------------------------------------------------------
void myFun()
//-----------------------------------------------------------------------------
{
HDRV hDrv = getTheDriverHandleFromSomewhere();
HOBJ hObj = getSettingProp( hDrv, "Base", "Width" );
// now the property is ready to use when available:
if( hObj != INVALID_ID )
{
OBJ_GetType( hObj, &type );
switch( type )
{
doStringPropAction( hObj );
break;
case ctPropInt:
doIntPropAction( hObj );
break;
doLongPropAction( hObj );
break;
doFloatPropAction( hObj );
break;
default:
// don't handle this feature. This might be a method or a list or a property
// of a type not dealt with in the 'case' statements from above
break;
}
}
else
{
// oops... The feature is not offered by this device
}
}
TDMR_ERROR
Errors reported by the device manager.
Definition mvDriverBaseEnums.h:2601
TDMR_ListType
Defines valid interface list types, which can be located using the function DMR_FindList().
Definition mvDeviceManager.h:585
@ DMR_NO_ERROR
The function call was executed successfully.
Definition mvDriverBaseEnums.h:2603
@ dmltSetting
Specifies a certain setting.
Definition mvDeviceManager.h:592
MVDMR_API TDMR_ERROR DMR_CALL DMR_FindList(HDRV hDrv, const char *pName, TDMR_ListType type, unsigned int flags, HLIST *phDevList)
Locates a specified list within the device drivers interface.
Definition mvDeviceManager.cpp:2295
const int INVALID_ID
A constant to check for an invalid ID returned from the property handling module.
Definition mvPropHandlingDatatypes.h:62
MVDMR_API TPROPHANDLING_ERROR DMR_CALL OBJ_GetHandleEx(HLIST hList, const char *pObjName, HOBJ *phObj, unsigned int searchMode, int maxSearchDepth)
Retrieves an objects handle.
Definition ObjectHandling.cpp:343
MVDMR_API TPROPHANDLING_ERROR DMR_CALL OBJ_GetType(HOBJ hObj, TComponentType *pType)
Receives the type of the referenced object.
Definition ObjectHandling.cpp:1572
TPROPHANDLING_ERROR
Error codes of the module handling everything related to properties.
Definition mvPropHandlingDatatypes.h:382
TComponentType
Allowed components handled by this module.
Definition mvPropHandlingDatatypes.h:327
const unsigned int smIgnoreProperties
When set property objects are not taken into account during a search.
Definition mvPropHandlingDatatypes.h:105
const unsigned int smIgnoreMethods
When set method objects are not taken into account during a search.
Definition mvPropHandlingDatatypes.h:99
@ PROPHANDLING_NO_ERROR
The operation has been executed successfully.
Definition mvPropHandlingDatatypes.h:384
@ ctPropString
Defines a property for string values.
Definition mvPropHandlingDatatypes.h:352
@ ctPropInt64
Defines a property for 64 bit integer values.
Definition mvPropHandlingDatatypes.h:356
@ ctPropFloat
Defines a property for floating point values.
Definition mvPropHandlingDatatypes.h:350
@ ctProp
A property type.
Definition mvPropHandlingDatatypes.h:334
@ ctPropInt
Defines a property for 32 bit integer values.
Definition mvPropHandlingDatatypes.h:348