43 lines
1.8 KiB
C++
43 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace fgc {
|
|
|
|
// One named camera mode, loaded from <mode_dir>/<name>.ini.
|
|
//
|
|
// A mode is deliberately NOT a struct of typed camera settings: it is the raw
|
|
// list of Vimba X features to write, in file order, plus the few values the
|
|
// program itself needs. That means a new camera feature can be set by adding a
|
|
// line to an INI file - no C++ change, no vocabulary to keep in sync with the
|
|
// SDK. VimbaCameraSource asks the camera what type each feature is and converts
|
|
// the string accordingly.
|
|
struct CameraMode {
|
|
std::string name; // filename stem
|
|
std::string description;
|
|
int settle_wait_ms = 1000; // pause after standstill before keeping a frame
|
|
int frame_timeout_ms = 2000; // give up on the waypoint after this
|
|
|
|
// Vimba X features in FILE ORDER, duplicates preserved. Both matter:
|
|
// GenICam selectors are stateful, so "BalanceRatioSelector=Red,
|
|
// BalanceRatio=2.87, BalanceRatioSelector=Blue, BalanceRatio=2.0" is the
|
|
// only way to write both ratios. A std::map would sort and de-duplicate
|
|
// that into nonsense.
|
|
std::vector<std::pair<std::string, std::string>> features;
|
|
};
|
|
|
|
// Load one mode file. `name` comes from the filename stem.
|
|
// Throws std::runtime_error with a clear message on a missing file, an unknown
|
|
// section, or an unknown/invalid [Mode] key.
|
|
CameraMode loadCameraMode(const std::string& path);
|
|
|
|
// Load every *.ini in `dir`, keyed by mode name. Throws if the directory is
|
|
// missing or contains no modes - a malformed mode nobody is using today still
|
|
// fails at startup rather than the first time someone switches to it.
|
|
std::map<std::string, CameraMode> loadCameraModes(const std::string& dir);
|
|
|
|
} // namespace fgc
|