Impact Acquire SDK C
Iterate Over A Tree Of Features

It's also possible to iterate over all the features offered by a device or a subtree of this. To see how this is done, please have a look at the description of the function OBJ_GetFirstSibling().

To access e.g. the device information related features, the DMR_FindList() function must be called in a certain way:

//-----------------------------------------------------------------------------
// 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 getInfoProp( HDRV hDrv, const char* pSettingName, const char* pPropName )
//-----------------------------------------------------------------------------
{
// Here the 'dmltInfo' makes sure that only the properties belonging
// to the device information related subtree of the drivers feature will be considered
return getDriverProperty( hDrv, pPropName, pSettingName, dmltInfo );
}
//-----------------------------------------------------------------------------
void myFun()
//-----------------------------------------------------------------------------
{
HDRV hDrv = getTheDriverHandleFromSomewhere();
HOBJ hProp = getInfoProp( hDrv, "DeviceInformation", "DeviceVersion" );
// now the property is ready to use when available:
if( hProp != INVALID_ID )
{
// do what needs to be done with the property
}
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
@ dmltInfo
Specifies the driver interfaces list containing general information.
Definition mvDeviceManager.h:605
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
TPROPHANDLING_ERROR
Error codes of the module handling everything related to properties.
Definition mvPropHandlingDatatypes.h:382
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