5#include "../../global.hpp"
7#include "../vin_image.hpp"
8#include "../stream_image.hpp"
10#include "../_decl/decl_stream.hpp"
11#include "../_decl/decl_buffer_image.hpp"
12#include "../_decl/decl_ring_buffer.hpp"
13#include "../_decl/decl_vin_device.hpp"
25 bool hasBsOrCs =
false;
27 CExports::cvbval_t currentBoard = 0;
28 if (CExports::CanBoardSelect2(
Handle()))
30 auto result = CExports::BS2GetBoard(
Handle(), currentBoard);
35 else if (CExports::CanBoardSelect(
Handle()))
37 auto result = CExports::GetBoard(
Handle(), ¤tBoard);
43 CExports::cvbval_t currentPort = 0;
44 if (CExports::CanCameraSelect2(
Handle()))
46 auto result = CExports::CS2GetCamPort(
Handle(), currentPort);
51 else if (CExports::CanCameraSelect(
Handle()))
53 auto result = CExports::GetCamPort(
Handle(), currentPort);
67 inline void VinDevice::ChangeHandle(HandleGuard<Device> &&guard,
DeviceUpdateMode mode)
69 Device::ChangeHandle(
std::move(guard), mode);
77 inline StreamBasePtr VinDevice::CreateStream(
int, StreamType streamType)
const
79 if (streamType != StreamType::Legacy)
82 if (!CExports::CanRingBuffer(
Handle()))
88 inline VinDevice::NonRingBufferVinStream::NonRingBufferVinStream(
const DevicePtr &device)
90 , layout_(Driver::BufferImage::ImageLayout::FromIMGHandle(device->Handle()))
94 inline StreamImagePtr VinDevice::NonRingBufferVinStream::MakeSnapshotImage()
97 if (CExports::G2GetGrabStatus(
Parent()->
Handle(), CExports::GRAB_INFO_TIMESTAMP, rawTimestamp) >= 0)
98 return Driver::BufferImage::Create(
Parent(), *layout_, rawTimestamp);
103 inline VinDevice::RingBufferVinStream::RingBufferVinStream(
const DevicePtr &device)
105 , ringBuffer_(std::
make_shared<class RingBuffer>(device))
109 inline StreamImagePtr VinDevice::RingBufferVinStream::MakeStreamImage()
111 CExports::cvbval_t bufferIndex = 0;
112 auto result = CExports::RBBufferSeq(
Parent()->
Handle(), 0, bufferIndex);
115 std::rethrow_exception(CvbException::FromCvbResult(result,
"failed to get ring buffer sequence"));
117 auto image = RingBuffer()->At(bufferIndex);
118 image->RaisePixelContentChanged();
122 inline StreamImagePtr VinDevice::RingBufferVinStream::MakeSnapshotImage()
126 CExports::G2GetGrabStatus(Parent()->
Handle(), CExports::GRAB_INFO_TIMESTAMP, rawTimestamp);
127 return BufferImage::Create(Parent(), rawTimestamp);
130 inline RingBufferPtr VinDevice::RingBufferVinStream::RingBuffer() const noexcept
String ResourceLocator() const noexcept
Gets the access token or path of the file name including its extension.
Definition decl_device.hpp:132
void * Handle() const noexcept
Classic API device handle.
Definition decl_device.hpp:122
DevicePtr Parent() const noexcept
Gets the parent device of this stream.
Definition stream_base.hpp:42
Cvb::Driver::VinConnectionInformation VinConnectionInformation() const
Gets the board and port information of this device.
Definition detail_vin_device.hpp:23
Namespace for driver or device related operations.
Definition decl_composite.hpp:28
std::shared_ptr< StreamImage > StreamImagePtr
Convenience shared pointer for StreamImage.
Definition driver.hpp:93
std::shared_ptr< DeviceImage > DeviceImagePtr
Convenience shared pointer for DeviceImage.
Definition driver.hpp:61
std::shared_ptr< StreamBase > StreamBasePtr
Convenience shared pointer for StreamBase.
Definition driver.hpp:113
std::shared_ptr< RingBuffer > RingBufferPtr
Convenience shared pointer for RingBuffer.
Definition driver.hpp:41
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
std::shared_ptr< Device > DevicePtr
Convenience shared pointer for Device.
Definition global.hpp:98
DeviceUpdateMode
Defines how to treat the optional device image, when the device itself is updated.
Definition global.hpp:252
T const_pointer_cast(T... args)
T rethrow_exception(T... args)