Grabber States
During its lifetime, the Grabber object transitions through multiple states.
The current grabber state can be observed through a collection state properties:
Initial State
Initially, the grabber has not opened a video capture device.
Property |
Value |
---|---|
is_device_open |
False |
is_device_valid |
False |
is_streaming |
False |
is_acquisition_active |
False |
Calling Grabber.device_close() always brings the grabber back to the Initial state.
Opening a device using Grabber.device_open() or one of its sibling functions puts the grabber into the Device Opened state.
Device Opened
In this state, a device was opened, but streaming has not been started yet. Once opened, the device should be configured to prepare the required settings for streaming.
Property |
Value |
---|---|
is_device_open |
True |
is_device_valid |
True |
is_streaming |
False |
is_acquisition_active |
False |
Calling Grabber.device_close() brings the grabber back to the Initial state.
Calling Grabber.stream_setup() elevates the grabber state to Streaming. If the setup_option parameter of the call is set to StreamSetupOption.ACQUISITION_START, acquisition is started immediately and the grabber state moves to Acquisition Active.
If the connection to the device is lost (e.g. it is unplugged), the grabber moves into the Device Invalid state. Additionally, the device-lost event is raised (see Grabber.event_add_device_lost()).
Streaming
In this state, a streaming connection between the device and the host has been established. Everything is prepared for the device to send and the host to receive image data.
Property |
Value |
---|---|
is_device_open |
True |
is_device_valid |
True |
is_streaming |
True |
is_acquisition_active |
False |
To start acquisition, call Grabber.acquisition_start() or execute the AcquisitionStart command in the device’s property map. After that, the grabber is in the Acquisition Active state.
Calling Grabber.stream_stop() stops the data stream and moves the grabber back to the Device Opened state.
Calling Grabber.device_close() stops the data stream, closes the device and puts the grabber back to the Initial state.
If the connection to the device is lost (e.g. it is unplugged), the grabber moves into the Device Invalid state. Additionally, the device-lost event is raised (see Grabber.event_add_device_lost()).
Acquisition Active
In this state, the device is sending images to the host.
Property |
Value |
---|---|
is_device_open |
True |
is_device_valid |
True |
is_streaming |
True |
is_acquisition_active |
True |
Please note that the device may pause transmission because of certain device settings, e.g. PropId.TRIGGER_MODE.
To stop acquisition, call Grabber.acquisition_stop() or execute the AcquisitionStop command in the device’s property map. After that, the grabber is in the Streaming state.
Calling Grabber.stream_stop() stops acquisition in the device, stops the data stream and moves the grabber back to the Device Opened state.
Calling Grabber.device_close() stops acquisition, stops the data stream, closes the device and puts the grabber back to the Initial state.
If the connection to the device is lost (e.g. it is unplugged), the grabber moves into the Device Invalid state. Additionally, the device-lost event is raised (see Grabber.event_add_device_lost()).
Device Invalid
In this state, the connection to the device was lost.
Property |
Value |
---|---|
is_device_open |
True |
is_device_valid |
False |
Calling Grabber.device_close() puts the grabber back to the Initial state.