Impact Acquire SDK Java
Bind Features Of An Unknown Type

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

mvIMPACT.acquire.Device pDev = getTheDevicePointerFromSomewhere();
mvIMPACT.acquire.DeviceComponentLocator locator = new mvIMPACT.acquire.DeviceComponentLocator( pDev, TDeviceListType.dltSetting, "Base" );
mvIMPACT.acquire.Component feature = new mvIMPACT.acquire.Component();
locator.bindComponent( feature, "Feature" );
// now the feature is ready to use when available:
if( feature.isValid() )
{
System.out.println( String.format( "Feature %s is a %s", feature.name(), feature.typeAsString() );
final int featureType = feature.type();
if( featureType == TComponentType.ctPropString )
{
mvIMPACT.acquire.PropertyS stringProp = new mvIMPACT.acquire.PropertyS( feature.hObj() );
doStringPropAction( stringProp );
}
else if( featureType == TComponentType.ctPropInt )
{
mvIMPACT.acquire.PropertyI intProp = new mvIMPACT.acquire.PropertyI( feature.hObj() );
doIntPropAction( intProp );
}
else if( featureType == TComponentType.ctPropInt64 )
{
mvIMPACT.acquire.PropertyI64 longProp = new mvIMPACT.acquire.PropertyI64( feature.hObj() );
doLongPropAction( longProp );
}
else if( featureType == TComponentType.ctPropFloat )
{
mvIMPACT.acquire.PropertyF floatProp = new mvIMPACT.acquire.PropertyF( feature.hObj() );
doFloatPropAction( floatProp );
}
else
{
// don't handle this feature. This might be a method or a list or a property
// of a type not dealt with in the 'if-else' statements from above
}
}
else
{
// oops... The feature is not offered by this device
}