ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
gige_generator.h
Go to the documentation of this file.
1//
2// Copyright (c) 2026, Astute Systems PTY LTD
3//
4// This file is part of the VivoeX project developed by Astute Systems.
5//
6// License. See the LICENSE file in the project root for full license details.
7//
12
13#ifndef STREAMS_GIGE_GENERATOR_H
14#define STREAMS_GIGE_GENERATOR_H
15
16#include <atomic>
17#include <cstdint>
18#include <memory>
19#include <string>
20#include <thread>
21
22#include "mediax/gev/gev.h"
23#include "rtp/rtp.h"
25
26namespace toolx::streams {
27
30{
32 std::string name = "ToolX-GigE";
34 std::string manufacturer = "Astute Systems";
36 std::string model = "ToolX GigE Camera";
38 std::string serial = "TX000001";
40 uint32_t width = 640;
42 uint32_t height = 480;
44 uint32_t framerate = 25;
46 ::mediax::gev::PixelFormat pixel_format = ::mediax::gev::PixelFormat::kRgb8;
48 int pattern = 0;
50 bool sap_enabled = true;
51};
52
59class GigEGenerator
60{
61public:
62 GigEGenerator();
63 GigEGenerator(const GigEGenerator &) = delete;
64 GigEGenerator &operator=(const GigEGenerator &) = delete;
65 GigEGenerator(GigEGenerator &&) = delete;
66 GigEGenerator &operator=(GigEGenerator &&) = delete;
67 ~GigEGenerator();
68
76 bool start(const GigEDeviceConfig &config, std::string &error);
77
81 void stop();
82
88 bool isRunning() const;
89
95 bool isStreaming() const;
96
102 void setPattern(int pattern);
103
109 void setSessionNameOverlay(bool enabled);
110
116 void setTimeOverlay(bool enabled);
117
123 uint64_t framesSent() const;
124
130 uint64_t bytesSent() const;
131
138 static mediax::rtp::ColourspaceType toColourspace(::mediax::gev::PixelFormat format);
139
140private:
142 void generateThread();
143
145 std::unique_ptr<::mediax::gev::Transmitter> m_device;
149 bool m_announced = false;
151 std::thread m_thread;
153 std::atomic<bool> m_running{ false };
155 std::atomic<int> m_pattern{ 0 };
159 std::atomic<uint64_t> m_frames_sent{ 0 };
161 std::atomic<uint64_t> m_bytes_sent{ 0 };
162};
163
164} // namespace toolx::streams
165
166#endif // STREAMS_GIGE_GENERATOR_H
Burns the session name (bottom centre) and the date/time (top right) into frames.
Definition frame_overlay.h:41
bool start(const GigEDeviceConfig &config, std::string &error)
Open the device and start generating frames.
Definition gige_generator.cpp:93
bool isRunning() const
Check if the generator is running.
Definition gige_generator.cpp:180
std::atomic< uint64_t > m_bytes_sent
Bytes transmitted.
Definition gige_generator.h:161
bool m_announced
The device is announced with SAP.
Definition gige_generator.h:149
std::atomic< int > m_pattern
The current test pattern.
Definition gige_generator.h:155
uint64_t bytesSent() const
Get the number of payload bytes transmitted.
Definition gige_generator.cpp:218
bool isStreaming() const
Check if a host is acquiring frames from the device.
Definition gige_generator.cpp:185
GigEDeviceConfig m_config
The active configuration.
Definition gige_generator.h:147
FrameOverlay m_overlay
Paints the name and date/time overlays into the frames.
Definition gige_generator.h:157
std::atomic< bool > m_running
Thread run flag.
Definition gige_generator.h:153
uint64_t framesSent() const
Get the number of frames transmitted.
Definition gige_generator.cpp:213
std::unique_ptr<::mediax::gev::Transmitter > m_device
The GigE Vision device.
Definition gige_generator.h:145
void stop()
Stop generating frames and close the device.
Definition gige_generator.cpp:160
static mediax::rtp::ColourspaceType toColourspace(::mediax::gev::PixelFormat format)
Map a GigE Vision pixel format to the matching RTP colourspace.
Definition gige_generator.cpp:76
void generateThread()
The frame generation thread.
Definition gige_generator.cpp:223
std::thread m_thread
The frame generation thread.
Definition gige_generator.h:151
void setTimeOverlay(bool enabled)
Burn the date and time into the video while running.
Definition gige_generator.cpp:208
void setPattern(int pattern)
Change the test pattern while running.
Definition gige_generator.cpp:190
void setSessionNameOverlay(bool enabled)
Burn the device name into the video while running.
Definition gige_generator.cpp:203
std::atomic< uint64_t > m_frames_sent
Frames transmitted.
Definition gige_generator.h:159
Paints the session name and date/time overlays into raw video frames.
The configuration of the emulated GigE Vision device.
Definition gige_generator.h:30
uint32_t width
Image width in pixels.
Definition gige_generator.h:40
uint32_t framerate
AcquisitionFrameRate in Hz.
Definition gige_generator.h:44
std::string manufacturer
DeviceVendorName.
Definition gige_generator.h:34
bool sap_enabled
Announce the device with SAP/SDP.
Definition gige_generator.h:50
::mediax::gev::PixelFormat pixel_format
GigE Vision pixel format.
Definition gige_generator.h:46
std::string model
DeviceModelName.
Definition gige_generator.h:36
std::string name
DeviceUserID (max 15 characters), also used as the SAP session name.
Definition gige_generator.h:32
std::string serial
DeviceSerialNumber (max 15 characters).
Definition gige_generator.h:38
int pattern
Test pattern index (see testPatternNames()).
Definition gige_generator.h:48
uint32_t height
Image height in pixels.
Definition gige_generator.h:42