Discovering objects#
When devices are dynamic or when controlling devices with unknown structure, the object numbers of objects are not known.
The controller library provides different features for handling these situations.
It is difficult to give concrete advice because the best implementation strategy depends on the concrete situation and requirements.
Finding objects by path name#
If a device structure is know but the concrete object numbers are not fixed, the path_observer class can be used.
Situations where object numbers are not fixed may include:
- device which are created dynamically and change over time (e.g. objects are added and removed)
- devices which exists in different software versions (e.g. an object may only be present in newer versions of a firmware).
path_observer
#
The path_observer
class recursively fetches objects in a device and their role names. It will also
react to changes of the Members
property of blocks to handle situations where
and object is removed or re-appears.
member_observer
#
The member_observer
class watches the Members
property of a block and calls a callback based on and object
type.
iterate_block
#
The iterate_block can be used to iterate over all objects in a block.
iterate_block_recursively
#
The iterate_block_recurvively can be used to iterate over all objects in a block recursively.