Use read_with_callbacks for long-running outputs and event-driven interactions
mainThe read_with_callbacks method allows you to handle device interactions, tail logs, or manage long-running outputs by triggering specific function calls based on the content received. This is particularly useful for:
- Connecting to device consoles during boot-up.
- Zero-touch-provisioning (ZTP) workflows.
- Tailing logs or other continuous streams where specific patterns should trigger actions.
Instead of a standard read that waits for a specific prompt or EOF, read_with_callbacks enables an event-driven approach to reading device output.
// Note: The actual implementation is found in the example code file,
// but the concept involves passing callback functions to the read_with_callbacks method.