Impact Acquire SDK Python
|
A simple helper class to wrap the creation of a callback object. More...
Public Member Functions | |
__disown__ (self) | |
__init__ (self, *args) | |
Creates a new mvIMPACT.acquire.ComponentCallback instance. | |
execute (self, c, pUserData) | |
The callback function. | |
isComponentRegistered (self, c) | |
Checks if a component is currently registered for this callback or not. | |
registerComponent (self, c) | |
Registers a component for this callback. | |
unregisterComponent (self, c) | |
Unregisters a component for this callback. | |
Properties | |
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") | |
A simple helper class to wrap the creation of a callback object.
Applications need to derive from this class and must re-implement the function mvIMPACT.acquire.ComponentCallback.execute.
By deriving from this class it will become possible to receive a notification whenever an object derived from mvIMPACT.acquire.Component has changed. So e.g. an application could register a callback on the mvIMPACT.acquire.Device.state property to get notified when e.g. a certain device has been unplugged or restarted.
change
is not necessarily a changed value of a property but also any other change in behaviour like a change in visibility or availability. So when a callback has been registered for a certain read-only component that becomes writable for some reason the registered callback would be executed as well.A single instance of an object derived from this class can hold an arbitrary number of components which are monitored. components can be registered by calling the mvIMPACT.acquire.ComponentCallback.registerComponent function, so it is not necessary to create and hold a callback instance for every feature that shall be monitored. Since when the callback is executed the information about the object that has triggered it will be supplied as one the input parameters it is easy to decide what has to be done.
__init__ | ( | self, | |
* | args ) |
Creates a new mvIMPACT.acquire.ComponentCallback instance.
OVERLOAD 1:
pUserData | [in] A pointer to user specific data bound to this callback. This data will be passed back to the user whenever the callback function gets executed and can be used to attach custom data to the callback function. |
OVERLOAD 2: Copy constructor.
Creates a new object from an existing device object. Keep in mind that this new object will provide access to the very same objects. This constructor is only provided for internal reference counting to guarantee correct operation of the objects of this class under all platforms and languages.
__disown__ | ( | self | ) |
execute | ( | self, | |
c, | |||
pUserData ) |
The callback function.
Re-implement this function in a derived class in order to implement a custom behaviour.
As each device driver instance internally creates multiple threads and since components can be modified by the driver framework from any of these threads, the thread context might in fact be different each time this function gets called. Accessing data from objects that are inherited from mvIMPACT.acquire.Component is thread safe so e.g. property values can be read out in parallel securely! However this 'execute' in a worst case (when several components have been registered to a single callback) might in fact be called in parallel so everything that happens in here should be designed accordingly!
GenICam event specific: When dealing with GenICam device events from a single device only within this callback due to the internal design it is guaranteed that this callback will NOT be executed in parallel since the device events will be received sequentially and will always be reported by the same (device driver instance related) thread! So when e.g. registering for changes to the following properties:
c | [in] The component that did cause the callback to be executed |
pUserData | [in] A pointer to user specific data that was bound to this callback instance upon construction |
isComponentRegistered | ( | self, | |
c ) |
Checks if a component is currently registered for this callback or not.
c | [in] The component that shall be tested against this callback |
registerComponent | ( | self, | |
c ) |
Registers a component for this callback.
c | [in] The component to register for this callback |
unregisterComponent | ( | self, | |
c ) |
Unregisters a component for this callback.
c | [in] The component to unregister from this callback |
|
static |