Adapter Implementations
CamCom ships with three adapter implementations. Each is a shared library
loaded at runtime via dlopen.
GenICam Adapter
The GenICam adapter (genicam/adapter/, libcamcom_genicam_arv.so)
provides communication with real GenICam/GigE Vision cameras using the
Aravis library.
Note
This adapter is only built when the Aravis library is found on the system.
Overview
The adapter implements AdapterBase as a thin wrapper around the Aravis C
API. It:
Connects to cameras by IP address, serial number, or
arv://URI.Discovers all GenICam parameters by parsing the camera’s XML description.
Reads and writes parameters using their GenICam SFNC names (e.g.,
ExposureTime,AcquisitionFrameRate,PixelFormat).Receives frames via GigE Vision streaming.
Reports the camera’s native GenICam XML via
GetNativeParameterDocument().
Protocol identifier: "genicam"
GenICam Core Library
The GenICam core library (genicam/lib/, libcamcom_genicam.so) provides
shared infrastructure used by both the adapter and the emulator.
Node Types
The node model mirrors the GenICam SFNC node types:
Node Type |
C++ Type |
Description |
|---|---|---|
Integer |
|
64-bit integer with min, max, increment, and unit. |
Float |
|
Double-precision float with min, max, and unit. |
Boolean |
|
True/false value. |
String |
|
Text value with maximum length. |
Enumeration |
|
Named choice from a list of allowed entries. |
Command |
|
Trigger-style node (execute, then poll |
Category |
|
Grouping node listing child features. |
Each node has common metadata:
Field |
Type |
Description |
|---|---|---|
|
|
SFNC name (e.g., |
|
|
Human-readable label (e.g., |
|
|
Description text. |
|
|
Parent category path. |
|
|
|
All nodes are stored in a NodeMap (std::map<std::string, GenICamNode>),
where GenICamNode is a std::variant of all node types.
XML Parser
The XmlParser class provides bidirectional GenICam XML parsing:
Method |
Description |
|---|---|
|
Parse GenICam XML from a string into a |
|
Parse GenICam XML from a file. |
|
Serialize a |
Type Mapping
The type_mapping module converts between GenICam nodes and CamCom
Parameter objects:
Function |
Description |
|---|---|
|
Convert a |
|
Apply a |
|
Convert a GenICam pixel format string (e.g., |
|
Get bytes per pixel for a GenICam format string. |
RAII Wrappers
The adapter uses RAII wrappers for safe management of Aravis C resources:
GErrorGuard— RAII forGError*. Auto-frees on destruction.GObjectGuard<T>— Template RAII for GObject-derived types. Callsg_object_unrefon destruction.Type aliases:
DeviceGuard,StreamGuard,BufferGuard,InetAddrGuard.
Configuration Example
includes:
- "config/camcom/common.yaml"
camcom:
camera_name: 'Mako_G-158B'
uri: 'tccd004.hq.eso.org' # Host name, IP address, or GenICam device id
timeout: 10
adapter:
library: 'libcamcom_genicam_arv.so'
factory_symbol: 'CreateAdapter'
set_values:
AcquisitionMode: 'Continuous' # GenICam SFNC names
ExposureTime: 100000 # Microseconds
AcquisitionFrameRate: 10 # Hz
Width: 1456
Height: 1088
Gain: 20.0
gui:
primary_parameters:
- AcquisitionMode
- ExposureTime
- AcquisitionFrameRate
- Width
- Height
- Gain
GenICam Emulator Adapter
The emulator adapter (genicam/emulator/, libcamcom_genicam_emu.so) is
an in-process fake GenICam camera. It implements AdapterBase and is loaded
via dlopen like any other adapter — no external process, no network, no
Aravis dependency.
Protocol identifier: "genicam-emulator"
How It Works
On
Connect(), the emulator loads a GenICam XML profile that defines which parameters the camera exposes (names, types, constraints).It maintains a
NodeMapin memory, exactly like a real GenICam camera.Read()andWrite()operate on this node map using GenICam SFNC names.Scan()returns all nodes as CamComParameterobjects with metadata.During acquisition, it generates synthetic frames using
FrameGeneratorat the frame rate specified in the node tree.
The XML profile is loaded from:
The
uri(address) field, if it points to a file.The
adapter.profileconfig field.Standard resource locations (
$INTROOT/resource,$PREFIX/resource).
Configuration Example
includes:
- "config/camcom/common.yaml"
camcom:
camera_name: 'GenICam_Emulator'
uri: 'emulator'
timeout: 10
adapter:
library: 'libcamcom_genicam_emu.so'
factory_symbol: 'CreateAdapter'
profile: 'config/camcom/genicam/sfnc/default_camera.xml'
Simulation Adapter
The simulation adapter (simadapter/, libcamcom_sim.so) generates
synthetic camera frames for testing and development without any camera hardware.
Protocol identifier: "Simulation"
Simulated Parameters
The adapter exposes the following parameters via Scan():
Acquisition Parameters
Parameter |
Type |
Description |
|---|---|---|
|
STRING |
|
|
INT32 |
Number of frames in Finite mode. |
|
DOUBLE |
Exposure time in seconds. |
|
DOUBLE |
Frame rate in Hz. |
Geometry Parameters
Parameter |
Type |
Description |
|---|---|---|
|
INT32 |
Image width in pixels. |
|
INT32 |
Image height in pixels. |
|
INT32 |
ROI X offset. |
|
INT32 |
ROI Y offset. |
|
INT32 |
Horizontal binning factor. |
|
INT32 |
Vertical binning factor. |
Image Parameters
Parameter |
Type |
Description |
|---|---|---|
|
FLOAT |
Gain multiplier. |
|
STRING |
Pixel data type: |
|
STRING |
Pattern type (see below). |
|
STRING |
Path to FITS file to use as pattern (when |
Pattern Types
The simulation adapter supports multiple synthetic image patterns:
Pattern |
Description |
|---|---|
|
Single moving Gaussian spot (star). |
|
Multiple Gaussian spots with random movement. |
|
Uniform intensity field. |
|
Regular grid of spots. |
|
Linear intensity gradient (horizontal, vertical, or radial). |
|
Defocused star pattern (Airy disk / ring). |
|
Alternating black and white squares. |
|
Pure noise (Gaussian or Poisson distribution). |
|
Dispersed spectrum pattern. |
|
Load image data from a FITS file. |
Examples of simulation adapter pattern types.
Pattern-Specific Parameters
Each pattern exposes additional control parameters:
Gaussian / MultiGaussian:
Parameter |
Type |
Description |
|---|---|---|
|
INT32 |
Number of stars. |
|
FLOAT |
Peak intensity. |
|
FLOAT |
Gaussian width in pixels. |
|
INT32 |
Number of star planes. |
|
INT32 |
Maximum position offset between planes. |
|
INT32 |
Maximum position change per frame. |
Flat:
Parameter |
Type |
Description |
|---|---|---|
|
FLOAT |
Uniform intensity level. |
Grid:
Parameter |
Type |
Description |
|---|---|---|
|
INT32 |
Spacing between spots in pixels. |
|
FLOAT |
Spot radius in pixels. |
Gradient:
Parameter |
Type |
Description |
|---|---|---|
|
STRING |
|
|
FLOAT |
Start intensity. |
|
FLOAT |
End intensity. |
Ring:
Parameter |
Type |
Description |
|---|---|---|
|
FLOAT |
Inner radius in pixels. |
|
FLOAT |
Outer radius in pixels. |
Checkerboard:
Parameter |
Type |
Description |
|---|---|---|
|
INT32 |
Square size in pixels. |
Noise:
Parameter |
Type |
Description |
|---|---|---|
|
STRING |
|
|
FLOAT |
Mean intensity. |
|
FLOAT |
Standard deviation. |
Grating:
Parameter |
Type |
Description |
|---|---|---|
|
FLOAT |
Wavelength range. |
|
FLOAT |
Minimum wavelength (nm). |
|
FLOAT |
Maximum wavelength (nm). |
|
INT32 |
Diffraction order. |
Configuration Example
includes:
- "config/camcom/common.yaml"
camcom:
camera_name: 'SimCamera'
uri: 'sim://localhost'
timeout: 10
adapter:
library: 'libcamcom_sim.so'
factory_symbol: 'CreateAdapter'
set_values:
acquisition_mode: 'Continuous'
exposure_time: 0.5 # Seconds
frame_rate: 2.0 # Hz
width: 512
height: 512
sim_type: 'MultiGaussian'
sim_data_type: 'UInt16'
sim_nb_stars: 10
sim_amplitude: 10000.0
sim_sigma: 5.0
gui:
primary_parameters:
- acquisition_mode
- nb_of_exposures
- exposure_time
- frame_rate
- width
- height
Implementing a New Adapter
To implement a new camera adapter:
Create a directory for your adapter (e.g.,
myadapter/).Implement
camcom::common::AdapterBase:#include <camcom/common/adapterBase.hpp> class MyAdapter : public camcom::common::AdapterBase { public: std::map<std::string, Parameter> Connect() override; void Disconnect() override; CheckResult CheckConnection() const override; std::string GetProtocol() const override { return "myprotocol"; } BasicParams GetBasicParams() const override; void ReceiveFrame(bool& received, uint64_t max_size, std::span<uint8_t>& data, FrameInfo& info) override; Parameter Read(const std::string& name) override; std::vector<Parameter> Read(const std::vector<std::string>& names) override; void Write(const Parameter& param) override; void Write(const std::vector<Parameter>& params) override; std::vector<Parameter> Scan() override; AcquisitionState GetAcquisitionState() const override; void StartAcquisition(std::optional<int64_t> frame_count) override; void StopAcquisition() override; };
Export factory functions:
extern "C" { camcom::common::AdapterBase* CreateAdapter() { return new MyAdapter(); } void destroyAdapter(camcom::common::AdapterBase* adapter) { delete adapter; } }
Build as a shared library (e.g.,
libcamcom_myadapter.so).Create a YAML config that references your library:
adapter: library: 'libcamcom_myadapter.so' factory_symbol: 'CreateAdapter'
Run the server with your config:
camcomServer -c config/camcom/my_camera.yaml -l DEBUG -v
The adapter depends only on common/ (libcamcom_com). It has no
compile-time dependency on the test bench.