Impact Acquire SDK C
Locating And Using Methods

Method objects (ICommand nodes in GenICam) can be bound in exactly the same way however special care must be taken as their names contain information about the argument list of the method. Tools like ImpactControlCenter present method names not in the way they are used in an applications code, but in a more human readable way, thus reading this section is important when working with method objects in Impact Acquire:

//-----------------------------------------------------------------------------
// 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();
// find the feature and bind it to the method object. Here it is crucial to notice that the exact name
// of a method object in mvIMPACT_Acquire is constructed from the actual feature name, the return type
// of the method and the arguments expected by the method (optional). More information about this topic
// can be found in the documentation under the functions 'OBJ_Execute', 'OBJ_GetSParamList' or 'OBJ_GetSWithInplaceConstruction' with 'sqMethParamString'.
HOBJ hMeth = getSettingProp( hDrv, "Base", "TriggerSoftware@i" );
// '@i' indicates, that calling this function will return an integer
// (the result of the function call, which is either 0 or a negative value in case of an error)
// and takes no parameters
int functionResult = 0;
// now the method is ready to use when available:
if( hMeth != INVALID_ID )
{
OBJ_Execute( hMeth, 0, 0, &functionResult );
}
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
TPROPHANDLING_ERROR
Error codes of the module handling everything related to properties.
Definition mvPropHandlingDatatypes.h:382
MVDMR_API TPROPHANDLING_ERROR DMR_CALL OBJ_Execute(HOBJ hMeth, const char *pCallParams, const char *pDelimiters, int *pResult)
Executes the function bound to this method object.
Definition ObjectHandling.cpp:3283
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