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 specific situation and requirements.
Finding objects by path name#
If a device structure is known but the concrete object numbers are not fixed, the path_observer class can be used.
Situations where object numbers are not fixed may include:
- Devices that are created dynamically and change over time (e.g., objects are added and removed).
- Devices that exist in different software versions (e.g., an object may only be present in newer versions of 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
an object is removed or reappears.
member_observer#
The member_observer
class watches the Members property of a block and calls a callback based on an object
type.
iterate_block#
The iterate_block can be used to iterate over all objects in a block.
iterate_block_recursively#
The iterate_block_recursively can be used to iterate over all objects in a block recursively.