Grabber States
During its lifetime, the ic4::Grabber object transitions through multiple states.
The current grabber state can be observed through a collection state query functions:
- ic4::Grabber::isDeviceOpen
- ic4::Grabber::isDeviceValid
- ic4::Grabber::isStreaming
- ic4::Grabber::isAcquisitionActive
Initial State
Initially, the grabber has not opened a video capture device.
Property | Value |
---|---|
isDeviceOpen | false |
isDeviceValid | false |
isStreaming | false |
isAcquisitionActive | false |
Calling ic4::Grabber::deviceClose always brings the grabber back to the Initial state.
Opening a device using ic4::Grabber::deviceOpen 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 |
---|---|
isDeviceOpen | true |
isDeviceValid | true |
isStreaming | false |
isAcquisitionActive | false |
Calling ic4::Grabber::deviceClose brings the grabber back to the Initial state.
Calling ic4::Grabber::streamSetup elevates the grabber state to Streaming. If the setupOption parameter of the call is set to ic4::StreamSetupOption::AcquisitionStart, 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 (see ic4::Grabber::eventAddDeviceLost) is raised.
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 |
---|---|
isDeviceOpen | true |
isDeviceValid | true |
isStreaming | true |
isAcquisitionActive | false |
To start acquisition, call ic4::Grabber::acquisitionStart or execute the ic4::PropId::AcquisitionStart command in the device's property map. After that, the grabber is in the Acquisition Active state.
Calling ic4::Grabber::streamStop stops the data stream and moves the grabber back to the Device Opened state.
Calling ic4::Grabber::deviceClose 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 (see ic4::Grabber::eventAddDeviceLost) is raised.
Acquisition Active
In this state, the device is sending images to the host.
Property | Value |
---|---|
isDeviceOpen | true |
isDeviceValid | true |
isStreaming | true |
isAcquisitionActive | true |
Please note that the device may pause transmission because of certain device settings, e.g. ic4::PropId::TriggerMode.
To stop acquisition, call ic4::Grabber::acquisitionStop or execute the ic4::PropId::AcquisitionStop command in the device's property map. After that, the grabber is in the Streaming state.
Calling ic4::Grabber::streamStop stops acquisition in the device, stops the data stream and moves the grabber back to the Device Opened state.
Calling ic4::Grabber::deviceClose 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 (see ic4::Grabber::eventAddDeviceLost) is raised.
Device Invalid
In this state, the connection to the device was lost. ic4::Grabber::isDeviceValid returns false.
Property | Value |
---|---|
isDeviceOpen | true |
isDeviceValid | false |
Calling DeviceClose puts the grabber back to the Initial state.