10#include <cvb/device_factory.hpp>
11#include <cvb/global.hpp>
12#include <cvb/driver/composite_stream.hpp>
14static const constexpr int DELIVERABLE_COUNT = 10;
15static const constexpr int ITEM_COUNT =
17static const constexpr int CVB_FLOW_SET_COUNT = 3;
26 Cvb::DiscoverFlags::IncludeMockTL
31 for (
auto n = 0; (n < infoList.size()) && accessToken.empty(); ++n)
32 if (infoList.at(n).AccessToken().find(
"MockTL") != std::string::npos)
33 accessToken = infoList.at(n).AccessToken();
35 if (accessToken.empty())
39 auto device = Cvb::DeviceFactory::Open<Cvb::GenICamDevice>(accessToken, Cvb::AcquisitionStack::GenTL);
42 auto deviceNodeMap = device->NodeMap(
"Device");
46 auto configurationNode = deviceNodeMap->Node<
Cvb::EnumerationNode>(CVB_LIT(
"GenDCFlowMappingConfiguration"));
47 configurationNode->
SetValue(CVB_LIT(
"MultipleFlow"));
48 auto imageCountNode = deviceNodeMap->Node<
Cvb::IntegerNode>(CVB_LIT(
"TestGenDCImageCount"));
49 imageCountNode->
SetValue(ITEM_COUNT);
53 auto streamingModeNode = deviceNodeMap->Node<
Cvb::EnumerationNode>(CVB_LIT(
"GenDCStreamingMode"));
54 streamingModeNode->
SetValue(CVB_LIT(
"On"));
65 for (
auto m = 0; m < DELIVERABLE_COUNT; ++m)
67 std::cout <<
"Acquisition #" << m <<
"\n";
75 auto &enumerator = std::get<Cvb::NodeMapEnumerator>(waitResultTuple);
76 const auto names = enumerator.Names();
77 const auto keyName = CVB_LIT(
"VinBuffer");
78 if (std::all_of(names.begin(), names.end(), [keyName](
const Cvb::String &name) { return name != keyName; }))
81 auto vinBufferNodeMap = enumerator.NodeMap(keyName);
82 auto frameIDNode = vinBufferNodeMap->Node<
Cvb::IntegerNode>(CVB_LIT(
"FrameID"));
83 auto timestampNode = vinBufferNodeMap->
Node<
Cvb::IntegerNode>(CVB_LIT(
"Timestamp"));
84 auto payloadTypeNode = vinBufferNodeMap->Node<
Cvb::EnumerationNode>(CVB_LIT(
"BufferPayloadType"));
87 auto deliverable = std::get<Cvb::CompositePtr>(waitResultTuple);
89 std::cout <<
"Frame ID: " << frameIDNode->Value()
90 <<
", Type: " << payloadTypeNode->
Value() <<
", Timestamp: 0x" << std::hex
91 << timestampNode->
Value() <<
", Item count: " << deliverable->ItemCount() <<
"\n";
94 for (
auto n = 0; n < deliverable->ItemCount(); ++n)
96 auto item = deliverable->ItemAt(n);
98 strStream <<
"Type: ";
99 if (Cvb::holds_alternative<Cvb::ImagePtr>(item))
101 auto image = Cvb::get<Cvb::ImagePtr>(item);
102 strStream <<
"Image, Width: " << image->Width() <<
", Height: " << image->Height();
104 else if (Cvb::holds_alternative<Cvb::PlanePtr>(item))
105 strStream <<
"Plane";
106 else if (Cvb::holds_alternative<Cvb::PlaneEnumeratorPtr>(item))
107 strStream <<
"Plane enumerator";
108 else if (Cvb::holds_alternative<Cvb::BufferPtr>(item))
109 strStream <<
"Buffer";
110 else if (Cvb::holds_alternative<Cvb::PFNCBufferPtr>(item))
111 strStream <<
"PFNC buffer";
113 strStream <<
"Unknown";
114 std::cout <<
"Item index: " << n <<
", " << strStream.str() <<
"\n";
static std::vector< DiscoveryInformation > Discover()
Discovers available devices (not vins) with a default time span of 300ms.
Definition: decl_device_factory.hpp:221
void RegisterManagedFlowSetPool(int flowSetCount)
Registers an internal flows set pool.
Definition: decl_composite_stream_base.hpp:291
Streams composites.
Definition: composite_stream.hpp:21
A node that presents a choice of values.
Definition: enumeration_node.hpp:18
void SetValue(const String &value)
Sets the symbolic value of this enumeration.
Definition: enumeration_node.hpp:51
Represents a integer number.
Definition: integer_node.hpp:20
void SetValue(std::int64_t value)
Sets the value of this integer node.
Definition: integer_node.hpp:46
std::int64_t Value() const
Gets the value of this integer node.
Definition: integer_node.hpp:33
@ Timeout
A timeout occurred, no image buffer has been returned.