Balluff - BVS CA-GX0 / BVS CA-GX2 Technical Documentation
|
There are scenarios where a second application should take control over a device that is already under control of another (primary) application (e.g. systems which requires redundancy, fault recovery or systems with a higher level management entity).
The switchover procedure will look like this: The primary application
Another application that knows the key, can request (and gets granted) device control.
You can enable the switchover via "Device → PrimaryApplicationSwitchoverEnable". Set this register to "On" to allow other applications to take control over the device.
If the control access has been granted, "DesiredAccess", "PrimaryApplicationSwitchoverEnable" and "PrimaryApplicationSwitchoverKey" will become read-only.
Now, in "Setting → Base → Camera → GenICam → Transport Layer Control" the property "Gev Primary Application Switchover Key" can be used by the control application to define a value that must be specified by an application that wants to take over control over the device. E.g. "666":
The other application now tries to take over control with the correct switchover key and this access is granted. As a result the first application can no longer write to the device (executing "int timestampLatch()" fails with "DEV_ACCESS_DENIED").
The following code samples show, how to create functions which
//----------------------------------------------------------------------------- template<typename _Ty, typename _Tx> void bindAndSetProperty( _Ty& prop, ComponentLocatorBase& locator, const string& propName, const _Tx& value ) //----------------------------------------------------------------------------- { locator.bindComponent( prop, propName ); if( prop.isValid() ) { try { prop.write( value ); cout << "Property '" << propName << "' set to '" << prop.readS() << "'." << endl; // read back the value from the property in order to notice any rounding(e.g. for // properties defining a setp width) } catch( const ImpactAcquireException& e ) { cout << "Failed to write '" << value << "' to property '" << propName << "'. Error message: " << e.getErrorString() << endl; displayPropertyData( prop ); } } else { cout << "Property '" << propName << "' is not supported by this device or could not be located." << endl; } } //----------------------------------------------------------------------------- void configureControlAccessWithSwitchoverEnabled( Device* pDev, int64_type key ) //----------------------------------------------------------------------------- { try { ComponentLocator locator(pDev->hDev()); PropertyIBoolean primaryApplicationSwitchoverEnable; bindAndSetProperty( primaryApplicationSwitchoverEnable, locator, "PrimaryApplicationSwitchoverEnable", bTrue ); pDev->interfaceLayout.write( dilGenICam ); pDev->desiredAccess.write( damControl ); pDev->open(); DeviceComponentLocator devLocator(pDev, dltSetting); PropertyI64 gevPrimaryApplicationSwitchoverKey; bindAndSetProperty( gevPrimaryApplicationSwitchoverKey, locator, "GevPrimaryApplicationSwitchoverKey", key ); } catch( const ImpactAcquireException& e ) { cout << string(__FUNCTION__) << ": " << e.getErrorString() << "(" << e.getErrorCodeAsString() << ") occurred at line " << e.getErrorOrigin() << endl; } } //----------------------------------------------------------------------------- void takeOverControlAccess( Device* pDev, int64_type key, bool boKeepSwitchoverPossible ) //----------------------------------------------------------------------------- { try { ComponentLocator locator(pDev->hDev()); PropertyIBoolean primaryApplicationSwitchoverEnable; bindAndSetProperty( primaryApplicationSwitchoverEnable, locator, "PrimaryApplicationSwitchoverEnable", boKeepSwitchoverPossible ? bTrue : bFalse ); PropertyI64 primaryApplicationSwitchoverKey; bindAndSetProperty( primaryApplicationSwitchoverKey, locator, "PrimaryApplicationSwitchoverKey", key ); pDev->interfaceLayout.write( dilGenICam ); pDev->desiredAccess.write( damControl ); pDev->open(); } catch( const ImpactAcquireException& e ) { cout << string(__FUNCTION__) << ": " << e.getErrorString() << "(" << e.getErrorCodeAsString() << ") occurred at line " << e.getErrorOrigin() << endl; } }